From 6ea756e7cad324e70fd9546b15a268e910127d46 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 12 Jul 2017 14:44:59 +0800 Subject: add sdn_controller_ip to admin_openrc.sh Change-Id: I3af46368109bc5358fd0cc61a43f5be60479eab3 Signed-off-by: root --- deploy/post/execute.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'deploy') diff --git a/deploy/post/execute.py b/deploy/post/execute.py index 24061e0b..f64b9af6 100644 --- a/deploy/post/execute.py +++ b/deploy/post/execute.py @@ -10,12 +10,23 @@ import os import glance import argparse - +import yaml import neutron import nova from deploy.config.network import NetworkConfig +def _config_kolla_admin_openrc(kolla_config_path): + with open('%s/globals.yml' % kolla_config_path, 'r') as f: + kolla_config = yaml.safe_load(f.read()) + if kolla_config.get('opendaylight_leader_ip_address'): + sdn_controller_ip = kolla_config.get('opendaylight_leader_ip_address') + openrc_file = file('%s/admin-openrc.sh' % kolla_config_path, 'a') + sdn_ctl_ip = 'export SDN_CONTROLLER_IP=' + sdn_controller_ip + '\n' + openrc_file.write(sdn_ctl_ip) + openrc_file.close() + + def _config_external_network(ext_name, physnet): body = { 'network': { @@ -115,6 +126,7 @@ def main(): _create_external_network(args.network_file) _create_flavor_m1_micro() _create_image_TestVM() + _config_kolla_admin_openrc('/etc/kolla/') if __name__ == '__main__': -- cgit 1.2.3-korg