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
Klaus Wölfel
slapos.toolbox
Commits
b6a45c0f
Commit
b6a45c0f
authored
Jun 21, 2012
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scripts to operate software instance status.
parent
8e68c8f6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
slapos/agent/agent.py
slapos/agent/agent.py
+42
-0
No files found.
slapos/agent/agent.py
View file @
b6a45c0f
...
...
@@ -104,6 +104,48 @@ class Agent:
self
.
logger
.
info
(
"Failed to request to install %s on %s."
%
(
software
,
computer
))
return
False
def
requestSoftwareInstanceStartedOnComputer
(
self
,
reference
,
computer
,
software
):
try
:
self
.
slap
.
registerOpenOrder
().
request
(
software_release
=
software
,
partition_reference
=
reference
,
filter_kw
=
{
'computer_guid'
:
computer
},
state
=
'started'
)
self
.
logger
.
info
(
"Successfully requested to start a instance of %s on %s."
,
(
software
,
computer
))
return
True
except
:
self
.
logger
.
info
(
"Failed to request to start a instance of %s on %s."
,
(
software
,
computer
))
return
False
def
requestSoftwareInstanceStoppedOnComputer
(
self
,
reference
,
computer
,
software
):
try
:
self
.
slap
.
registerOpenOrder
().
request
(
software_release
=
software
,
partition_reference
=
reference
,
filter_kw
=
{
'computer_guid'
:
computer
},
state
=
'stopped'
)
self
.
logger
.
info
(
"Successfully requested to stop a instance of %s on %s."
,
(
software
,
computer
))
return
True
except
:
self
.
logger
.
info
(
"Failed to request to stop a instance of %s on %s."
,
(
software
,
computer
))
return
False
def
requestSoftwareInstanceDestroyedOnComputer
(
self
,
reference
,
computer
,
software
):
try
:
self
.
slap
.
registerOpenOrder
().
request
(
software_release
=
software
,
partition_reference
=
reference
,
filter_kw
=
{
'computer_guid'
:
computer
},
state
=
'destroyed'
)
self
.
logger
.
info
(
"Successfully requested to destroy a instance of %s on %s."
,
(
software
,
computer
))
return
True
except
:
self
.
logger
.
info
(
"Failed to request to destroy a instance of %s on %s."
,
(
software
,
computer
))
return
False
def
writeState
(
self
):
state
=
ConfigParser
.
SafeConfigParser
()
for
computer
in
self
.
computer_list
:
...
...
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