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
3f72ce4b
Commit
3f72ce4b
authored
Mar 22, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 更新生成fake数据脚本
parent
5613dbb2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
idc.py
apps/assets/models/idc.py
+1
-1
user.py
apps/assets/models/user.py
+2
-2
fake.json
apps/fixtures/fake.json
+0
-0
utils.py
apps/ops/utils.py
+10
-0
No files found.
apps/assets/models/idc.py
View file @
3f72ce4b
...
@@ -45,7 +45,7 @@ class IDC(models.Model):
...
@@ -45,7 +45,7 @@ class IDC(models.Model):
ordering
=
[
'name'
]
ordering
=
[
'name'
]
@classmethod
@classmethod
def
generate_fake
(
cls
,
count
=
100
):
def
generate_fake
(
cls
,
count
=
5
):
from
random
import
seed
,
choice
from
random
import
seed
,
choice
import
forgery_py
import
forgery_py
from
django.db
import
IntegrityError
from
django.db
import
IntegrityError
...
...
apps/assets/models/user.py
View file @
3f72ce4b
...
@@ -90,7 +90,7 @@ class AdminUser(models.Model):
...
@@ -90,7 +90,7 @@ class AdminUser(models.Model):
ordering
=
[
'name'
]
ordering
=
[
'name'
]
@classmethod
@classmethod
def
generate_fake
(
cls
,
count
=
10
0
):
def
generate_fake
(
cls
,
count
=
10
):
from
random
import
seed
from
random
import
seed
import
forgery_py
import
forgery_py
from
django.db
import
IntegrityError
from
django.db
import
IntegrityError
...
@@ -222,7 +222,7 @@ class SystemUser(models.Model):
...
@@ -222,7 +222,7 @@ class SystemUser(models.Model):
ordering
=
[
'name'
]
ordering
=
[
'name'
]
@classmethod
@classmethod
def
generate_fake
(
cls
,
count
=
10
0
):
def
generate_fake
(
cls
,
count
=
10
):
from
random
import
seed
from
random
import
seed
import
forgery_py
import
forgery_py
from
django.db
import
IntegrityError
from
django.db
import
IntegrityError
...
...
apps/fixtures/fake.json
View file @
3f72ce4b
This diff is collapsed.
Click to expand it.
apps/ops/utils.py
View file @
3f72ce4b
...
@@ -19,6 +19,16 @@ def run_AdHoc(task_tuple, assets,
...
@@ -19,6 +19,16 @@ def run_AdHoc(task_tuple, assets,
task_name
=
'Ansible AdHoc runner'
,
task_name
=
'Ansible AdHoc runner'
,
task_id
=
None
,
pattern
=
'all'
,
task_id
=
None
,
pattern
=
'all'
,
record
=
True
,
verbose
=
False
):
record
=
True
,
verbose
=
False
):
"""
:param task_tuple: (('module_name', 'module_args'), ('module_name', 'module_args'))
:param assets: [asset1, asset2]
:param task_name:
:param task_id:
:param pattern:
:param record:
:param verbose:
:return:
"""
if
not
assets
:
if
not
assets
:
logger
.
warning
(
'Empty assets, runner cancel'
)
logger
.
warning
(
'Empty assets, runner cancel'
)
...
...
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