summaryrefslogtreecommitdiffstats
path: root/deploy/prepare/execute.py
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2017-03-15 15:50:35 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2017-03-16 10:59:43 +0800
commit14e004572090b06067ac599afb88a6bf12f63389 (patch)
tree90fab4f474a4063ce7ad1293e0ceed4ccce332cb /deploy/prepare/execute.py
parentd355d53f3cd33fb7ea0790c8b6deba0d70fa2ce4 (diff)
set 'trusts' auth model in heat
Change-Id: I2b61d756adbeef0efecb2a9d479e8c43c56c21fb Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'deploy/prepare/execute.py')
-rw-r--r--deploy/prepare/execute.py51
1 files changed, 43 insertions, 8 deletions
diff --git a/deploy/prepare/execute.py b/deploy/prepare/execute.py
index a50d9d9a..0a54a4eb 100644
--- a/deploy/prepare/execute.py
+++ b/deploy/prepare/execute.py
@@ -3,19 +3,53 @@ import os
from deploy.config.network import NetworkConfig
-NOVA_CONF_PATH = '/etc/kolla/config/nova'
-NOVA_API_CONF = '{}/nova-api.conf'.format(NOVA_CONF_PATH)
+KOLLA_CONF_PATH = '/etc/kolla/config'
+
+
+def _make_dirs(path):
+ if not os.path.isdir(path):
+ os.makedirs(path, mode=0644)
+
+
+def _write_conf_file(conf_file, conf):
+ with open(conf_file, 'w') as f:
+ f.write(conf)
+ f.close()
+
+
+def _config(service, sub_server, conf):
+ service_conf_path = os.path.join(KOLLA_CONF_PATH, service)
+ sub_service_conf = os.path.join(service_conf_path,
+ '{}-{}.conf'.format(service, sub_server))
+ _make_dirs(service_conf_path)
+ _write_conf_file(sub_service_conf, conf)
def _config_nova_api(network_file):
xnet = NetworkConfig(network_file=network_file).external_network
- if not os.path.isdir(NOVA_CONF_PATH):
- os.makedirs(NOVA_CONF_PATH, mode=0644)
+ _config('nova', 'api',
+ '[DEFAULT]\n'
+ 'default_floating_pool = {}\n'.format(xnet['network_name']))
- with open(NOVA_API_CONF, 'w') as f:
- f.write('[DEFAULT]\n'
- 'default_floating_pool={}\n'.format(xnet['network_name']))
- f.close()
+
+def _config_service(service, subs):
+ def _wrap(func):
+ def _config(*args):
+ conf_path = os.path.join(KOLLA_CONF_PATH, service)
+ _make_dirs(conf_path)
+ for sub in subs:
+ conf_file = os.path.join(conf_path,
+ '{}-{}.conf'.format(service, sub))
+ _write_conf_file(conf_file, func(*args))
+ return _config
+ return _wrap
+
+
+@_config_service('heat', ['api', 'engine'])
+def _set_trusts_auth():
+ return '[DEFAULT]\n' \
+ 'deferred_auth_method = trusts\n' \
+ 'trusts_delegated_roles =\n'
def main():
@@ -26,6 +60,7 @@ def main():
help='network configuration file')
args = parser.parse_args()
_config_nova_api(args.network_file)
+ _set_trusts_auth()
if __name__ == '__main__':