From 4be34e323b0dae5e48bf401f2f122b1eb75c8a88 Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Fri, 4 Nov 2022 14:45:03 -0400 Subject: [PATCH 1/6] replace single quote with double quote --- aos/blueprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aos/blueprint.py b/aos/blueprint.py index 67aa4f4..1ccde5f 100644 --- a/aos/blueprint.py +++ b/aos/blueprint.py @@ -752,7 +752,7 @@ def apply_configlet( id_in = f"id in {system_id}" if role and system_id: - condition = f"{role_in} and {id_in}" + condition = f"{role_in} and {id_in}".replace("'",'"') elif role: condition = role_in elif system_id: From 17a38b2a2f96cf0b1903de0ea1b40b164fae20a8 Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Fri, 4 Nov 2022 16:16:19 -0400 Subject: [PATCH 2/6] fix location where replace is located --- aos/blueprint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aos/blueprint.py b/aos/blueprint.py index 1ccde5f..8158521 100644 --- a/aos/blueprint.py +++ b/aos/blueprint.py @@ -748,11 +748,11 @@ def apply_configlet( c_path = f"/api/blueprints/{bp_id}/configlets" aos_configlets = AosConfiglets(self.rest) configlet = aos_configlets.get_configlet(conf_id=configlet_id) - role_in = f"role in {role}" + role_in = f"role in {role}".replace("'",'"') id_in = f"id in {system_id}" if role and system_id: - condition = f"{role_in} and {id_in}".replace("'",'"') + condition = f"{role_in} and {id_in}" elif role: condition = role_in elif system_id: From f8eeb8ff29e2408673178da6c19792ce873dcdcb Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Fri, 4 Nov 2022 16:19:52 -0400 Subject: [PATCH 3/6] add same fix to id_in as well --- aos/blueprint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aos/blueprint.py b/aos/blueprint.py index 8158521..cfbff57 100644 --- a/aos/blueprint.py +++ b/aos/blueprint.py @@ -749,7 +749,7 @@ def apply_configlet( aos_configlets = AosConfiglets(self.rest) configlet = aos_configlets.get_configlet(conf_id=configlet_id) role_in = f"role in {role}".replace("'",'"') - id_in = f"id in {system_id}" + id_in = f"id in {system_id}".replace("'",'"') if role and system_id: condition = f"{role_in} and {id_in}" From 4d0eb25087c615866c61534468a1fd72f4b8a7d0 Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Thu, 10 Nov 2022 12:42:05 -0500 Subject: [PATCH 4/6] fix linting --- aos/blueprint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aos/blueprint.py b/aos/blueprint.py index 051103a..f81efc5 100644 --- a/aos/blueprint.py +++ b/aos/blueprint.py @@ -748,8 +748,8 @@ def apply_configlet( c_path = f"/api/blueprints/{bp_id}/configlets" aos_configlets = AosConfiglets(self.rest) configlet = aos_configlets.get_configlet(conf_id=configlet_id) - role_in = f"role in {role}".replace("'",'"') - id_in = f"id in {system_id}".replace("'",'"') + role_in = f"role in {role}".replace("'", '"') + id_in = f"id in {system_id}".replace("'", '"') if role and system_id: condition = f"{role_in} and {id_in}" From 4d8648e15d65f30ba0af7c6115e1245ab8885e38 Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Thu, 10 Nov 2022 12:42:20 -0500 Subject: [PATCH 5/6] fix tests --- tests/test_blueprint.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_blueprint.py b/tests/test_blueprint.py index b56b88c..a421524 100644 --- a/tests/test_blueprint.py +++ b/tests/test_blueprint.py @@ -883,7 +883,8 @@ def test_apply_configlet( json_body = { "configlet": conf_dict, "label": conf_dict["display_name"], - "condition": f"role in {conf_role}", + # apstra expects json with double quotes instead of single + "condition": f"role in {conf_role}".replace("'", '"'), } aos_session.request.assert_called_with( @@ -960,7 +961,8 @@ def test_apply_configlet_combined_conditions( json_body = { "configlet": conf_dict, "label": conf_dict["display_name"], - "condition": f"role in {conf_role} and id in {conf_ids}", + # apstra expects json with double quote instead of single + "condition": f"role in {conf_role} and id in {conf_ids}".replace("'", '"'), } aos_session.request.assert_called_with( From 50080fe36b46866ad80bc31d6ee266b34cd92379 Mon Sep 17 00:00:00 2001 From: Rahul Sundaresan Date: Thu, 10 Nov 2022 12:42:59 -0500 Subject: [PATCH 6/6] Bump version number according to semvar - minor bump due to new feature --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5779478..4c2fd9d 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ NAME = "apstra-api-python" -VERSION = '0.1.21' +VERSION = '0.2.0' REQUIRES = (["requests==2.24.0"],)