summaryrefslogtreecommitdiffstats
path: root/deploy/post
diff options
context:
space:
mode:
authorroot <zhou.ya@zte.com.cn>2017-07-12 14:44:59 +0800
committerroot <zhou.ya@zte.com.cn>2017-07-13 15:45:34 +0800
commit6ea756e7cad324e70fd9546b15a268e910127d46 (patch)
tree3248b6893ceb341b036e67e1fb71aab198ed6524 /deploy/post
parent69a1af39f02bb5c6a471768648c15f8ae1e85776 (diff)
add sdn_controller_ip to admin_openrc.sh
Change-Id: I3af46368109bc5358fd0cc61a43f5be60479eab3 Signed-off-by: root <zhou.ya@zte.com.cn>
Diffstat (limited to 'deploy/post')
-rw-r--r--deploy/post/execute.py14
1 files changed, 13 insertions, 1 deletions
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__':