summaryrefslogtreecommitdiffstats
path: root/odl-pipeline/lib/utils/tripleo_helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'odl-pipeline/lib/utils/tripleo_helper.py')
-rw-r--r--odl-pipeline/lib/utils/tripleo_helper.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/odl-pipeline/lib/utils/tripleo_helper.py b/odl-pipeline/lib/utils/tripleo_helper.py
index 702e811..0c5695e 100644
--- a/odl-pipeline/lib/utils/tripleo_helper.py
+++ b/odl-pipeline/lib/utils/tripleo_helper.py
@@ -1,3 +1,12 @@
+#
+# Copyright (c) 2017 All rights reserved
+# This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+#
import re
import processutils
from processutils import execute
@@ -23,12 +32,12 @@ class TripleoHelper():
@staticmethod
def get_virtual_node_name_from_mac(mac):
vnode_names, _ = execute('virsh list|awk \'{print '
- '$2}\'', shell=True)
+ '$2}\'', shell=True, as_root=True)
for node in vnode_names.split('\n'):
if 'baremetal' in node:
admin_net_mac, _ = execute(
'virsh domiflist %s |grep admin |awk \'{print $5}\''
- % node, shell=True)
+ % node, shell=True, as_root=True)
if admin_net_mac.replace('\n', '') == mac:
return node
raise Exception('Could not find corresponding virtual node for MAC: %s'
@@ -36,16 +45,18 @@ class TripleoHelper():
@staticmethod
def get_undercloud_ip():
- out, _ = execute('virsh domifaddr undercloud', shell=True)
+ out, _ = execute('virsh domifaddr undercloud', shell=True,
+ as_root=True)
return re.findall('([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', out)[0]
@staticmethod
def get_undercloud():
return Node('undercloud', address=TripleoHelper.get_undercloud_ip(),
- user='stack')
+ user='stack', password='stack')
class TripleOHelperException(Exception):
+
def __init__(self, value):
self.value = value