Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
31356e82
Unverified
Commit
31356e82
authored
Dec 11, 2018
by
老广
Committed by
GitHub
Dec 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改运行命令名称 (#2140)
parent
76aadad6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
6 deletions
+20
-6
django.mo
apps/locale/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/locale/zh/LC_MESSAGES/django.po
+1
-1
callback.py
apps/ops/ansible/callback.py
+1
-1
runner.py
apps/ops/ansible/runner.py
+1
-3
command.py
apps/ops/models/command.py
+3
-0
command_execution_list.html
apps/ops/templates/ops/command_execution_list.html
+14
-1
No files found.
apps/locale/zh/LC_MESSAGES/django.mo
View file @
31356e82
No preview for this file type
apps/locale/zh/LC_MESSAGES/django.po
View file @
31356e82
...
...
@@ -2364,7 +2364,7 @@ msgstr "执行历史"
#: ops/templates/ops/adhoc_detail.html:72
#: ops/templates/ops/adhoc_detail.html:77 ops/templates/ops/task_adhoc.html:61
msgid "Run as"
msgstr "用户"
msgstr "
运行
用户"
#: ops/templates/ops/adhoc_detail.html:94 ops/templates/ops/task_list.html:36
msgid "Run times"
...
...
apps/ops/ansible/callback.py
View file @
31356e82
...
...
@@ -159,7 +159,7 @@ class CommandResultCallback(AdHocResultCallback):
def
v2_playbook_on_play_start
(
self
,
play
):
now
=
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
msg
=
'$ {} ({})'
.
format
(
'echo'
,
now
)
msg
=
'$ {} ({})'
.
format
(
play
.
name
,
now
)
self
.
_play
=
play
self
.
_display
.
banner
(
msg
)
...
...
apps/ops/ansible/runner.py
View file @
31356e82
...
...
@@ -250,7 +250,5 @@ class CommandRunner(AdHocRunner):
tasks
=
[
{
"action"
:
{
"module"
:
module
,
"args"
:
cmd
}}
]
hosts
=
self
.
inventory
.
get_hosts
(
pattern
=
pattern
)
name
=
"Run command {} on {}'s hosts"
.
format
(
cmd
,
len
(
hosts
))
return
self
.
run
(
tasks
,
pattern
,
play_name
=
name
)
return
self
.
run
(
tasks
,
pattern
,
play_name
=
cmd
)
apps/ops/models/command.py
View file @
31356e82
...
...
@@ -48,6 +48,9 @@ class CommandExecution(models.Model):
return
False
return
True
def
get_hosts_names
(
self
):
return
','
.
join
(
self
.
hosts
.
all
()
.
values_list
(
'hostname'
,
flat
=
True
))
def
run
(
self
):
print
(
'-'
*
10
+
' '
+
ugettext
(
'Task start'
)
+
' '
+
'-'
*
10
)
self
.
date_start
=
timezone
.
now
()
...
...
apps/ops/templates/ops/command_execution_list.html
View file @
31356e82
...
...
@@ -44,6 +44,7 @@
<th
class=
"text-center"
>
{% trans 'Hosts' %}
</th>
<th
class=
"text-center"
>
{% trans 'User' %}
</th>
<th
class=
"text-center"
>
{% trans 'Command' %}
</th>
<th
class=
"text-center"
>
{% trans 'Run as' %}
</th>
<th
class=
"text-center"
>
{% trans 'Output' %}
</th>
<th
class=
"text-center"
>
{% trans 'Finished' %}
</th>
<th
class=
"text-center"
>
{% trans 'Success' %}
</th>
...
...
@@ -55,9 +56,10 @@
{% for object in object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
><input
type=
"checkbox"
class=
"cbx-term"
></td>
<td
class=
"text-center
"
>
{{ object.hosts.count
}}
</td>
<td
class=
"text-center
hosts"
>
{{ object.get_hosts_names
}}
</td>
<td
class=
"text-center"
>
{{ object.user }}
</td>
<td
class=
"text-center"
>
{{ object.command| truncatechars:16 }}
</td>
<td
class=
"text-center"
>
{{ object.run_as }}
</td>
<td
class=
"text-center"
><a
href=
"{% url "
ops:celery-task-log
"
pk=
object.id
%}"
target=
"_blank"
>
查看
</a></td>
<td
class=
"text-center"
>
{{ object.is_finished | state_show | safe }}
</td>
<td
class=
"text-center"
>
{{ object.is_success | state_show | safe }}
</td>
...
...
@@ -89,6 +91,17 @@ $(document).ready(function() {
calendarWeeks
:
true
,
autoclose
:
true
});
$
(
".hosts"
).
each
(
function
(
i
)
{
var
data
=
$
(
this
).
text
();
var
data_list
=
data
.
split
(
","
);
if
(
data_list
.
length
===
1
&&
data_list
[
0
]
===
""
)
{
data_list
.
pop
();
}
var
html
=
createPopover
(
data_list
);
$
(
this
).
html
(
html
);
});
$
(
'[data-toggle="popover"]'
).
popover
();
})
</script>
{% endblock %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment