Skip to content

Bug fixes for Issue 57#61

Open
saurabhtalreja wants to merge 2 commits intomoshekaplan:mainfrom
saurabhtalreja:main
Open

Bug fixes for Issue 57#61
saurabhtalreja wants to merge 2 commits intomoshekaplan:mainfrom
saurabhtalreja:main

Conversation

@saurabhtalreja
Copy link
Copy Markdown

Bug Fix for Issue - #57

Fixes :

  • Static-Ip doesn't have nested member object in consolidatable_addresses_and_groups
  • Checking if member_to_replace present in service_to_replacement before directly querying dictionary in consolidatable_service_and_groups

object_policy_dict['service'] = service_to_replacement[member_to_replace]
# If it's a policy with only one member, it'll be parsed as a string, not a list
elif isinstance(object_policy_dict['service']['member'], str):
elif isinstance(object_policy_dict['service']['member'], str) and object_policy_dict['service']['member'] in service_to_replacement:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: and object_policy_dict['service']['member'] in service_to_replacement

I'm concerned for a scenario where there is only a single member, so the value is a string, but not present in the service_to_replacement mapping, and so it wouldn't pass the second condition. What would then happen is that it would then execute the else statement, which would iterate through the value as a string (meaning, iterating through one character at a time).

As such, this seems like this change would introduce a bug. Am I missing something?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of functionality end-to-end, I got issue in a case where object_policy_dict['service']['member'] was not present in service_to_replacement and the code was breaking on line 146

Copy link
Copy Markdown
Owner

@moshekaplan moshekaplan Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a new release with additional debugging. Could you re-run pan_analyzer with --debug appended and paste the object's information from the bottom of the debug file, after the crash that this is intended to fix, so I can see the problematic object?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants