PaloAltoNetworks / PaloAltoNetworks/pan.dev
panos-upgrade-assurance issue in check_firewall.py
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 78
- Forks
- 88
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 18
Description
Describe the bug
Running the ansible module panos_active_in_ha in a playbook we get errors generated by the script:
/usr/local/lib/python3.9/site-packages/panos_upgrade_assurance/check_firewall.py, line 109 (locale.setlocale)
It is referencing for a locale code from:
/usr/lib64/python3.9/locale.py", line 610
But errors with this:
setlocale(category, locale)\nlocale.Error: unsupported locale setting\n"
We have looked in the /usr/lib64/python3.9/locale.py in the execution environment, the section that is reporting back to check_firewall.py is:
if locale and not isinstance(locale, _builtin_str):
# convert to string
locale = normalize(_build_localename(locale))
return _setlocale(category, locale)
And we can see the default locale from check_firewall.py listed as a locale in locale.py
The locale of execution environment is: LANG=C.utf8 (which is in locale.py, but all lower case (if that is an issue))
Expected behavior
To use the default locale as expected
Current behavior
Playbook fails with this error
"/tmp/ansible_paloaltonetworks.panos.panos_active_in_ha_payload_87h9q4vv/ansible_paloaltonetworks.panos.panos_active_in_ha_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_active_in_ha.py", line 125, in main\n File "/usr/local/lib/python3.9/site-packages/panos_upgrade_assurance/check_firewall.py", line 109, in init\n locale.setlocale(\n File "/usr/lib64/python3.9/locale.py", line 610, in setlocale\n return _setlocale(category, locale)\nlocale.Error: unsupported locale setting\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
Possible solution
Unsure
Steps to reproduce
Our requirements.txt for the ansible-builder application are the below, we are installing all
scp
pyats
ansible-pylibssh
ntc-templates
netmiko
paramiko
pan-os-python
pan-python
pandevice
panos-upgrade-assurance
We are installing these collections:
collections:
- name: ansible.netcommon
- name: ansible.utils
- name: ansible.windows
- name: vmware.vmware_rest
- name: paloaltonetworks.panos
- name: dellemc.os10
- name: dellemc.os9
- name: dellemc.os6
The execution environment is based from the latest EE_BASE_IMAGE each time
EE_BASE_IMAGE: quay.io/ansible/awx-ee:latest
Context
We are trying to use the panos_active_in_ha.py module to be able to force sync config from the active firewall in a HA Pair
Your Environment
Enough info should be detailed above. We are using AWX on a single node kubernetes environment
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at panos_upgrade_assurance/check_firewall.py line 109 and trace the call from ansible_collections/paloaltonetworks/panos/plugins/modules/panos_active_in_ha.py line 125. Reproduce the failure in the AWX execution environment with LANG=C.utf8, then verify that the module uses the default locale without raising locale.Error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100