summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_snappy.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-03-26 21:55:26 -0400
committerScott Moser <smoser@ubuntu.com>2015-03-26 21:55:26 -0400
commitdf43c6bd3726c9a34b9f8ff4bbf75957aa751011 (patch)
treeb6f7b1fdb034422fedc1c5cd09d500c35e16f9d8 /cloudinit/config/cc_snappy.py
parentbd7165dd67338f742f999fb2c53ec5f67fc66477 (diff)
downloadvyos-cloud-init-df43c6bd3726c9a34b9f8ff4bbf75957aa751011.tar.gz
vyos-cloud-init-df43c6bd3726c9a34b9f8ff4bbf75957aa751011.zip
pep8, and some more tests
Diffstat (limited to 'cloudinit/config/cc_snappy.py')
-rw-r--r--cloudinit/config/cc_snappy.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/config/cc_snappy.py b/cloudinit/config/cc_snappy.py
index cf441c92..c926ae0a 100644
--- a/cloudinit/config/cc_snappy.py
+++ b/cloudinit/config/cc_snappy.py
@@ -99,26 +99,25 @@ def render_snap_op(op, name, path=None, cfgfile=None, config=None):
if isinstance(config, six.binary_type):
cfg_bytes = config
elif isinstance(config, six.text_type):
- cfg_bytes = config_data.encode()
+ cfg_bytes = config.encode()
else:
cfg_bytes = yaml.safe_dump(config).encode()
(fd, cfg_tmpf) = tempfile.mkstemp()
- os.write(fd, config_data)
+ os.write(fd, cfg_bytes)
os.close(fd)
cfgfile = cfg_tmpf
cmd = [SNAPPY_CMD, op]
- if op == 'install' and cfgfile:
- cmd.append('--config=' + cfgfile)
- elif op == 'config':
- cmd.append(cfgfile)
-
if op == 'install':
+ if cfgfile:
+ cmd.append('--config=' + cfgfile)
if path:
cmd.append(path)
else:
cmd.append(name)
+ elif op == 'config':
+ cmd += [name, cfgfile]
util.subp(cmd)