Skip to content

Commit

Permalink
fix ansible api handle_model_data function bug
Browse files Browse the repository at this point in the history
  • Loading branch information
welliamcao committed Nov 15, 2018
1 parent 18420c8 commit 4be9060
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions OpsManage/utils/ansible_api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ def handle_model_data(self,data,module_name,module_args=None):
else:
data['status'] = 'failed'
data_list.append(data)
elif success:
if success:
for x,y in success.items():
data = {}
data['ip'] = x
Expand Down Expand Up @@ -663,7 +663,7 @@ def handle_model_data(self,data,module_name,module_args=None):
data['status'] = 'succeed'
data_list.append(data)

elif failed:
if failed:
for x,y in failed.items():
data = {}
data['ip'] = x
Expand Down Expand Up @@ -703,10 +703,10 @@ def handle_model_data(self,data,module_name,module_args=None):
# }
# }

rbt = ANSRunner(resource,redisKey='1')
rbt.run_model(host_list=["192.168.1.235","192.168.1.234","192.168.1.233"],module_name='yum',module_args="name=htop state=present")
# rbt = ANSRunner(resource,redisKey='1')
# rbt.run_model(host_list=["192.168.1.235","192.168.1.234","192.168.1.233"],module_name='shell',module_args="1.sh")
# data = rbt.get_model_result()
# print data
# print(data)
# print data
# print rbt.handle_model_data(data, 'synchronize', module_args='src=/data/webserver/VManagePlatform/ dest=/data/webserver/VManagePlatform/ compress=yes delete=yes recursive=yes')
#rbt.run_model(host_list=["192.168.1.34","192.168.1.130","192.168.1.1"],module_name='ping',module_args="")
Expand All @@ -715,4 +715,4 @@ def handle_model_data(self,data,module_name,module_args=None):
# data = rbt.get_playbook_result()
# print data
# print rbt.handle_playbook_data_to_html(data)
#print rbt.handle_model_data(module_name='copy',module_args="src=/root/git.log dest=/tmp/test.txt",data=data)
# print(rbt.handle_model_data(module_name='shell',module_args="1.sh",data=data))

0 comments on commit 4be9060

Please sign in to comment.