fix: handler, asset and filter wasn't idempotent

This commit is contained in:
Adrien Waksberg 2019-06-22 15:07:46 +02:00
parent 8ea56a7e1b
commit 67027a02b2
4 changed files with 5 additions and 4 deletions

View file

@ -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 a debug mode with sensu_no_log variable
- feat: add mutators - feat: add mutators
- feat: add sensu_agent_redact variable to add new redact keywords - 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 - fix: create roles before users
- doc: add example in readme - doc: add example in readme

View file

@ -22,7 +22,7 @@ class SensuAsset:
def has_changed(self, options): def has_changed(self, options):
for option, value in self.options.iteritems(): for option, value in self.options.iteritems():
if options[option] != value: if (options[option] or value) and options[option] != value:
return True return True
return False return False

View file

@ -22,7 +22,7 @@ class SensuFilter:
if not option in options: if not option in options:
if value: if value:
return True return True
elif options[option] != value: elif (options[option] or value) and options[option] != value:
return True return True
return False return False

View file

@ -22,7 +22,7 @@ class SensuHandler:
if not option in options: if not option in options:
if value: if value:
return True return True
elif options[option] != value: elif (options[option] or value) and options[option] != value:
return True return True
return False return False