blob: bf6b5b03f4538a81673b33ec60bbf5ca19d7ec22 [file] [log] [blame]
Dennis Dmitriev6f59add2016-10-18 13:45:27 +03001# 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.
14import os
15import pkg_resources
16import time
17
18_boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True,
19 '0': False, 'no': False, 'false': False, 'off': False}
20
21_default_conf = pkg_resources.resource_filename(
22 __name__, 'templates/tcpcloud-default.yaml')
23
24
25def get_var_as_bool(name, default):
26 value = os.environ.get(name, '')
27 return _boolean_states.get(value.lower(), default)
28
29
30LOGS_DIR = os.environ.get('LOGS_DIR', os.getcwd())
31TIMESTAT_PATH_YAML = os.environ.get(
32 'TIMESTAT_PATH_YAML', os.path.join(
33 LOGS_DIR, 'timestat_{}.yaml'.format(time.strftime("%Y%m%d"))))
34
35SSH_LOGIN = os.environ.get('SSH_LOGIN', 'vagrant')
36SSH_PASSWORD = os.environ.get('SSH_PASSWORD', 'vagrant')
37SSH_NODE_CREDENTIALS = {"login": SSH_LOGIN,
38 "password": SSH_PASSWORD}
39
40CONF_PATH = os.environ.get('CONF_PATH', os.path.abspath(_default_conf))
41SHUTDOWN_ENV_ON_TEARDOWN = get_var_as_bool('SHUTDOWN_ENV_ON_TEARDOWN', True)
42
43# public_iface = IFACES[0]
44# private_iface = IFACES[1]
45IFACES = [
46 os.environ.get("IFACE_0", "eth0"),
47 os.environ.get("IFACE_1", "eth1"),
48]