aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/config_parse.py
diff options
context:
space:
mode:
authorbaigk <baiguoku@huawei.com>2015-11-02 23:23:52 -0800
committerbaigk <baiguoku@huawei.com>2015-11-03 08:47:58 -0800
commitffb507c689826bb57647004f24ba8f8b8b21b758 (patch)
tree083a78d116ce981e28d61ebda3b12de82fe5d552 /deploy/config_parse.py
parent9e28b43af14bdaa4693b3d05a043ff6cdb797fbf (diff)
Create Deployment Hardware Adapter (DHA) file for compass
JIRA: COMPASS-132 Change-Id: I8e3f73b93acd8dae9f40dd43548679bc2eb1ea3c Signed-off-by: baigk <baiguoku@huawei.com>
Diffstat (limited to 'deploy/config_parse.py')
-rw-r--r--deploy/config_parse.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/deploy/config_parse.py b/deploy/config_parse.py
index f6c0dfa4..172388ce 100644
--- a/deploy/config_parse.py
+++ b/deploy/config_parse.py
@@ -34,12 +34,15 @@ def hostroles(s, seq, host=None):
def hostmacs(s, seq, host=None):
return host.get('mac', '')
-def export_config_file(s, ofile):
+def export_config_file(s, conf_dir, ofile):
env = {}
env.update(s)
if env.get('hosts', []):
env.pop('hosts')
+ env.update({'NEUTRON': os.path.join(conf_dir, "neutron_cfg.yaml")})
+ env.update({'NETWORK': os.path.join(conf_dir, "network_cfg.yaml")})
+
env.update({'TYPE': s.get('TYPE', "virtual")})
env.update({'FLAVOR': s.get('FLAVOR', "cluster")})
env.update({'HOSTNAMES': hostnames(s, ',')})
@@ -67,19 +70,19 @@ def export_reset_file(s, tmpl_dir, output_dir, output_file):
os.system("echo 'export POWER_MANAGE=%s' >> %s" % (reset_file_name, output_file))
if __name__ == "__main__":
- if len(sys.argv) != 5:
+ if len(sys.argv) != 6:
print("parameter wrong%d %s" % (len(sys.argv), sys.argv))
sys.exit(1)
- _, config_file, tmpl_dir, output_dir, output_file = sys.argv
- config_file += '.yml'
+ _, config_file, conf_dir, tmpl_dir, output_dir, output_file = sys.argv
+
if not os.path.exists(config_file):
print("%s is not exist" % config_file)
sys.exit(1)
data = init(config_file)
- export_config_file(data, os.path.join(output_dir, output_file))
+ export_config_file(data, conf_dir, os.path.join(output_dir, output_file))
export_reset_file(data, tmpl_dir, output_dir, os.path.join(output_dir, output_file))
sys.exit(0)