adjust cc_snappy for snappy install package with config.
It was believed that to install a package with config the command was: snappy install --config=config-file <package> Instead, what was implemented in snappy was: snappy install <package> [<config-file>] This modifies cloud-init to invoke the latter and changes the tests appropriately.
This commit is contained in:
parent
d0982b0755
commit
609fc5ec36
@ -19,7 +19,7 @@ Example config:
|
|||||||
This defaults to 'False'. Set to a non-false value to enable ssh service
|
This defaults to 'False'. Set to a non-false value to enable ssh service
|
||||||
- snap installation and config
|
- snap installation and config
|
||||||
The above would install 'etcd', and then install 'pkg2.smoser' with a
|
The above would install 'etcd', and then install 'pkg2.smoser' with a
|
||||||
'--config=<file>' argument where 'file' as 'config-blob' inside it.
|
'<config-file>' argument where 'config-file' has 'config-blob' inside it.
|
||||||
If 'pkgname' is installed already, then 'snappy config pkgname <file>'
|
If 'pkgname' is installed already, then 'snappy config pkgname <file>'
|
||||||
will be called where 'file' has 'pkgname-config-blob' as its content.
|
will be called where 'file' has 'pkgname-config-blob' as its content.
|
||||||
|
|
||||||
@ -33,8 +33,7 @@ Example config:
|
|||||||
<packages_dir>/foo.config
|
<packages_dir>/foo.config
|
||||||
<packages_dir>/bar.snap
|
<packages_dir>/bar.snap
|
||||||
cloud-init will invoke:
|
cloud-init will invoke:
|
||||||
snappy install "--config=<packages_dir>/foo.config" \
|
snappy install <packages_dir>/foo.snap <packages_dir>/foo.config
|
||||||
<packages_dir>/foo.snap
|
|
||||||
snappy install <packages_dir>/bar.snap
|
snappy install <packages_dir>/bar.snap
|
||||||
|
|
||||||
Note, that if provided a 'config' entry for 'ubuntu-core', then
|
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]
|
cmd = [SNAPPY_CMD, op]
|
||||||
if op == 'install':
|
if op == 'install':
|
||||||
if cfgfile:
|
|
||||||
cmd.append('--config=' + cfgfile)
|
|
||||||
if path:
|
if path:
|
||||||
cmd.append("--allow-unauthenticated")
|
cmd.append("--allow-unauthenticated")
|
||||||
cmd.append(path)
|
cmd.append(path)
|
||||||
else:
|
else:
|
||||||
cmd.append(name)
|
cmd.append(name)
|
||||||
|
if cfgfile:
|
||||||
|
cmd.append(cfgfile)
|
||||||
elif op == 'config':
|
elif op == 'config':
|
||||||
cmd += [name, cfgfile]
|
cmd += [name, cfgfile]
|
||||||
|
|
||||||
|
@ -53,15 +53,17 @@ class TestInstallPackages(t_help.TestCase):
|
|||||||
config = None
|
config = None
|
||||||
pkg = None
|
pkg = None
|
||||||
for arg in args[2:]:
|
for arg in args[2:]:
|
||||||
if arg.startswith("--config="):
|
if arg.startswith("-"):
|
||||||
cfgfile = arg.partition("=")[2]
|
continue
|
||||||
|
if not pkg:
|
||||||
|
pkg = arg
|
||||||
|
elif not config:
|
||||||
|
cfgfile = arg
|
||||||
if cfgfile == "-":
|
if cfgfile == "-":
|
||||||
config = kwargs.get('data', '')
|
config = kwargs.get('data', '')
|
||||||
elif cfgfile:
|
elif cfgfile:
|
||||||
with open(cfgfile, "rb") as fp:
|
with open(cfgfile, "rb") as fp:
|
||||||
config = yaml.safe_load(fp.read())
|
config = yaml.safe_load(fp.read())
|
||||||
elif not pkg and not arg.startswith("-"):
|
|
||||||
pkg = arg
|
|
||||||
self.snapcmds.append(['install', pkg, config])
|
self.snapcmds.append(['install', pkg, config])
|
||||||
|
|
||||||
def test_package_ops_1(self):
|
def test_package_ops_1(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user