You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
sethbeauchamp
changed the title
404 error for advancedMalwareProtection when exporting policies
404 error for advancedMalwareProtection when exporting policies due to lower()
Jul 9, 2020
Error seems to be due to converting a string to lower case without considering advancedMalwareProtection specifically has capital letters.
(sdwan-viptela-0.3.0) Seths-MacBook-Pro:sdwan-viptela-0.3.0 seth$ vmanage --host vmanage.viptela.net --username admin --password goodpass export policies --file vManage-192-policies.json Traceback (most recent call last): File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/bin/vmanage", line 33, in <module> sys.exit(load_entry_point('viptela', 'console_scripts', 'vmanage')()) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/lib/python3.7/site-packages/click/decorators.py", line 33, in new_func return f(get_current_context().obj, *args, **kwargs) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/cli/export/policies.py", line 19, in policies vmanage_files.export_policy_to_file(export_file) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/apps/files.py", line 190, in export_policy_to_file policy_definitions_list = self.policy_data.export_policy_definition_list() File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/data/policy_data.py", line 328, in export_policy_definition_list policy_definition_list = self.policy_definitions.get_policy_definition_list(definition_type) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/api/policy_definitions.py", line 120, in get_policy_definition_list definition_list = self.get_policy_definition_list(def_type) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/api/policy_definitions.py", line 137, in get_policy_definition_list definition_detail = self.get_policy_definition(definition_type, definition['definitionId']) File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/api/policy_definitions.py", line 100, in get_policy_definition response = HttpMethods(self.session, url).request('GET') File "/Users/seth/dev-projects/sdwan-viptela-0.3.0/vmanage/api/http_methods.py", line 114, in request raise Exception(f"{self.url}: Error {result['status_code']} ({result['status']})") Exception: https://vmanage-1275533.viptela.net:443/dataservice/template/policy/definition/advancedmalwareprotection/7476926f-7807-41a8-a0f1-b214f8b16bd0: Error 404 (not_found)
fix:
in policy_definitions.py
for methds delete_policy_definition and update_policy_definition
replace the current url object with
if definition_type == "advancedMalwareProtection": url = f"{self.base_url}template/policy/definition/{definition_type}" else: url = f"{self.base_url}template/policy/definition/{definition_type.lower()}"
for method add_policy_definition
if policy_definition == "advancedMalwareProtection": url = f"{self.base_url}template/policy/definition/{policy_definition}" else: url = f"{self.base_url}template/policy/definition/{policy_definition.lower()}"
The text was updated successfully, but these errors were encountered: