mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Put requested devices in correct format to enable config comparison. Fixes #5000.
This commit is contained in:
parent
0ef16b44ca
commit
9432adfaf7
1 changed files with 33 additions and 1 deletions
|
@ -1181,6 +1181,7 @@ class Container(DockerBaseClass):
|
||||||
self.parameters.expected_etc_hosts = self._convert_simple_dict_to_list('etc_hosts')
|
self.parameters.expected_etc_hosts = self._convert_simple_dict_to_list('etc_hosts')
|
||||||
self.parameters.expected_env = self._get_expected_env(image)
|
self.parameters.expected_env = self._get_expected_env(image)
|
||||||
self.parameters.expected_cmd = self._get_expected_cmd()
|
self.parameters.expected_cmd = self._get_expected_cmd()
|
||||||
|
self.parameters.expected_devices = self._get_expected_devices()
|
||||||
|
|
||||||
if not self.container.get('HostConfig'):
|
if not self.container.get('HostConfig'):
|
||||||
self.fail("has_config_diff: Error parsing container properties. HostConfig missing.")
|
self.fail("has_config_diff: Error parsing container properties. HostConfig missing.")
|
||||||
|
@ -1208,7 +1209,7 @@ class Container(DockerBaseClass):
|
||||||
detach=detach,
|
detach=detach,
|
||||||
interactive=config.get('OpenStdin'),
|
interactive=config.get('OpenStdin'),
|
||||||
capabilities=host_config.get('CapAdd'),
|
capabilities=host_config.get('CapAdd'),
|
||||||
devices=host_config.get('Devices'),
|
expected_devices=host_config.get('Devices'),
|
||||||
dns_servers=host_config.get('Dns'),
|
dns_servers=host_config.get('Dns'),
|
||||||
dns_opts=host_config.get('DnsOptions'),
|
dns_opts=host_config.get('DnsOptions'),
|
||||||
dns_search_domains=host_config.get('DnsSearch'),
|
dns_search_domains=host_config.get('DnsSearch'),
|
||||||
|
@ -1433,6 +1434,37 @@ class Container(DockerBaseClass):
|
||||||
extra_networks.append(dict(name=network, id=network_config['NetworkID']))
|
extra_networks.append(dict(name=network, id=network_config['NetworkID']))
|
||||||
return extra, extra_networks
|
return extra, extra_networks
|
||||||
|
|
||||||
|
def _get_expected_devices(self):
|
||||||
|
if not self.parameters.devices:
|
||||||
|
return None
|
||||||
|
expected_devices = []
|
||||||
|
for device in self.parameters.devices:
|
||||||
|
parts = device.split(':')
|
||||||
|
if len(parts) == 1:
|
||||||
|
expected_devices.append(
|
||||||
|
dict(
|
||||||
|
CgroupPermissions='rwm',
|
||||||
|
PathInContainer=parts[0],
|
||||||
|
PathOnHost=parts[0]
|
||||||
|
))
|
||||||
|
elif len(parts) == 2:
|
||||||
|
parts = device.split(':')
|
||||||
|
expected_devices.append(
|
||||||
|
dict(
|
||||||
|
CgroupPermissions='rwm',
|
||||||
|
PathInContainer=parts[1],
|
||||||
|
PathOnHost=parts[0]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
expected_devices.append(
|
||||||
|
dict(
|
||||||
|
CgroupPermissions=parts[2],
|
||||||
|
PathInContainer=parts[1],
|
||||||
|
PathOnHost=parts[0]
|
||||||
|
))
|
||||||
|
return expected_devices
|
||||||
|
|
||||||
def _get_expected_entrypoint(self):
|
def _get_expected_entrypoint(self):
|
||||||
self.log('_get_expected_entrypoint')
|
self.log('_get_expected_entrypoint')
|
||||||
if not self.parameters.entrypoint:
|
if not self.parameters.entrypoint:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue