summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2017-05-07 22:27:04 -0400
committerxudan <xudan16@huawei.com>2017-05-07 22:30:11 -0400
commit521d35a1accb93ab3fff7972fe5e7be279a60585 (patch)
tree7991c3e155c581a697767cc423500d63e8c477e3 /utils
parent87bdf551e4449d6650712702c0cbe1595b33d5c8 (diff)
Bugfix: Error when create pod.yaml file if one node's role is None
DOVETAIL-426 Error message: if node.roles[0].lower() == "controller": IndexError: list index out of range Change-Id: I96d26cc3798b993b5b296f554becfc175e3e87b4 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/create_pod_file.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/utils/create_pod_file.py b/utils/create_pod_file.py
index 22943fc97..7e30cc639 100644
--- a/utils/create_pod_file.py
+++ b/utils/create_pod_file.py
@@ -63,17 +63,27 @@ def create_file(handler):
node_list = []
index = 1
for node in nodes:
- if node.roles[0].lower() == "controller":
- node_info = {'name': "node%s" % index, 'role': node.roles[0],
- 'ip': node.ip, 'user': 'root'}
+ try:
+ if node.roles[0].lower() == "controller":
+ node_info = {'name': "node%s" % index, 'role': node.roles[0],
+ 'ip': node.ip, 'user': 'root'}
+ node_list.append(node_info)
+ index += 1
+ except Exception:
+ node_info = {'name': node.name, 'role': 'unknown', 'ip': node.ip,
+ 'user': 'root'}
node_list.append(node_info)
- index += 1
for node in nodes:
- if node.roles[0].lower() == "compute":
- node_info = {'name': "node%s" % index, 'role': node.roles[0],
- 'ip': node.ip, 'user': 'root'}
+ try:
+ if node.roles[0].lower() == "compute":
+ node_info = {'name': "node%s" % index, 'role': node.roles[0],
+ 'ip': node.ip, 'user': 'root'}
+ node_list.append(node_info)
+ index += 1
+ except Exception:
+ node_info = {'name': node.name, 'role': 'unknown', 'ip': node.ip,
+ 'user': 'root'}
node_list.append(node_info)
- index += 1
if args.INSTALLER_TYPE == 'compass':
for item in node_list:
item['password'] = 'root'