From 67027a02b234137be33952ff48c038a97b8df88d Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Sat, 22 Jun 2019 15:07:46 +0200 Subject: [PATCH] fix: handler, asset and filter wasn't idempotent --- CHANGELOG.md | 3 ++- library/sensugo_asset.py | 2 +- library/sensugo_filter.py | 2 +- library/sensugo_handler.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 409ef4c..fc4e1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) - feat: add a debug mode with sensu_no_log variable - feat: add mutators - feat: add sensu_agent_redact variable to add new redact keywords -- fix: add new return code for api with the version 5.10 +- fix: add new return code for api with the version 5.10 +- fix: handler, asset and filter wasn't idempotent - fix: create roles before users - doc: add example in readme diff --git a/library/sensugo_asset.py b/library/sensugo_asset.py index b4bd23b..a203fe5 100644 --- a/library/sensugo_asset.py +++ b/library/sensugo_asset.py @@ -22,7 +22,7 @@ class SensuAsset: def has_changed(self, options): for option, value in self.options.iteritems(): - if options[option] != value: + if (options[option] or value) and options[option] != value: return True return False diff --git a/library/sensugo_filter.py b/library/sensugo_filter.py index 5920edd..80308cc 100644 --- a/library/sensugo_filter.py +++ b/library/sensugo_filter.py @@ -22,7 +22,7 @@ class SensuFilter: if not option in options: if value: return True - elif options[option] != value: + elif (options[option] or value) and options[option] != value: return True return False diff --git a/library/sensugo_handler.py b/library/sensugo_handler.py index 9c500b7..a41b506 100644 --- a/library/sensugo_handler.py +++ b/library/sensugo_handler.py @@ -22,7 +22,7 @@ class SensuHandler: if not option in options: if value: return True - elif options[option] != value: + elif (options[option] or value) and options[option] != value: return True return False