Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
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
coco
Commits
7b530dee
Commit
7b530dee
authored
Nov 05, 2017
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start remove sdk
parent
258dbeef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
76 deletions
+0
-76
auth.py
coco/auth.py
+0
-1
models.py
coco/models.py
+0
-75
No files found.
coco/auth.py
View file @
7b530dee
...
...
@@ -4,7 +4,6 @@
import
os
import
logging
import
time
from
.
import
utils
from
.exception
import
LoadAccessKeyError
...
...
coco/models.py
View file @
7b530dee
...
...
@@ -8,81 +8,6 @@ from . import utils
BUF_SIZE
=
4096
class
Decoder
:
@classmethod
def
from_json
(
cls
,
json_dict
):
self
=
cls
()
for
k
,
v
in
json_dict
.
items
():
if
isinstance
(
getattr
(
self
,
k
,
None
),
datetime
.
datetime
):
v
=
datetime
.
datetime
.
strptime
(
v
,
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
setattr
(
self
,
k
,
v
)
return
self
@classmethod
def
from_multi_json
(
cls
,
json_dict_list
):
return
[
cls
.
from_json
(
json_dict
)
for
json_dict
in
json_dict_list
]
class
User
(
Decoder
):
id
=
0
username
=
""
name
=
""
email
=
""
is_active
=
False
is_superuser
=
False
role
=
"User"
groups
=
[]
wechat
=
""
phone
=
""
comment
=
""
date_expired
=
datetime
.
datetime
.
now
()
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
class
Asset
(
Decoder
):
id
=
0
hostname
=
""
ip
=
""
port
=
22
system_users_granted
=
[]
is_active
=
False
system_users_join
=
""
@classmethod
def
from_json
(
cls
,
json_dict
):
system_users_granted
=
SystemUser
.
from_multi_json
(
json_dict
[
"system_users_granted"
])
json_dict
[
"system_users_granted"
]
=
system_users_granted
return
super
()
.
from_json
(
json_dict
)
def
__str__
(
self
):
return
self
.
hostname
def
__repr__
(
self
):
return
self
.
hostname
class
SystemUser
(
Decoder
):
id
=
0
name
=
""
username
=
""
protocol
=
"ssh"
auth_method
=
"P"
comment
=
""
password
=
""
private_key
=
None
def
__str__
(
self
):
return
self
.
name
def
__repr__
(
self
):
return
self
.
name
class
Request
:
def
__init__
(
self
,
addr
):
self
.
type
=
""
...
...
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