diff --git a/changelog/63996.fixed.md b/changelog/63996.fixed.md new file mode 100644 index 00000000000..09f814a5fa4 --- /dev/null +++ b/changelog/63996.fixed.md @@ -0,0 +1 @@ +[lxd] Fixed a bug in `container_create` which prevented devices which are not of type `disk` to be correctly created and added to the container when passed via the `devices` parameter. diff --git a/salt/modules/lxd.py b/salt/modules/lxd.py index 1b97329a012..da87ca08f5a 100644 --- a/salt/modules/lxd.py +++ b/salt/modules/lxd.py @@ -688,7 +688,11 @@ def container_create( # Add devices if not wait and devices have been given. if devices: for dn, dargs in devices.items(): - container_device_add(name, dn, **dargs) + if "type" in dargs: + # extract 'type' so it won't be overwritten + container_device_add(name, dn, device_type=dargs["type"], **dargs) + else: + container_device_add(name, dn, **dargs) if _raw: return container