Restructuring modules so that lookup don't happen if deleting

This commit is contained in:
John Westcott IV
2020-04-27 14:11:23 -04:00
parent fa73fe76b2
commit 7f66f084f1
18 changed files with 143 additions and 143 deletions

View File

@@ -416,6 +416,10 @@ def main():
}
})
if state == 'absent':
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
module.delete_if_needed(existing_item)
# Create notification_configuration from legacy inputs
final_notification_configuration = {}
for legacy_input in OLD_INPUT_NAMES:
@@ -440,17 +444,13 @@ def main():
if messages is not None:
new_fields['messages'] = messages
if state == 'absent':
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
module.delete_if_needed(existing_item)
elif state == 'present':
# If the state was present and we can let the module build or update the existing item, this will return on its own
module.create_or_update_if_needed(
existing_item, new_fields,
endpoint='notification_templates', item_type='notification_template',
associations={
}
)
# If the state was present and we can let the module build or update the existing item, this will return on its own
module.create_or_update_if_needed(
existing_item, new_fields,
endpoint='notification_templates', item_type='notification_template',
associations={
}
)
if __name__ == '__main__':