X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=hippotatlib%2F__init__.py;h=4c7dd90efd70d6cf5b4d72705dff618214af48cf;hb=2b13e1cc46b86b15a1522b225cde77e3e946f4cf;hp=e8a502f8a35b88b9ea616e7dce6c0089a5e55401;hpb=7852bfc8a1ba1cb194c78c3ee2826886bc1cc0f3;p=hippotat.git diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index e8a502f..4c7dd90 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -546,7 +546,7 @@ def common_startup(process_cfg): # is a directory log('directory') re = regexp.compile('[^-A-Za-z0-9_]') - for f in os.listdir(cdir): + for f in os.listdir(pathname): if re.search(f): continue subpath = pathname + '/' + f try: @@ -562,11 +562,19 @@ def common_startup(process_cfg): need_defcfg = False readconfig(value) + def oc_extra_config(od,os, value, op): + readconfig(value) + def read_defconfig(): readconfig('/etc/hippotat/config.d', False) readconfig('/etc/hippotat/passwords.d', False) readconfig('/etc/hippotat/master.cfg', False) + def oc_defconfig(od,os, value, op): + nonlocal need_defcfg + need_defcfg = False + read_defconfig(value) + def dfs_less_detailed(dl): return [df for df in DBG.iterconstants() if df <= dl] @@ -630,6 +638,18 @@ just `+': all DFLAGs. action='callback', callback= oc_config) + optparser.add_option('--extra-config', + nargs=1, + type='string', + metavar='CONFIGFILE', + dest='configfile', + action='callback', + callback= oc_extra_config) + + optparser.add_option('--default-config', + action='callback', + callback= oc_defconfig) + (opts, args) = optparser.parse_args() if len(args): optparser.error('no non-option arguments please')