diff --git a/aos/blueprint.py b/aos/blueprint.py index 5a1afae..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}" - id_in = f"id in {system_id}" + 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}" 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"],) 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(