mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
openvswitch_bridge.py: Avoid runtime error with no external_ids (#25128)
This happens when there is external_ids configured on the existing OvS bridge, though playbook doesn't.
This commit is contained in:
committed by
Ricardo Carrillo Cruz
parent
9cbae80c3b
commit
6dd8a4cf78
@@ -157,11 +157,12 @@ def map_obj_to_commands(want, have, module):
|
||||
templatized_command = ("%(ovs-vsctl)s -t %(timeout)s"
|
||||
" br-set-external-id %(bridge)s")
|
||||
command = templatized_command % module.params
|
||||
for k, v in iteritems(want['external_ids']):
|
||||
if (k not in have['external_ids']
|
||||
or want['external_ids'][k] != have['external_ids'][k]):
|
||||
command += " " + k + " " + v
|
||||
commands.append(command)
|
||||
if want['external_ids']:
|
||||
for k, v in iteritems(want['external_ids']):
|
||||
if (k not in have['external_ids']
|
||||
or want['external_ids'][k] != have['external_ids'][k]):
|
||||
command += " " + k + " " + v
|
||||
commands.append(command)
|
||||
else:
|
||||
templatized_command = ("%(ovs-vsctl)s -t %(timeout)s add-br"
|
||||
" %(bridge)s")
|
||||
|
||||
Reference in New Issue
Block a user