Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-mazurkiewicz committed Oct 2, 2024
1 parent 99e4ee2 commit 7b76a81
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions nac_collector/cisco_client_sdwan.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,16 @@ def get_from_endpoints(self, endpoints_yaml_file):

if all(
x not in endpoint["endpoint"]
for x in ["%v", "%i", "/v1/feature-profile/", "/template/device/", "/template/policy/definition", "/template/policy/vedge", "/template/policy/vsmart", "/template/policy/security"]
for x in [
"%v",
"%i",
"/v1/feature-profile/",
"/template/device/",
"/template/policy/definition",
"/template/policy/vedge",
"/template/policy/vsmart",
"/template/policy/security",
]
):
response = self.get_request(self.base_url + endpoint["endpoint"])

Expand Down Expand Up @@ -161,7 +170,15 @@ def get_from_endpoints(self, endpoints_yaml_file):
endpoint_dict = self.get_device_templates(endpoint, endpoint_dict)
final_dict.update(endpoint_dict)
# policy definitions
elif any(substring in endpoint["endpoint"] for substring in ["/template/policy/definition", "/template/policy/vedge", "/template/policy/vsmart", "/template/policy/security"]):
elif any(
substring in endpoint["endpoint"]
for substring in [
"/template/policy/definition",
"/template/policy/vedge",
"/template/policy/vsmart",
"/template/policy/security",
]
):
endpoint_dict = self.get_policy_definitions(endpoint, endpoint_dict)
final_dict.update(endpoint_dict)
# for feature templates and device templates
Expand Down Expand Up @@ -240,11 +257,19 @@ def get_device_templates(self, endpoint, endpoint_dict):
)
except TypeError:
endpoint_dict[endpoint["name"]].append(
{"header": data["header"], "data": i, "endpoint": endpoint["endpoint"]}
{
"header": data["header"],
"data": i,
"endpoint": endpoint["endpoint"],
}
)
else:
endpoint_dict[endpoint["name"]].append(
{"header": data["header"], "data": data["data"], "endpoint": endpoint["endpoint"]}
{
"header": data["header"],
"data": data["data"],
"endpoint": endpoint["endpoint"],
}
)

self.log_response(endpoint, response)
Expand Down

0 comments on commit 7b76a81

Please sign in to comment.