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
cd9000e7
Commit
cd9000e7
authored
Mar 07, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改Node value唯一
parent
af2db2d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
node.py
apps/assets/models/node.py
+1
-1
tasks.py
apps/assets/tasks.py
+9
-5
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+8
-8
No files found.
apps/assets/models/node.py
View file @
cd9000e7
...
...
@@ -12,7 +12,7 @@ __all__ = ['Node']
class
Node
(
models
.
Model
):
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
key
=
models
.
CharField
(
unique
=
True
,
max_length
=
64
,
verbose_name
=
_
(
"Key"
))
# '1:1:1:1'
value
=
models
.
CharField
(
max_length
=
128
,
unique
=
True
,
verbose_name
=
_
(
"Value"
))
value
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
_
(
"Value"
))
child_mark
=
models
.
IntegerField
(
default
=
0
)
date_create
=
models
.
DateTimeField
(
auto_now_add
=
True
)
...
...
apps/assets/tasks.py
View file @
cd9000e7
...
...
@@ -91,7 +91,7 @@ def update_assets_hardware_info_util(assets, task_name=None):
if
task_name
is
None
:
task_name
=
_
(
"Update some assets hardware info"
)
tasks
=
const
.
UPDATE_ASSETS_HARDWARE_TASKS
hostname_list
=
[
asset
.
hostname
for
asset
in
assets
]
hostname_list
=
[
asset
.
hostname
for
asset
in
assets
if
asset
.
is_active
and
asset
.
is_unixlike
()
]
task
,
created
=
update_or_create_ansible_task
(
task_name
,
hosts
=
hostname_list
,
tasks
=
tasks
,
pattern
=
'all'
,
options
=
const
.
TASK_OPTIONS
,
run_as_admin
=
True
,
created_by
=
'System'
,
...
...
@@ -120,7 +120,10 @@ def update_assets_hardware_info_period():
"""
from
ops.utils
import
update_or_create_ansible_task
task_name
=
_
(
"Update assets hardware info period"
)
hostname_list
=
[
asset
.
hostname
for
asset
in
Asset
.
objects
.
all
()]
hostname_list
=
[
asset
.
hostname
for
asset
in
Asset
.
objects
.
all
()
if
asset
.
is_active
and
asset
.
is_unixlike
()
]
tasks
=
const
.
UPDATE_ASSETS_HARDWARE_TASKS
# Only create, schedule by celery beat
...
...
@@ -165,7 +168,8 @@ def test_admin_user_connectability_util(admin_user, task_name):
from
ops.utils
import
update_or_create_ansible_task
assets
=
admin_user
.
get_related_assets
()
hosts
=
[
asset
.
hostname
for
asset
in
assets
]
hosts
=
[
asset
.
hostname
for
asset
in
assets
if
asset
.
is_active
and
asset
.
is_unixlike
()]
if
not
hosts
:
return
tasks
=
const
.
TEST_ADMIN_USER_CONN_TASKS
...
...
@@ -257,7 +261,7 @@ def test_system_user_connectability_util(system_user, task_name):
"""
from
ops.utils
import
update_or_create_ansible_task
assets
=
system_user
.
assets
hosts
=
[
asset
.
hostname
for
asset
in
assets
]
hosts
=
[
asset
.
hostname
for
asset
in
assets
if
asset
.
is_active
and
asset
.
is_unixlike
()
]
tasks
=
const
.
TEST_SYSTEM_USER_CONN_TASKS
if
not
hosts
:
logger
.
info
(
"No hosts, passed"
)
...
...
@@ -346,7 +350,7 @@ def push_system_user_util(system_users, assets, task_name):
logger
.
info
(
"Not tasks, passed"
)
return
{}
hosts
=
[
asset
.
hostname
for
asset
in
assets
]
hosts
=
[
asset
.
hostname
for
asset
in
assets
if
asset
.
is_active
and
asset
.
is_unixlike
()
]
if
not
hosts
:
logger
.
info
(
"Not hosts, passed"
)
return
{}
...
...
apps/i18n/zh/LC_MESSAGES/django.po
View file @
cd9000e7
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-07 11:
27
+0800\n"
"POT-Creation-Date: 2018-03-07 11:
54
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -434,31 +434,31 @@ msgstr "更新资产硬件信息"
msgid "Update assets hardware info period"
msgstr "定期更新资产硬件信息"
#: assets/tasks.py:19
1
#: assets/tasks.py:19
5
msgid "Test admin user connectability period: {}"
msgstr "定期测试管理用户可连接性: {}"
#: assets/tasks.py:
197
#: assets/tasks.py:
201
msgid "Test admin user connectability: {}"
msgstr "测试管理用户可连接性: {}"
#: assets/tasks.py:2
06
#: assets/tasks.py:2
10
msgid "Test asset connectability"
msgstr "测试资产可连接性"
#: assets/tasks.py:2
77
#: assets/tasks.py:2
81
msgid "Test system user connectability: {}"
msgstr "测试系统用户可连接性: {}"
#: assets/tasks.py:2
88
#: assets/tasks.py:2
92
msgid "test system user connectability period: {}"
msgstr "测试系统用户可连接性: {}"
#: assets/tasks.py:36
1
#: assets/tasks.py:36
5
msgid "Push system user to node: {} => {}"
msgstr "推送系统用户到节点: {}->{}"
#: assets/tasks.py:39
3
#: assets/tasks.py:39
7
msgid "Push system users to node: {}"
msgstr "推送系统用户到节点: {}"
...
...
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