Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 1 | # Copyright 2016 Mirantis, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | import os |
| 15 | import pkg_resources |
| 16 | import time |
| 17 | |
| 18 | _boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True, |
| 19 | '0': False, 'no': False, 'false': False, 'off': False} |
| 20 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 21 | |
| 22 | def get_var_as_bool(name, default): |
| 23 | value = os.environ.get(name, '') |
| 24 | return _boolean_states.get(value.lower(), default) |
| 25 | |
| 26 | |
| 27 | LOGS_DIR = os.environ.get('LOGS_DIR', os.getcwd()) |
| 28 | TIMESTAT_PATH_YAML = os.environ.get( |
| 29 | 'TIMESTAT_PATH_YAML', os.path.join( |
| 30 | LOGS_DIR, 'timestat_{}.yaml'.format(time.strftime("%Y%m%d")))) |
| 31 | |
Dennis Dmitriev | 99b26fe | 2017-04-26 12:34:44 +0300 | [diff] [blame] | 32 | VIRTUAL_ENV = os.environ.get("VIRTUAL_ENV", None) |
| 33 | ENV_NAME = os.environ.get("ENV_NAME", None) |
| 34 | |
Dennis Dmitriev | 2a13a13 | 2016-11-04 00:56:23 +0200 | [diff] [blame] | 35 | LAB_CONFIG_NAME = os.environ.get('LAB_CONFIG_NAME', 'mk22-lab-basic') |
| 36 | #LAB_CONFIGS_NAME = os.environ.get('LAB_NAME', 'mk22-lab-advanced') |
| 37 | |
Dennis Dmitriev | 9512679 | 2016-10-18 17:03:30 +0300 | [diff] [blame] | 38 | SSH_LOGIN = os.environ.get('SSH_LOGIN', 'root') |
| 39 | SSH_PASSWORD = os.environ.get('SSH_PASSWORD', 'r00tme') |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 40 | SSH_NODE_CREDENTIALS = {"login": SSH_LOGIN, |
| 41 | "password": SSH_PASSWORD} |
| 42 | |
Dennis Dmitriev | 6f59add | 2016-10-18 13:45:27 +0300 | [diff] [blame] | 43 | SHUTDOWN_ENV_ON_TEARDOWN = get_var_as_bool('SHUTDOWN_ENV_ON_TEARDOWN', True) |
| 44 | |
| 45 | # public_iface = IFACES[0] |
| 46 | # private_iface = IFACES[1] |
| 47 | IFACES = [ |
| 48 | os.environ.get("IFACE_0", "eth0"), |
| 49 | os.environ.get("IFACE_1", "eth1"), |
| 50 | ] |