summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py35
-rw-r--r--ipalib/plugable.py3
2 files changed, 15 insertions, 23 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index eb8df591..e15e2ff0 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -396,28 +396,19 @@ class CLI(object):
def bootstrap(self):
self.__doing('bootstrap')
self.parse_globals()
-
-# if options.interactive == True:
-# self.__all_interactive = True
-# elif options.interactive == False:
-# self.__not_interactive = True
-# if options.verbose != None:
-# self.api.env.verbose = True
-# if options.environment:
-# env_dict = {}
-# for a in options.environment.split(','):
-# a = a.split('=', 1)
-# if len(a) < 2:
-# parser.error('badly specified environment string,'\
-# 'use var1=val1[,var2=val2]..')
-# env_dict[a[0].strip()] = a[1].strip()
-# self.api.env.update(env_dict, True)
-# if options.config_file:
-# self.api.env.update(read_config(options.config_file), True)
-# else:
-# self.api.env.update(read_config(), True)
-
-# return args
+ self.api.env.verbose = self.options.verbose
+ if self.options.config_file:
+ self.api.env.conf = self.options.config_file
+ overrides = {}
+ if self.options.environment:
+ for a in self.options.environment.split(','):
+ a = a.split('=', 1)
+ if len(a) < 2:
+ parser.error('badly specified environment string,'\
+ 'use var1=val1[,var2=val2]..')
+ overrides[a[0].strip()] = a[1].strip()
+ overrides['context'] = 'cli'
+ self.api.bootstrap(**overrides)
def get_usage(self, cmd):
return ' '.join(self.get_usage_iter(cmd))
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 59484989..f704077a 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -714,7 +714,7 @@ class API(DictProxy):
self.__d = dict()
self.__done = set()
self.register = Registrar(*allowed)
- self.env = Env
+ self.env = Env()
super(API, self).__init__(self.__d)
def __doing(self, name):
@@ -736,6 +736,7 @@ class API(DictProxy):
Initialize environment variables needed by built-in plugins.
"""
self.__doing('bootstrap')
+ self.env._bootstrap(**overrides)
def load_plugins(self, dry_run=False):
"""