Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 #216

Open
wants to merge 7 commits into
base: v3
Choose a base branch
from
Open

v3 #216

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
4 changes: 2 additions & 2 deletions OpsManage/views/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def cron_add(request):
else:resource = [{"ip": server.ip, "port": int(server.port),"username": server.username,"password": server.passwd}]
ANS = ANSRunner(resource)
if cron.cron_script:
src = os.getcwd() + '/' + str(cron.cron_script)
src = os.getcwd() + '/upload/' + str(cron.cron_script)
file_args = """src={src} dest={dest} owner={user} group={user} mode=755""".format(src=src,dest=cron.cron_script_path,user=cron.cron_user)
ANS.run_model(host_list=sList,module_name="copy",module_args=file_args)
result = ANS.handle_model_data(ANS.get_model_result(), 'copy',file_args)
Expand Down Expand Up @@ -151,7 +151,7 @@ def cron_mod(request,cid):
if cron.cron_status == 0:ANS.run_model(host_list=sList,module_name="cron",module_args="""name={name} state=absent""".format(name=cron.cron_name))
else:
if cron.cron_script:
src = os.getcwd() + '/' + str(cron.cron_script)
src = os.getcwd() + '/upload/' + str(cron.cron_script)
file_args = """src={src} dest={dest} owner={user} group={user} mode=755""".format(src=src,dest=cron.cron_script_path,user=cron.cron_user)
ANS.run_model(host_list=sList,module_name="copy",module_args=file_args)
cron_args = """name={name} minute='{minute}' hour='{hour}' day='{day}'
Expand Down
10 changes: 8 additions & 2 deletions OpsManage/views/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ def index(request):
order.order_url = '/file/download/run/{id}/'.format(id=order.id)
order.order_content = order.filedownload_audit_order.order_content
else:order.order_content = '未知'
order.order_user = User.objects.get(id=order.order_user).username
order.order_executor = User.objects.get(id=order.order_executor).username
try:
order.order_user = User.objects.get(id=order.order_user).username
except:
order.order_user = '未知'
try:
order.order_executor = User.objects.get(id=order.order_executor).username
except:
order.order_executor = '未知'
#月度更新频率统计
monthList = [ base.getDaysAgo(num)[0:6] for num in (0,30,60,90,120,150,180) ][::-1]
monthDataList = []
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[传送门](http://47.75.140.140:8896)
```
用户:demo 密码:demo
只能演示部分功能,并且每隔两小时重置数据。
正在开发v3.0,demo环境暂时关闭.
```
## QQ交流群
![image](https://github.com/welliamcao/OpsManage/blob/master/demo_imgs/qq_group.png)
Expand Down
12 changes: 11 additions & 1 deletion logs/opsmanage.log
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@

2018-09-18 21:43:39 [WARNING] Session data corrupted
2018-09-18 21:43:39 [WARNING] Session data corrupted
2018-09-18 21:43:45 [WARNING] Session data corrupted
2018-09-18 21:43:51 [WARNING] Session data corrupted
2018-09-28 21:26:23 [WARNING] Session data corrupted
2018-09-28 21:26:23 [WARNING] Session data corrupted
2018-09-28 21:26:34 [WARNING] Session data corrupted
2018-09-28 21:26:40 [WARNING] Session data corrupted
2018-09-28 21:26:45 [WARNING] Session data corrupted
2018-09-28 21:26:50 [WARNING] Session data corrupted
2018-09-28 21:26:55 [WARNING] Session data corrupted