Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes for Issue 57 #61

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

saurabhtalreja
Copy link

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

@@ -140,7 +140,7 @@ def consolidate_service_like_objects(profilepackage, object_type, object_friendl
replacements_made[member_to_replace] = service_to_replacement[member_to_replace]
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
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
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
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