diff --git a/inventory.py b/inventory.py index e4dc4f3b..a91a6911 100755 --- a/inventory.py +++ b/inventory.py @@ -17,6 +17,7 @@ def parse_params(logger): parser = OptionParser() parser.add_option("-u", "--user", help="specify user to log in", action="store", dest="user") parser.add_option("-p", "--password", help="specify password to log in", action="store", dest="password") + parser.add_option("-e", "--authsource", help="specify auth source to authenticate against", action="store", dest="authsource") parser.add_option("-o", "--port", help="specify inventory port", action="store", dest="port") parser.add_option("-a", "--atlas", help="path to atlas service endpoint", action="store", dest="atlas") parser.add_option("-m", "--config", help="Path to the configuration to set properties of the resources kept in " @@ -37,6 +38,10 @@ def parse_params(logger): os.environ['USER'] = options.user if options.password: os.environ['PASSWORD'] = options.password + if options.authsource: + os.environ['AUTHSOURCE'] = options.authsource + elif "AUTHSOURCE" not in os.environ: + os.environ['AUTHSOURCE'] = 'Local' if options.info: logger.setLevel(logging.INFO) ConsoleHandler.setLevel(logging.INFO) diff --git a/tools/Vrops.py b/tools/Vrops.py index a9a61bbe..e6a00b4c 100644 --- a/tools/Vrops.py +++ b/tools/Vrops.py @@ -21,7 +21,7 @@ def get_token(target): } payload = { "username": os.environ['USER'], - "authSource": "Local", + "authSource": os.environ['AUTHSOURCE'], "password": os.environ['PASSWORD'] } disable_warnings(exceptions.InsecureRequestWarning)