1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix MAC address detection in created container (#377)

Fix #373

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sergey 2022-02-17 20:17:57 +02:00 committed by GitHub
parent 527ccacf01
commit 081ac5f851
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1038,6 +1038,16 @@ class PodmanContainerDiff:
def diffparam_mac_address(self):
before = str(self.info['networksettings']['macaddress'])
if not before and self.info['networksettings'].get('networks'):
nets = self.info['networksettings']['networks']
macs = [
nets[i]["macaddress"] for i in nets if nets[i]["macaddress"]]
if macs:
before = macs[0]
if not before and 'createcommand' in self.info['config']:
cr_com = self.info['config']['createcommand']
if '--mac-address' in cr_com:
before = cr_com[cr_com.index('--mac-address') + 1].lower()
if self.module_params['mac_address'] is not None:
after = self.params['mac_address']
else: