added: parameter for using system proxy variables for fuelclient

This commit is contained in:
adobdin 2016-06-21 08:50:44 +00:00
parent 2941d87822
commit faa0b3936f
3 changed files with 18 additions and 2 deletions

View File

@ -89,6 +89,9 @@ def parse_args():
parser.add_argument('--fuel-ip', help='fuel ip address')
parser.add_argument('--fuel-user', help='fuel username')
parser.add_argument('--fuel-pass', help='fuel password')
parser.add_argument('--fuel-proxy',
help='use os system proxy variables for fuelclient',
action='store_true')
parser.add_argument('--only-logs',
action='store_true',
help=('Only collect logs, do not run commands or'
@ -166,6 +169,8 @@ def main(argv=None):
conf['fuel_user'] = args.fuel_user
if args.fuel_pass:
conf['fuel_pass'] = args.fuel_pass
if args.fuel_proxy:
conf['fuel_skip_proxy'] = False
if args.put or args.command or args.script or args.get:
conf['shell_mode'] = True
conf['do_print_results'] = True

View File

@ -34,6 +34,7 @@ def load_conf(filename):
conf['fuel_pass'] = 'admin'
conf['fuel_tenant'] = 'admin'
conf['fuelclient'] = True # use fuelclient library by default
conf['fuel_skip_proxy'] = True
conf['timeout'] = 15
conf['prefix'] = 'nice -n 19 ionice -c 3'
rqdir = 'rq'

View File

@ -406,16 +406,24 @@ class NodeManager(object):
self.import_rq()
self.nodes = {}
self.fuel_init()
# save os environment variables
environ = os.environ
if FuelClient and conf['fuelclient']:
try:
if self.conf['fuel_skip_proxy']:
os.environ['HTTPS_PROXY'] = ''
os.environ['HTTP_PROXY'] = ''
os.environ['https_proxy'] = ''
os.environ['http_proxy'] = ''
self.logger.info('Setup fuelclient instance')
self.fuelclient = FuelClient()
self.fuelclient.username = self.conf['fuel_user']
self.fuelclient.password = self.conf['fuel_pass']
self.fuelclient.tenant_name = self.conf['fuel_tenant']
# self.fuelclient.debug_mode(True)
except:
self.logger.info('Failed to setup fuelclient instance')
except Exception as e:
self.logger.info('Failed to setup fuelclient instance:%s' % e,
exc_info=True)
self.fuelclient = None
else:
self.logger.info('Skipping setup fuelclient instance')
@ -442,6 +450,8 @@ class NodeManager(object):
do additional apply_conf(clean=False) with this yaml.
Move some stuff from rq.yaml to extended.yaml'''
pass
# restore os environment variables
os.environ = environ
def __str__(self):
def ml_column(matrix, i):