Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Xiaowu Zhang
slapos.core
Commits
f0bb2209
Commit
f0bb2209
authored
Nov 01, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement "slapos supply" + "slapos remove"
parent
72000fa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
2 deletions
+79
-2
documentation/slapos.usage.rst
documentation/slapos.usage.rst
+0
-1
slapos/client.py
slapos/client.py
+74
-0
slapos/entry.py
slapos/entry.py
+5
-1
No files found.
documentation/slapos.usage.rst
View file @
f0bb2209
...
@@ -72,7 +72,6 @@ Examples:
...
@@ -72,7 +72,6 @@ Examples:
slapos remove
slapos remove
~~~~~~~~~~~~~
~~~~~~~~~~~~~
Note: Not yet implemented.
Usage:
Usage:
slapos remove <software | software_group> <computer_guid | commputer_group>
slapos remove <software | software_group> <computer_guid | commputer_group>
...
...
slapos/client.py
View file @
f0bb2209
...
@@ -221,6 +221,80 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0]
...
@@ -221,6 +221,80 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0]
"couple of minutes to get connection informations"
)
"couple of minutes to get connection informations"
)
exit
(
2
)
exit
(
2
)
def
_supply
(
software_url
,
computer_id
,
local
,
remove
=
False
):
"""
Request installation of Software Release
'software_url' on computer 'computer_id'.
if destroy argument is True, request deletion of Software Release.
"""
# XXX-Cedric Implement software_group support
# XXX-Cedric Implement computer_group support
if
not
remove
:
state
=
'available'
print
'Requesting installation of %s Software Release...'
%
software_url
else
:
state
=
'destroyed'
print
'Requesting deletion of %s Software Release...'
%
software_url
if
software_url
in
local
:
software_url
=
local
[
software_url
]
local
[
'slap'
].
slap
.
registerSupply
().
supply
(
software_release
=
software_url
,
computer_guid
=
computer_id
,
state
=
state
,
)
print
'Done.'
def
supply
():
"""
Ran when invoking slapos supply.
"""
# XXX-Cedric: move argument parsing to main entry point
config
=
Config
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"configuration_file"
,
nargs
=
1
,
help
=
"SlapOS configuration file"
)
parser
.
add_argument
(
"software_url"
,
help
=
"Your software url"
)
parser
.
add_argument
(
"node"
,
help
=
"Target node"
)
args
=
parser
.
parse_args
()
# Convert to dict
if
args
.
configuration
is
not
None
:
args
.
configuration
=
argToDict
(
args
.
configuration
)
if
args
.
node
is
not
None
:
args
.
node
=
argToDict
(
args
.
node
)
config
.
setConfig
(
args
,
args
.
configuration_file
)
_supply
(
args
.
software_url
,
args
.
node
,
init
(
args
))
def
remove
():
"""
Ran when invoking slapos remove.
"""
# XXX-Cedric: move argument parsing to main entry point
config
=
Config
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"configuration_file"
,
nargs
=
1
,
help
=
"SlapOS configuration file."
)
parser
.
add_argument
(
"software_url"
,
help
=
"Your software url"
)
parser
.
add_argument
(
"node"
,
help
=
"Target node"
)
args
=
parser
.
parse_args
()
# Convert to dict
if
args
.
configuration
is
not
None
:
args
.
configuration
=
argToDict
(
args
.
configuration
)
if
args
.
node
is
not
None
:
args
.
node
=
argToDict
(
args
.
node
)
config
.
setConfig
(
args
,
args
.
configuration_file
)
_supply
(
args
.
software_url
,
args
.
node
,
init
(
args
),
remove
=
True
)
def
slapconsole
():
def
slapconsole
():
"""Ran when invoking slapconsole"""
"""Ran when invoking slapconsole"""
# Parse arguments
# Parse arguments
...
...
slapos/entry.py
View file @
f0bb2209
...
@@ -33,6 +33,8 @@ import sys
...
@@ -33,6 +33,8 @@ import sys
from
slapos.bang
import
main
as
bang
from
slapos.bang
import
main
as
bang
from
slapos.client
import
slapconsole
as
console
from
slapos.client
import
slapconsole
as
console
from
slapos.client
import
request
as
request
from
slapos.client
import
request
as
request
from
slapos.client
import
remove
as
remove
from
slapos.client
import
supply
as
supply
from
slapos.format
import
main
as
format
from
slapos.format
import
main
as
format
from
slapos.grid.slapgrid
import
runComputerPartition
as
instance
from
slapos.grid.slapgrid
import
runComputerPartition
as
instance
from
slapos.grid.slapgrid
import
runSoftwareRelease
as
software
from
slapos.grid.slapgrid
import
runSoftwareRelease
as
software
...
@@ -139,7 +141,9 @@ def dispatch(command, is_node_command):
...
@@ -139,7 +141,9 @@ def dispatch(command, is_node_command):
elif
command
==
'request'
:
elif
command
==
'request'
:
call
(
request
,
config
=
USER_SLAPOS_CONFIGURATION
)
call
(
request
,
config
=
USER_SLAPOS_CONFIGURATION
)
elif
command
==
'supply'
:
elif
command
==
'supply'
:
raise
EntryPointNotImplementedError
(
command
)
call
(
supply
,
config
=
USER_SLAPOS_CONFIGURATION
)
elif
command
==
'remove'
:
call
(
remove
,
config
=
USER_SLAPOS_CONFIGURATION
)
elif
command
==
'start'
:
elif
command
==
'start'
:
raise
EntryPointNotImplementedError
(
command
)
raise
EntryPointNotImplementedError
(
command
)
elif
command
==
'stop'
:
elif
command
==
'stop'
:
...
...
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