-
Notifications
You must be signed in to change notification settings - Fork 14
KeyError: 'labels' when using sensu_go_check #124
Comments
Hey @adammcdonagh Thanks so much for the bug report! Sounds like I've messed up two things here. I know I didn't fully test the I'm terribly busy over the next week but, I'll try to put some time against this. If you're able to find a fix and want to PR it, feel free to go for it. |
Hm, I'm not seeing the Would it be possible for you to try again w/ the latest version in master and see if this still happens? |
Hi, I was using the latest version in the master branch. It's the I think my line numbers are slightly out because I was putting in print statements to try and debug it... |
Hey @adammcdonagh! So, #129 should resolve your second issue and includes a simple test to ensure it doesn't break in the future. Now, for the first one, I'd love to come up with a repro of the problem so that I can ensure there's no regressions going forward. Are you able to share the Ansible task config you used to cause that failure? I noticed that my integration tests use Python 2.7.16, so it's possible that there was a small change between Python 2.7.5 and Python 2.7.16 that is causing your KeyError. Will I don't think it's doable to test every permutation of Ansible versions + Python versions, I can manually see if I can get 2.7.5 to fail as well. |
Merged in #131 which should address the first issue as well. Feel free to let me know if you're still hitting problems and we can take another look. |
Hi, got a strange one... I don't know enough about Python to understand why this might be happening...
When running the playbook against my own CentOS 7 VM, it works just fine (running Python 2.7.5). However, when I run on our RHEL 7 servers, I get the following error:
I noticed that the way it's checking for labels in metadata if different to the way it's done in the main check script..
I changed:
if self.params['metadata']['labels']:
in
sensu_go.py
to:if 'labels' in self.params['metadata'] and self.params['metadata']['labels'] is not None:
and it started working straight away.
Again, I don't understand why it wouldn't work on a RHEL server when it's fine on CentOS with the same version of Python...
Also, I noticed I was getting idempotency failure when creating checks... I had to set a default for interval, since when using cron expressions, the module thinks there's a change..
interval=dict(type='int', default=0)
The text was updated successfully, but these errors were encountered: