From 4a1c4a3fe3a568c98b6bab1456993c4163721c5d Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 3 Oct 2008 22:13:50 +0200 Subject: Implement argument parsing for the CLI --- ipalib/config.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ipalib/config.py') diff --git a/ipalib/config.py b/ipalib/config.py index 16bc1371..a0a33b40 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -28,6 +28,7 @@ def generate_env(d={}): server_context = False, query_dns = True, verbose = False, + interactive = True, server = LazyIter(get_servers), realm = LazyProp(get_realm), domain = LazyProp(get_domain), @@ -70,11 +71,14 @@ class LazyIter(LazyProp): yield item -def read_config(config_file=DEFAULT_CONF): - assert isinstance(config_file, (basestring, file)) +def read_config(config_file=None): + assert config_file == None or isinstance(config_file, (basestring, file)) parser = SafeConfigParser() - files = [config_file, os.path.expanduser('~/.ipa.conf')] + if config_file == None: + files = [DEFAULT_CONF, os.path.expanduser('~/.ipa.conf')] + else: + files = [config_file] for f in files: try: -- cgit