Skip to content

Commit

Permalink
Flatten if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mlow committed Sep 17, 2022
1 parent afe6da7 commit 5d718fa
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions plugins/modules/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,12 @@ def handle_define(module, v):
incoming_uuid = incoming_xml.findtext('./uuid')
existing_uuid = existing_domain.UUIDString()

if incoming_uuid is not None:
if incoming_uuid != existing_uuid:
# A user should not try defining a domain with the same name but
# different UUID
module.fail_json(msg="attempting to re-define domain %s/%s with a different UUID: %s" % (
domain_name, existing_uuid, incoming_uuid
))
if incoming_uuid is not None and incoming_uuid != existing_uuid:
# A user should not try defining a domain with the same name but
# different UUID
module.fail_json(msg="attempting to re-define domain %s/%s with a different UUID: %s" % (
domain_name, existing_uuid, incoming_uuid
))

for flag in mutate_flags:
if flag == 'ADD_UUID' and incoming_uuid is None:
Expand Down

0 comments on commit 5d718fa

Please sign in to comment.