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
49d89ad7
Unverified
Commit
49d89ad7
authored
Jan 25, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
ad7c59ea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
models.py
coco/models.py
+1
-0
recorder.py
coco/recorder.py
+8
-9
requirements.txt
requirements/requirements.txt
+2
-0
No files found.
coco/models.py
View file @
49d89ad7
...
@@ -225,4 +225,5 @@ class WSProxy:
...
@@ -225,4 +225,5 @@ class WSProxy:
def
close
(
self
):
def
close
(
self
):
self
.
stop_event
.
set
()
self
.
stop_event
.
set
()
self
.
child
.
close
()
self
.
child
.
close
()
self
.
ws
.
on_logout
(
self
.
connection
)
logger
.
debug
(
"Proxy {} closed"
.
format
(
self
))
logger
.
debug
(
"Proxy {} closed"
.
format
(
self
))
coco/recorder.py
View file @
49d89ad7
...
@@ -9,7 +9,7 @@ import os
...
@@ -9,7 +9,7 @@ import os
import
gzip
import
gzip
import
json
import
json
import
shutil
import
shutil
#
import boto3 # AWS S3 sdk
import
boto3
# AWS S3 sdk
from
jms_es_sdk
import
ESStore
from
jms_es_sdk
import
ESStore
...
@@ -242,16 +242,15 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
...
@@ -242,16 +242,15 @@ class ESCommandRecorder(CommandRecorder, metaclass=Singleton):
class
S3ReplayRecorder
(
ReplayRecorder
):
class
S3ReplayRecorder
(
ReplayRecorder
):
def
__init__
(
self
,
app
):
def
__init__
(
self
,
app
):
super
()
.
__init__
(
app
)
super
()
.
__init__
(
app
)
self
.
aws_id
=
app
.
config
[
"REPLAY_RECORD_ENGINE"
]
.
get
(
"KEY_ID"
,
None
)
self
.
aws_key
=
app
.
config
[
"REPLAY_RECORD_ENGINE"
]
.
get
(
"KEY"
,
None
)
self
.
s3
=
boto3
.
client
(
's3'
,
aws_access_key_id
=
self
.
aws_id
,
aws_secret_access_key
=
self
.
aws_key
)
self
.
bucket
=
app
.
config
[
"REPLAY_RECORD_ENGINE"
]
.
get
(
"BUCKET"
,
"jumpserver"
)
self
.
bucket
=
app
.
config
[
"REPLAY_RECORD_ENGINE"
]
.
get
(
"BUCKET"
,
"jumpserver"
)
self
.
s3
=
boto3
.
client
(
's3'
)
# def push_to_server(self, session_id):
def
push_to_server
(
self
,
session_id
):
# self.s3.upload_file(
self
.
s3
.
upload_file
(
# os.path.join(self.app.config['LOG_DIR'], session_id + '.replay.gz'),
os
.
path
.
join
(
self
.
app
.
config
[
'LOG_DIR'
],
session_id
+
'.replay.gz'
),
# self.bucket, self.aws_key) # TODO: 添加日期文件夹及协调一些事宜<liuzheng>
self
.
bucket
,
time
.
strftime
(
'
%
Y-
%
m-
%
d'
,
time
.
localtime
(
self
.
starttime
))
+
'/'
+
session_id
+
'.replay.gz'
)
def
get_command_recorder_class
(
config
):
def
get_command_recorder_class
(
config
):
...
...
requirements/requirements.txt
View file @
49d89ad7
asn1crypto==0.23.0
asn1crypto==0.23.0
bcrypt==3.1.4
bcrypt==3.1.4
boto3==1.5.18
botocore==1.8.32
certifi==2017.11.5
certifi==2017.11.5
cffi==1.11.2
cffi==1.11.2
chardet==3.0.4
chardet==3.0.4
...
...
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