From d540004b880c7bf243f72acb29c9375da8b8f78f Mon Sep 17 00:00:00 2001 From: Zachery Lantz Date: Thu, 25 Apr 2024 17:27:44 -0400 Subject: [PATCH] fixed a typo in upgrades unit test, changed response in deployment request to be the entire response so it can be piped into wait_for_task. This doesn't seem to break anything else in the library but could break code in the wild, but I believe returning the full response from a deployment request to be worth the cost --- fmcapi/api_objects/deployment_services/deploymentrequests.py | 2 +- unit_tests/upgrades.py | 5 +++-- unit_tests/wait_for_task.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fmcapi/api_objects/deployment_services/deploymentrequests.py b/fmcapi/api_objects/deployment_services/deploymentrequests.py index 4b9296c..a78e51d 100644 --- a/fmcapi/api_objects/deployment_services/deploymentrequests.py +++ b/fmcapi/api_objects/deployment_services/deploymentrequests.py @@ -63,7 +63,7 @@ def post(self): response = self.fmc.send_to_api( method="post", url=self.URL, json_data=json_data ) - return response["deviceList"] + return response def put(self): """PUT method for API for DeploymentRequests not supported.""" diff --git a/unit_tests/upgrades.py b/unit_tests/upgrades.py index d0a6f23..bffc961 100644 --- a/unit_tests/upgrades.py +++ b/unit_tests/upgrades.py @@ -71,7 +71,8 @@ def test__upgrades(fmc): # logging.info(f"Upgrade completed. Triggering deployment to devices") # deployment = fmcapi.DeploymentRequests(fmc=fmc) - # logging.info(deployment) - # wait_for_task(fmc=fmc, task=deployment["metadata"]["task"], wait_time=60) + # response = deployment.post() + # logging.info(response) + # wait_for_task(fmc=fmc, task=response["metadata"]["task"], wait_time=60) logging.info("Test UpgradePackages/ApplicableDevices/Upgrades Complete") diff --git a/unit_tests/wait_for_task.py b/unit_tests/wait_for_task.py index c1c43f3..b8d29c6 100644 --- a/unit_tests/wait_for_task.py +++ b/unit_tests/wait_for_task.py @@ -4,7 +4,7 @@ def wait_for_task(fmc, task, wait_time=10): - task_completed_states = ["Success", "SUCCESS", "COMPLETED"] + task_completed_states = ["Success", "SUCCESS", "COMPLETED", "Deployed"] try: status = fmcapi.TaskStatuses(fmc=fmc, id=task["id"]) current_status = status.get()