diff --git a/cloudinit/config/cc_snappy.py b/cloudinit/config/cc_snappy.py index 131ee7ea..6a7ae09b 100644 --- a/cloudinit/config/cc_snappy.py +++ b/cloudinit/config/cc_snappy.py @@ -19,7 +19,7 @@ Example config: This defaults to 'False'. Set to a non-false value to enable ssh service - snap installation and config The above would install 'etcd', and then install 'pkg2.smoser' with a - '--config=' argument where 'file' as 'config-blob' inside it. + '' argument where 'config-file' has 'config-blob' inside it. If 'pkgname' is installed already, then 'snappy config pkgname ' will be called where 'file' has 'pkgname-config-blob' as its content. @@ -33,8 +33,7 @@ Example config: /foo.config /bar.snap cloud-init will invoke: - snappy install "--config=/foo.config" \ - /foo.snap + snappy install /foo.snap /foo.config snappy install /bar.snap Note, that if provided a 'config' entry for 'ubuntu-core', then @@ -171,13 +170,13 @@ def render_snap_op(op, name, path=None, cfgfile=None, config=None): cmd = [SNAPPY_CMD, op] if op == 'install': - if cfgfile: - cmd.append('--config=' + cfgfile) if path: cmd.append("--allow-unauthenticated") cmd.append(path) else: cmd.append(name) + if cfgfile: + cmd.append(cfgfile) elif op == 'config': cmd += [name, cfgfile] diff --git a/tests/unittests/test_handler/test_handler_snappy.py b/tests/unittests/test_handler/test_handler_snappy.py index 8effd99d..f3109bac 100644 --- a/tests/unittests/test_handler/test_handler_snappy.py +++ b/tests/unittests/test_handler/test_handler_snappy.py @@ -53,15 +53,17 @@ class TestInstallPackages(t_help.TestCase): config = None pkg = None for arg in args[2:]: - if arg.startswith("--config="): - cfgfile = arg.partition("=")[2] + if arg.startswith("-"): + continue + if not pkg: + pkg = arg + elif not config: + cfgfile = arg if cfgfile == "-": config = kwargs.get('data', '') elif cfgfile: with open(cfgfile, "rb") as fp: config = yaml.safe_load(fp.read()) - elif not pkg and not arg.startswith("-"): - pkg = arg self.snapcmds.append(['install', pkg, config]) def test_package_ops_1(self):