summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpuppethost.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/puppethost.py b/puppethost.py
index 3f6671d..53efe7d 100755
--- a/puppethost.py
+++ b/puppethost.py
@@ -35,6 +35,20 @@ except:
config = os.path.expanduser('~/.puppethost')
if os.path.exists(config):
execfile(config, {}, defaults)
+ truths = ['true', 'yes', '1']
+ # Ensure boolean options are set correctly
+ for opt in ['force', 'force_cert', 'force_tarball', 'force_package']:
+ defaults[opt] = str(defaults[opt]).lower() in truths
+ # Ensure numeric options are set correctly
+ for opt in ['verbose']:
+ if isinstance(defaults[opt], bool):
+ defaults[opt] = int(defaults[opt])
+ elif not isinstance(defaults[opt], int):
+ try:
+ defaults[opt] = int(str(defaults[opt]).lower() in truths)
+ except:
+ raise
+ defaults[opt] = 0
package_types = ['deb', 'rpm']