Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Thomas Leymonerie
slapos.toolbox
Commits
118cb3e0
Commit
118cb3e0
authored
Apr 23, 2012
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite log format.
parent
37e370a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
slapos/agent/agent.py
slapos/agent/agent.py
+5
-9
No files found.
slapos/agent/agent.py
View file @
118cb3e0
import
ConfigParser
import
argparse
import
ConfigParser
,
argparse
import
json
from
random
import
random
,
choice
import
os
import
socket
import
time
import
os
,
socket
,
time
from
datetime
import
datetime
from
datetime
import
timedelta
import
xmlrpclib
...
...
@@ -52,7 +49,7 @@ class Agent:
self
.
log_directory
=
configuration
.
get
(
"agent"
,
"log_directory"
)
self
.
state_file
=
configuration
.
get
(
"agent"
,
"state_file"
)
filename
=
os
.
path
.
join
(
self
.
log_directory
,
"agent-%s.log"
%
datetime
.
strftime
(
datetime
.
now
(),
"%Y
-%m-
%d"
))
filename
=
os
.
path
.
join
(
self
.
log_directory
,
"agent-%s.log"
%
datetime
.
strftime
(
datetime
.
now
(),
"%Y
%m
%d"
))
basicConfig
(
filename
=
filename
,
format
=
"%(asctime)-15s %(message)s"
,
level
=
"INFO"
)
self
.
logger
=
getLogger
()
...
...
@@ -91,18 +88,18 @@ class Agent:
return
safeRpcCall
(
portal
,
"Agent_getSoftwareReleaseUsageOnComputer"
,
computer
,
software
)
def
requestSoftwareReleaseCleanupOnComputer
(
self
,
computer
,
software
):
self
.
logger
.
info
(
"Request to cleanup %s on %s."
%
(
software
,
computer
))
try
:
self
.
supply
.
supply
(
self
.
software_uri
[
software
],
computer
,
"destroyed"
)
self
.
logger
.
info
(
"Successfully requested to cleanup %s on %s."
%
(
software
,
computer
))
return
True
except
:
self
.
logger
.
info
(
"Failed to request to cleanup %s on %s."
%
(
software
,
computer
))
return
False
def
requestSoftwareReleaseInstallationOnComputer
(
self
,
computer
,
software
):
self
.
logger
.
info
(
"Request to install %s on %s."
%
(
software
,
computer
))
try
:
self
.
supply
.
supply
(
self
.
software_uri
[
software
],
computer
,
"available"
)
self
.
logger
.
info
(
"Successfully requested to install %s on %s."
%
(
software
,
computer
))
return
True
except
:
self
.
logger
.
info
(
"Failed to request to install %s on %s."
%
(
software
,
computer
))
...
...
@@ -116,7 +113,6 @@ class Agent:
json
.
dumps
(
_encode_software_dict
(
self
.
installing_software_dict
[
computer
])))
state
.
set
(
computer
,
"installed_software"
,
\
json
.
dumps
(
_encode_software_dict
(
self
.
installed_software_dict
[
computer
])))
dirname
=
os
.
path
.
dirname
(
__file__
)
state
.
write
(
open
(
self
.
state_file
,
"w"
))
def
main
(
*
args
):
...
...
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