Update `lxd.container` argument: `name` -> `id`.
@@ -17,7 +17,7 @@ def get_container_named(name, containers):
@operation
def container(
- state, host, name,
+ state, host, id,
present=True, image='ubuntu:16.04',
):
'''
@@ -26,7 +26,7 @@ def container(
Note: does not check if an existing container is based on the specified
image.
- + name: name of the container
+ + id: name/identifier for the container
+ image: image to base the container on
+ present: whether the container should be present or absent
@@ -41,17 +41,17 @@ def container(
)
'''
- container = get_container_named(name, host.fact.lxd_containers)
+ container = get_container_named(id, host.fact.lxd_containers)
# Container exists and we don't want it
if container and not present:
if container['status'] == 'Running':
- yield 'lxc stop {0}'.format(name)
+ yield 'lxc stop {0}'.format(id)
# Command to remove the container:
- yield 'lxc delete {0}'.format(name)
+ yield 'lxc delete {0}'.format(id)
# Container doesn't exist and we want it
if not container and present:
# Command to create the container:
- yield 'lxc launch {image} {name}'.format(name=name, image=image)
+ yield 'lxc launch {image} {id}'.format(id=id, image=image)
