This is an automated email from the ASF dual-hosted git repository.
arvindsh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo-muchos.git
The following commit(s) were added to refs/heads/master by this push:
new 34aaeb1 Correctly handle default decorator for booleans (#319)
34aaeb1 is described below
commit 34aaeb19bc19ee948d36e85a27871449fdd450d9
Author: Arvind Shyamsundar <[email protected]>
AuthorDate: Wed Feb 5 17:51:55 2020 -0800
Correctly handle default decorator for booleans (#319)
Fixes a bug in the handling of defaults within the Python decorator code
wherein any boolean parameter would always be assigned the default
value. Correspondingly also fixes the type of use_adlsg2 to boolean.
---
lib/muchos/config/azure.py | 5 +++--
lib/muchos/config/decorators.py | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/muchos/config/azure.py b/lib/muchos/config/azure.py
index 86c584c..b8f84f1 100644
--- a/lib/muchos/config/azure.py
+++ b/lib/muchos/config/azure.py
@@ -107,9 +107,10 @@ class AzureDeployConfig(BaseConfig):
return self.get('azure', 'az_logs_key')
@ansible_host_var(name='use_adlsg2')
- @default(None)
+ @is_valid(is_in([True, False]))
+ @default(False)
def use_adlsg2(self):
- return self.get('azure', 'use_adlsg2')
+ return self.getboolean('azure', 'use_adlsg2')
@ansible_host_var(name='azure_tenant_id')
@default(None)
diff --git a/lib/muchos/config/decorators.py b/lib/muchos/config/decorators.py
index c3cf8d2..e3a709f 100644
--- a/lib/muchos/config/decorators.py
+++ b/lib/muchos/config/decorators.py
@@ -74,7 +74,7 @@ def default(val):
except:
return val
else:
- if res in [None, 0, ''] or isinstance(res, str) and len(res)
== 0:
+ if res is None or (isinstance(res, str) and len(res) == 0):
return val
return res
return wrapper