Skip to content

Commit

Permalink
1.修复运行模块选择ping之后自定义模块无法隐藏的bug
Browse files Browse the repository at this point in the history
2.优化上传脚本,剧本需要手动创建目录,改为自动判断
  • Loading branch information
welliamcao committed Dec 21, 2017
1 parent ef88239 commit 20dbaed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions OpsManage/templates/apps/apps_model.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ <h1 class="page-header"><i class="fa fa-gears"></i><code>Ansible</code>模块管
document.getElementById("custom_model").style.display = "";
document.getElementById("ansible_args").value="";
}
else if(value=="ping"){
document.getElementById("custom_model").style.display = "none";
document.getElementById("ansible_args").value="";
}
else {
document.getElementById("ansible_args").value="";
}
Expand Down
3 changes: 3 additions & 0 deletions OpsManage/views/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def apps_online(request):
fileName = '/upload/playbook/online-{ram}.yaml'.format(ram=uuid.uuid4().hex[0:8])
filePath = os.getcwd() + fileName
if request.POST.get('playbook_content'):
if os.path.isdir(os.path.dirname(filePath)) is not True:os.makedirs(os.path.dirname(filePath))#判断文件存放的目录是否存在,不存在就创建
with open(filePath, 'w') as f:
f.write(request.POST.get('playbook_content'))
else:
Expand Down Expand Up @@ -508,6 +509,7 @@ def apps_script_online(request):
resource = []
sList = []
def saveScript(content,filePath):
if os.path.isdir(os.path.dirname(filePath)) is not True:os.makedirs(os.path.dirname(filePath))#判断文件存放的目录是否存在,不存在就创建
with open(filePath, 'w') as f:
f.write(content)
return filePath
Expand Down Expand Up @@ -622,6 +624,7 @@ def apps_script_online_run(request,pid):
"errorInfo":"剧本不存在,可能已经被删除."},
)
def saveScript(content,filePath):
if os.path.isdir(os.path.dirname(filePath)) is not True:os.makedirs(os.path.dirname(filePath))#判断文件存放的目录是否存在,不存在就创建
with open(filePath, 'w') as f:
f.write(content)
return filePath
Expand Down

0 comments on commit 20dbaed

Please sign in to comment.