Skip to content

Commit

Permalink
Inverntory workflow feature enhancement (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhansansel authored Oct 29, 2024
2 parents a8b0221 + 08f202d commit fbe937c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/modules/inventory_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ def export_device_details(self):
"""

device_ips = self.get_device_ips_from_config_priority()
output_file_name = ''

if not device_ips:
self.status = "failed"
Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/inventory_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ def __init__(self, module):
self.response_list, self.role_updated_list, self.device_role_name = [], [], []
self.udf_added, self.udf_deleted = [], []
self.ip_address_for_update, self.updated_ip = [], []
self.output_file_name = []

def validate_input(self):
"""
Expand Down Expand Up @@ -1192,6 +1193,7 @@ def export_device_details(self):
"""

device_ips = self.get_device_ips_from_config_priority()
output_file_name = ''

if not device_ips:
self.status = "failed"
Expand Down Expand Up @@ -1272,6 +1274,7 @@ def export_device_details(self):
csv_writer.writerows(device_data)

self.msg = "Device Details Exported Successfully to the CSV file: {0}".format(output_file_name)
self.output_file_name.append(output_file_name)
self.log(self.msg, "INFO")
self.status = "success"
self.result['changed'] = True
Expand Down Expand Up @@ -4098,6 +4101,10 @@ def update_inventory_profile_messages(self):
"been updated successfully.").format(ip_address_for_update, updated_ip)
result_msg_list_changed.append(updated_ip_msg)

if self.output_file_name:
output_file_name = "Device Details Exported Successfully to the CSV file: {0}".format("', '".join(self.output_file_name))
result_msg_list_changed.append(output_file_name)

if result_msg_list_not_changed and result_msg_list_changed:
self.result["changed"] = True
self.msg = "{0}, {1}".format(" ".join(result_msg_list_not_changed), " ".join(result_msg_list_changed))
Expand Down

0 comments on commit fbe937c

Please sign in to comment.