diff options
author | MofassirArif <Mofassir_Arif@dellteam.com> | 2016-01-28 04:29:29 -0800 |
---|---|---|
committer | MofassirArif <Mofassir_Arif@dellteam.com> | 2016-01-28 04:32:56 -0800 |
commit | 4c27a6b94a0664418664569384ce236159385c71 (patch) | |
tree | 7a516390c4139b019c5f50f4675b9487956a476d /func | |
parent | f39702d879a291b2686062d22a9564c29d18acf8 (diff) |
qtip: add condition for switching user to joid.
Change-Id: I9898a4eb21fb197a59fc72686d156eb4ef115388
Signed-off-by: MofassirArif <Mofassir_Arif@dellteam.com>
Diffstat (limited to 'func')
-rw-r--r-- | func/cli.py | 10 | ||||
-rw-r--r-- | func/driver.py | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/func/cli.py b/func/cli.py index 9b140874..a99e9d0f 100644 --- a/func/cli.py +++ b/func/cli.py @@ -43,6 +43,10 @@ class cli(): else: return False + def _get_fname(self,file_name): + + return file_name[0: file_name.find('.')] + def __init__(self): suite=[] @@ -93,7 +97,11 @@ class cli(): obj.callsshtest() obj.updateAnsible() dvr = Driver() - dvr.drive_bench(benchmark, obj.roles_dict.items(), benchmark_details, obj.ip_pw_dict.items()) + dvr.drive_bench(benchmark, + obj.roles_dict.items(), + self._get_fname(benchmarks[items]), + benchmark_details, + obj.ip_pw_dict.items()) else: print (args.benchmark, ' is not a Template in the Directory - \ Enter a Valid file name. or use qtip.py -h for list') diff --git a/func/driver.py b/func/driver.py index 9f7db237..3c3b75c0 100644 --- a/func/driver.py +++ b/func/driver.py @@ -21,7 +21,7 @@ class Driver: print os.environ['PWD'] self.dic_json = defaultdict() - def drive_bench(self, benchmark, roles, benchmark_detail = None, pip_dict = None): + def drive_bench(self, benchmark, roles, benchmark_fname, benchmark_detail = None, pip_dict = None): roles= sorted(roles) pip_dict = sorted(pip_dict) @@ -32,6 +32,12 @@ class Driver: self.dic_json['ip2']='' self.dic_json['installer']=str(os.environ['INSTALLER_TYPE']) self.dic_json['workingdir']=str(os.environ['PWD']) + self.dic_json['fname']=str(benchmark_fname) + self.dic_json['username']= str('root') + + if os.environ['INSTALLER_TYPE'] == str('joid'): + self.dic_json['username']=str('ubuntu') + for k,v in benchmark_detail: self.dic_json[k]=v for k, v in roles: @@ -49,5 +55,5 @@ class Driver: index= index+1 dic_json = json.dumps(dict(self.dic_json.items())) print dic_json - run_play = 'ansible-playbook -s ./benchmarks/playbooks/{0} --private-key=./data/QtipKey -i ./data/hosts --extra-vars \'{1}\' -v '.format(benchmark_name, dic_json) + run_play = 'ansible-playbook ./benchmarks/playbooks/{0} --private-key=./data/QtipKey -i ./data/hosts --extra-vars \'{1}\' -v'.format(benchmark_name, dic_json) status = os.system(run_play) |