Beispiel #1
0
CRED_FILE = '.passwd'

# Global logger setup: CRITICAL < ERROR < WARNING < INFO < DEBUG
LOGFORMAT = '%(asctime)s:%(name)s:%(levelname)s - %(message)s'
LOGLEVELS = {
    'CRITICAL': logging.CRITICAL,
    'ERROR': logging.ERROR,
    'WARNING': logging.WARNING,
    'INFO': logging.INFO,
    'DEBUG': logging.DEBUG
}
LOGGER_LVL = os.getenv('RACKHD_TEST_LOGLVL', 'WARNING')
logging.basicConfig(level=LOGLEVELS[LOGGER_LVL], format=LOGFORMAT)

# API client configuration
config = Configuration()
config.host = 'http://{0}:{1}'.format(HOST_IP, HOST_PORT)
config.verify_ssl = False
config.api_client = ApiClient(host=config.host)
config.debug = False
config.logger_format = LOGFORMAT
for key, elem in config.logger.iteritems():
    elem.setLevel(LOGLEVELS[LOGGER_LVL])


# Obfuscate credentials
def set_bmc_cred(user, password):
    u = b64encode(user)
    p = b64encode(password)
    with open(CRED_FILE, 'w+') as file:
        out = \
Beispiel #2
0
CRED_FILE = '.passwd'

# Global logger setup: CRITICAL < ERROR < WARNING < INFO < DEBUG
LOGFORMAT = '%(asctime)s:%(name)s:%(levelname)s - %(message)s'
LOGLEVELS = {
    'CRITICAL': logging.CRITICAL,
    'ERROR': logging.ERROR,
    'WARNING': logging.WARNING,
    'INFO': logging.INFO,
    'DEBUG': logging.DEBUG
}
LOGGER_LVL = os.getenv('RACKHD_TEST_LOGLVL', 'WARNING')
logging.basicConfig(level=LOGLEVELS[LOGGER_LVL], format=LOGFORMAT)

# API client configuration
config = Configuration()
config.host = 'http://{0}:{1}'.format(HOST_IP,HOST_PORT)
config.verify_ssl = False
config.api_client = ApiClient(host=config.host)
config.debug = False
config.logger_format = LOGFORMAT
for key,elem in config.logger.iteritems():
    elem.setLevel(LOGLEVELS[LOGGER_LVL])

# Obfuscate credentials
def set_bmc_cred(user,password):
    u = b64encode(user)
    p = b64encode(password)
    with open(CRED_FILE,'w+') as file:
        out = \
        'BMC_USER="******"\n'.format(u) + \
Beispiel #3
0
from settings import * 
from on_http import Configuration, ApiClient

config = Configuration() 
config.host = 'http://{0}:{1}'.format(HOST_IP,HOST_PORT)
config.host_authed = 'https://{0}:{1}'.format(HOST_IP,HOST_PORT_AUTH)
config.verify_ssl = False
config.api_client = ApiClient(host=config.host)
config.api_client_authed = ApiClient(host=config.host_authed)
config.auth_enabled = False
config.debug = False
config.logger_format = LOGFORMAT
for key,elem in config.logger.iteritems():
    elem.setLevel(LOGLEVELS[LOGGER_LVL])