X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/blobdiff_plain/f2acfa0565a11ed251ad390461a5c428640681c2..56d46e5318cde77e9e28fedbb534c33da432d6d0:/scripts/invirt-getconf?ds=sidebyside diff --git a/scripts/invirt-getconf b/scripts/invirt-getconf index 4721212..6156427 100755 --- a/scripts/invirt-getconf +++ b/scripts/invirt-getconf @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ invirt-getconf loads an invirt configuration file (either the original YAML @@ -13,12 +13,9 @@ the YAML configuration; e.g., they cannot contain dots.) Examples: invirt-getconf db.uri - invirt-getconf authn.0.type + invirt-getconf hosts.0.ip """ -from invirt.config import load -from sys import argv, exit, stderr, stdout -from optparse import OptionParser class invirt_exception(Exception): pass @@ -26,12 +23,6 @@ def main(argv): try: parser = OptionParser(usage = '%prog [options] key', description = __doc__.strip().split('\n\n')[0]) - parser.add_option('-s', '--src', - default = '/etc/invirt/master.yaml', - help = 'the source YAML configuration file to read from') - parser.add_option('-c', '--cache', - default = '/var/lib/invirt/invirt.json', - help = 'path to the JSON cache') parser.add_option('-r', '--refresh', action = 'store_true', help = 'force the cache to be regenerated') @@ -44,10 +35,16 @@ def main(argv): raise invirt_exception(__doc__.strip()) elif args and args[0]: components = args[0].split('.') +import argparse +import sys +import yaml + +import invirt + else: components = [] - conf = load(opts.src, opts.cache, opts.refresh) + conf = config.load(opts.refresh) for i, component in enumerate(components): progress = '.'.join(components[:i]) if type(conf) not in (dict, list): @@ -88,5 +85,3 @@ def main(argv): if __name__ == '__main__': exit(main(argv)) - -# vim:et:sw=4:ts=4