Skip to content

Fix bug when PORT key is missing on flex counter table#760

Merged
sdszhang merged 5 commits intoAzure:202412from
AharonMalkin:counterpoll_fix
Oct 17, 2025
Merged

Fix bug when PORT key is missing on flex counter table#760
sdszhang merged 5 commits intoAzure:202412from
AharonMalkin:counterpoll_fix

Conversation

@AharonMalkin
Copy link

After the following Change: #723
On some cases, when trying to override the counterpoll interval, the user gets a key error:


importlib._bootstrap>\\", line 621, in _exec\\n  File \\"<frozen importlib._bootstrap_external>\\", line 940, in 
exec_module\\n  File \\"<frozen importlib._bootstrap>\\", line 241, in _call_with_frames_removed\\n  File 
\\"/tmp/ansible_generate_golden_config_db_payload_9x6dtuml/__main__.py\\", line 341, in <module>\\n  File 
\\"/tmp/ansible_generate_golden_config_db_payload_9x6dtuml/__main__.py\\", line 337, in main\\n  File 
\\"/tmp/ansible_generate_golden_config_db_payload_9x6dtuml/__main__.py\\", line 324, in generate\\n  File 
\\"/tmp/ansible_generate_golden_config_db_payload_9x6dtuml/__main__.py\\", line 135, in 
generate_full_lossy_golden_config_db\\nKeyError: 'PORT'\\n",

To fix it, I added a setdefault method to create the key if it doesnt exist.

Copy link

@sdszhang sdszhang left a comment

Choose a reason for hiding this comment

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

lgtm

@sdszhang sdszhang merged commit 5c7b8c9 into Azure:202412 Oct 17, 2025
1 check passed
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