Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-RAN
Commits
de6d928d
Commit
de6d928d
authored
Jul 27, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix remote access for LogRotation method
parent
65aa1305
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
ci-scripts/cls_log_mgt.py
ci-scripts/cls_log_mgt.py
+7
-6
ci-scripts/cls_module_ue.py
ci-scripts/cls_module_ue.py
+1
-1
No files found.
ci-scripts/cls_log_mgt.py
View file @
de6d928d
...
...
@@ -25,7 +25,7 @@
#---------------------------------------------------------------------
#USAGE:
# log=Log_Mgt(IPAddress,Password,Path)
# log=Log_Mgt(
Username,
IPAddress,Password,Path)
# log.LogRotation()
...
...
@@ -38,7 +38,8 @@ import math
class
Log_Mgt
:
def
__init__
(
self
,
IPAddress
,
Password
,
Path
):
def
__init__
(
self
,
Username
,
IPAddress
,
Password
,
Path
):
self
.
Username
=
Username
self
.
IPAddress
=
IPAddress
self
.
Password
=
Password
self
.
path
=
Path
...
...
@@ -49,7 +50,7 @@ class Log_Mgt:
def
__CheckAvailSpace
(
self
):
HOST
=
self
.
IPAddress
HOST
=
self
.
Username
+
'@'
+
self
.
IPAddress
COMMAND
=
"df "
+
self
.
path
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
result
=
ssh
.
stdout
.
readlines
()
...
...
@@ -58,7 +59,7 @@ class Log_Mgt:
return
tmp
[
3
]
#return avail space from the line
def
__GetOldestFile
(
self
):
HOST
=
self
.
IPAddress
HOST
=
self
.
Username
+
'@'
+
self
.
IPAddress
COMMAND
=
"ls -rtl "
+
self
.
path
#-rtl will bring oldest file on top
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
result
=
ssh
.
stdout
.
readlines
()
...
...
@@ -68,7 +69,7 @@ class Log_Mgt:
def
__AvgSize
(
self
):
HOST
=
self
.
IPAddress
HOST
=
self
.
Username
+
'@'
+
self
.
IPAddress
COMMAND
=
"ls -rtl "
+
self
.
path
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
result
=
ssh
.
stdout
.
readlines
()
...
...
@@ -94,7 +95,7 @@ class Log_Mgt:
logging
.
debug
(
"Avail Space : "
+
str
(
avail_space
)
+
" / Artifact Avg Size : "
+
str
(
avg_size
))
if
avail_space
<
2
*
avg_size
:
#reserved space is 2x artifact file ; oldest file will be deleted
oldestfile
=
self
.
__GetOldestFile
()
HOST
=
self
.
IPAddress
HOST
=
self
.
Username
+
'@'
+
self
.
IPAddress
COMMAND
=
"echo "
+
self
.
Password
+
" | sudo -S rm "
+
self
.
path
+
"/"
+
oldestfile
logging
.
debug
(
COMMAND
)
ssh
=
subprocess
.
Popen
([
"ssh"
,
"%s"
%
HOST
,
COMMAND
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
...
...
ci-scripts/cls_module_ue.py
View file @
de6d928d
...
...
@@ -168,7 +168,7 @@ class Module_UE:
mySSH
.
command
(
'echo $USER; echo '
+
self
.
HostPassword
+
' | nohup sudo -S zip -r '
+
destination
+
' '
+
source
+
' &'
,
'\$'
,
10
)
mySSH
.
close
()
#post action : log cleaning to make sure enough space is reserved for the next run
Log_Mgt
=
cls_log_mgt
.
Log_Mgt
(
self
.
HostIPAddress
,
self
.
HostPassword
,
self
.
LogStore
)
Log_Mgt
=
cls_log_mgt
.
Log_Mgt
(
self
.
Host
Username
,
self
.
Host
IPAddress
,
self
.
HostPassword
,
self
.
LogStore
)
Log_Mgt
.
LogRotation
()
else
:
destination
=
""
...
...
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