From 29d8730686b539af7252e54f10b1bf19be3423e5 Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Tue, 7 Apr 2015 10:29:42 +0200 Subject: Automatic Deployment - configure environment - configure initial settings - configure networking - hardware adapter for HP - fuel VM deployment JIRA: [BGS-2] Create Fuel deployment scrip Change-Id: If305477833c54547efe7e6ebfddafde0ab31ebd2 Signed-off-by: Szilard Cserey --- fuel/deploy/common.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 fuel/deploy/common.py (limited to 'fuel/deploy/common.py') diff --git a/fuel/deploy/common.py b/fuel/deploy/common.py new file mode 100644 index 0000000..cd5085c --- /dev/null +++ b/fuel/deploy/common.py @@ -0,0 +1,29 @@ +import subprocess +import sys + + +N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5, + 'roles': 6, 'pending_roles': 7, 'online': 8} +E = {'id': 0, 'status': 1, 'name': 2, 'mode': 3, 'release_id': 4, + 'changes': 5, 'pending_release_id': 6} +R = {'id': 0, 'name': 1, 'state': 2, 'operating_system': 3, 'version': 4} +RO = {'name': 0, 'conflicts': 1} + +def exec_cmd(cmd): + process = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + shell=True) + return process.communicate()[0] + +def parse(printout): + parsed_list = [] + lines = printout.splitlines() + for l in lines[2:]: + parsed = [e.strip() for e in l.split('|')] + parsed_list.append(parsed) + return parsed_list + +def err(error_message): + sys.stderr.write(error_message) + sys.exit(1) -- cgit 1.2.3-korg