-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Type issue #1029
Type issue #1029
Conversation
AttributeError with Icinga DB 1.2.0 / Icinga DB Web 1.1.2 HenriWahl#1028 Nagstamon Error: AttributeError: 'bool' object has no attribute 'replace'
@@ -220,7 +220,8 @@ def _get_status(self): | |||
self.new_hosts[host_name].notifications_disabled = not int(h.get('notifications_enabled') or '0') | |||
self.new_hosts[host_name].flapping = bool(int(h['state']['is_flapping'] or 0)) | |||
#s['state']['is_acknowledged'] can be null, 0, 1, or 'sticky' | |||
self.new_hosts[host_name].acknowledged = bool(int(h['state']['is_acknowledged'].replace('sticky', '1') or 0)) | |||
#self.new_hosts[host_name].acknowledged = bool(int(h['state']['is_acknowledged'].replace('sticky', '1') or 0)) | |||
self.new_hosts[host_name].acknowledged = h['state']['is_acknowledged'] if isinstance(h['state']['is_acknowledged'], (bool)) else bool(int(h['state']['is_acknowledged'].replace('sticky', '1') or 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it work with bool
instead of (bool)
too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me with the correction from @HenriWahl
@@ -323,7 +324,8 @@ def _get_status(self): | |||
self.new_hosts[host_name].services[service_name].notifications_disabled = not int(s.get('notifications_enabled') or '0') | |||
self.new_hosts[host_name].services[service_name].flapping = bool(int(s['state']['is_flapping'] or 0)) | |||
#s['state']['is_acknowledged'] can be null, 0, 1, or 'sticky' | |||
self.new_hosts[host_name].services[service_name].acknowledged = bool(int(s['state']['is_acknowledged'].replace('sticky', '1') or 0)) | |||
#self.new_hosts[host_name].services[service_name].acknowledged = bool(int(s['state']['is_acknowledged'].replace('sticky', '1') or 0)) | |||
self.new_hosts[host_name].services[service_name].acknowledged = s['state']['is_acknowledged'] if isinstance(s['state']['is_acknowledged'], (bool)) else bool(int(s['state']['is_acknowledged'].replace('sticky', '1') or 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. 😄
Please check latest release 3.15-20240503. |
Hi
Attempt to fix the issue:
AttributeError with Icinga DB 1.2.0 / Icinga DB Web 1.1.2 #1028 Nagstamon Error: AttributeError: 'bool' object has no attribute 'replace'
First pull request ever so please review carefully.
Slightly modified two lines, my nagstamon works after the changes.