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
Fix boolean defaults. #1343
Fix boolean defaults. #1343
Conversation
cc @Akasurde @Andersson007 @DBendit @Dorn- @nitaco @Nosmoht @WojciechowskiPiotr @agronholm @ahtik @akshay196 @albertomurillo @alikins @amit0701 @andytom @angstwad @barnabycourt @bcoca @bennojoy @bgurney-rh @brontitall @carchi8py @chouseknecht @claco @colin-nolan @danihodovic @dariko @dermute @devyanikota @emonty @erjohnso @fishman @fxfitz @glitchcrab @haad @hnanni @hulquest @ilicmilan @jasperla @jbscalia @jpdasma @jwitko @kahowell @kamsz @kassiansun @kostiantyn-nemchenko @lmprice @lonico @machacekondra @matburt @mator @ndswartz @nerzhul @nibalizer @ovcharenko @pyykkis @rambleraptor @ravibhure @rosmo @russoz @sac @scathatheworm @schmots1 @scottanderson42 @sebasmannem @sgargan @smashwilson @srvg @tastychutney @tbouvet @tcraxs @timuster @troy2914 @xen0l |
This needs to be merged first before any of the removal PRs can be merged, since we also need the fixes for the removed stuff in the stable-1 branch (where it's still there). |
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.
Three places are potentially problemated; I explained here why they are ok. This should make it easier to verify that this PR is ok.
@@ -270,7 +270,7 @@ def main(): | |||
|
|||
apps=dict(default=None, required=False), | |||
cache_table=dict(default=None, required=False, type='str'), | |||
clear=dict(default=None, required=False, type='bool'), | |||
clear=dict(default=False, required=False, type='bool'), |
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.
All options in specific_boolean_params
are only tested for being truthy, so None
and False
are teated the same way.
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.
Personally I think it is better to remove it, but other than that, using a default that is actually in the domain of values for the specified type does look better.
@@ -141,7 +141,7 @@ def call_peer_commands(self): | |||
def main(): | |||
module = AnsibleModule( | |||
argument_spec=dict( | |||
force=dict(type='bool', required=False), | |||
force=dict(type='bool', required=False, default=False), |
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.
Force is only tested for truthy in
self.force = 'force' if self.module.params.get('force') else '' |
False
and None
are treated the same way.
@@ -276,7 +276,7 @@ def main(): | |||
timeout=dict(type='int', default=30), | |||
type=dict(choices=['PUBLIC', 'SERVICENET'], default='PUBLIC'), | |||
vip_id=dict(), | |||
wait=dict(type='bool'), | |||
wait=dict(type='bool', default=False), |
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.
wait
is passed on into cloud_load_balancer
, and is there only tested for being truthy:
if wait: elif wait and balancer.status not in ('ACTIVE', 'ERROR'): if wait:
Therefore False
and None
are treated the same way.
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.
approved for na_cdot file
In general, we use a value of None to detect whether the value was set by the user.
verified influx_db params |
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.
postgresql_set - should work, thanks @felixfontein
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.
Thanks for doing this
(cherry picked from commit a96f90f)
@lonico @resmo @Andersson007 @gundalow thanks a lot for reviewing and merging! |
SUMMARY
Fallout of ansible/ansible#72699.
ISSUE TYPE
COMPONENT NAME
various