summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Zullinger <tmz@pobox.com>2009-03-15 22:02:31 -0400
committerTodd Zullinger <tmz@pobox.com>2009-08-28 10:47:15 -0400
commitb7a4daa305372e75145700517ddd061572a33386 (patch)
treeda76b345b2fe055f2f66b606700fa480d6fee683
parent98e3135425eb69e719c055223a9cb5d308156141 (diff)
downloadpuppet-host-package-b7a4daa305372e75145700517ddd061572a33386.zip
puppet-host-package-b7a4daa305372e75145700517ddd061572a33386.tar.gz
puppet-host-package-b7a4daa305372e75145700517ddd061572a33386.tar.xz
Support system-wide config file
This reads /etc/puppet/hostpackage.conf and then ~/.puppethost, with the latter overriding settings from the former.
-rw-r--r--puppethost.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/puppethost.py b/puppethost.py
index 6a08ae3..a4b6106 100644
--- a/puppethost.py
+++ b/puppethost.py
@@ -47,23 +47,24 @@ try:
except:
pass
-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
+configs = ['/etc/puppet/hostpackage.conf', os.path.expanduser('~/.puppethost')]
+for config in configs:
+ 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']