Fix UnboundLocalError in update_etc_hosts #2797
Fix UnboundLocalError in update_etc_hosts #2797eliajahshan wants to merge 1 commit intoopenshift:masterfrom
Conversation
…y exist The log.info referenced 'ip' and 'dns_name' variables that were only bound inside for-loops. When all entries in dns_map were already present in /etc/hosts, the second loop iterated over an empty dict, leaving the variables unbound and crashing with UnboundLocalError. Snapshot dns_map before mutation and log all entries after writing.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: eliajahshan The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @eliajahshan. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
when all DNS entries already exist
The log.info referenced 'ip' and 'dns_name' variables that were only bound inside for-loops. When all entries in dns_map were already present in /etc/hosts, the second loop iterated over an empty dict, leaving the variables unbound and crashing with UnboundLocalError.
Snapshot dns_map before mutation and log all entries after writing.