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
Gabriel Monnerat
slapos.core
Commits
b7bf0cc5
Commit
b7bf0cc5
authored
May 02, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better docstrings, support for --only in addition to --only-sr or --only-cp
parent
92ea5d27
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
18 deletions
+35
-18
slapos/cli/cache.py
slapos/cli/cache.py
+9
-1
slapos/cli/console.py
slapos/cli/console.py
+4
-3
slapos/cli/entry.py
slapos/cli/entry.py
+1
-2
slapos/cli/slapgrid.py
slapos/cli/slapgrid.py
+20
-10
slapos/register/register.py
slapos/register/register.py
+0
-1
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+1
-1
No files found.
slapos/cli/cache.py
View file @
b7bf0cc5
...
@@ -7,12 +7,20 @@ from slapos.cache import do_lookup
...
@@ -7,12 +7,20 @@ from slapos.cache import do_lookup
class
CacheLookupCommand
(
ConfigCommand
):
class
CacheLookupCommand
(
ConfigCommand
):
"""
Perform a query to the networkcache.
You can provide either a complete URL to the software release,
or a corresponding MD5 hash value.
The command will report which OS distribution/version have a binary
cache of the software release, and which ones are compatible
with the OS you are currently running.
"""
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
def
get_parser
(
self
,
prog_name
):
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
CacheLookupCommand
,
self
).
get_parser
(
prog_name
)
ap
=
super
(
CacheLookupCommand
,
self
).
get_parser
(
prog_name
)
# XXX this argument could use a better name
ap
.
add_argument
(
'software_url'
,
ap
.
add_argument
(
'software_url'
,
help
=
'Your software url or MD5 hash'
)
help
=
'Your software url or MD5 hash'
)
return
ap
return
ap
...
...
slapos/cli/console.py
View file @
b7bf0cc5
...
@@ -8,8 +8,10 @@ from slapos.client import init, do_console, ClientConfig
...
@@ -8,8 +8,10 @@ from slapos.client import init, do_console, ClientConfig
class
ConsoleCommand
(
ClientConfigCommand
):
class
ConsoleCommand
(
ClientConfigCommand
):
"""
"""
slapconsole allows you interact with slap API. You can play with the global
Python prompt to interact with slap API.
"slap" object and with the global "request" method.
You can play with the global "slap" object and
with the global "request" method.
examples :
examples :
>>> # Request instance
>>> # Request instance
...
@@ -19,7 +21,6 @@ class ConsoleCommand(ClientConfigCommand):
...
@@ -19,7 +21,6 @@ class ConsoleCommand(ClientConfigCommand):
>>> # Fetch instance informations on already launched instance
>>> # Fetch instance informations on already launched instance
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")
"""
"""
# XXX TODO: docstring is printed without newlines
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
...
slapos/cli/entry.py
View file @
b7bf0cc5
...
@@ -16,8 +16,7 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
...
@@ -16,8 +16,7 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
"""Given an argument list, find a command and
"""Given an argument list, find a command and
return the processor and any remaining arguments.
return the processor and any remaining arguments.
"""
"""
# XXX a little cheating, 'slapos node' is not documented
# a little cheating, 'slapos node' is not documented by the help command
# by the help command
if
argv
==
[
'node'
]:
if
argv
==
[
'node'
]:
argv
=
[
'node'
,
'status'
]
argv
=
[
'node'
,
'status'
]
...
...
slapos/cli/slapgrid.py
View file @
b7bf0cc5
...
@@ -22,7 +22,7 @@ class SlapgridCommand(ConfigCommand):
...
@@ -22,7 +22,7 @@ class SlapgridCommand(ConfigCommand):
def
get_parser
(
self
,
prog_name
):
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
SlapgridCommand
,
self
).
get_parser
(
prog_name
)
ap
=
super
(
SlapgridCommand
,
self
).
get_parser
(
prog_name
)
# XXX TODO separate parsers for instance, software and report
# XXX TODO separate parsers for instance, software and report
?
ap
.
add_argument
(
'--instance-root'
,
ap
.
add_argument
(
'--instance-root'
,
help
=
'The instance root directory location.'
)
help
=
'The instance root directory location.'
)
...
@@ -39,7 +39,9 @@ class SlapgridCommand(ConfigCommand):
...
@@ -39,7 +39,9 @@ class SlapgridCommand(ConfigCommand):
ap
.
add_argument
(
'--buildout'
,
default
=
None
,
ap
.
add_argument
(
'--buildout'
,
default
=
None
,
help
=
'Location of buildout binary.'
)
help
=
'Location of buildout binary.'
)
ap
.
add_argument
(
'--pidfile'
,
ap
.
add_argument
(
'--pidfile'
,
help
=
'The location where pidfile will be created.'
)
help
=
'The location where pidfile will be created. '
'Can be provided by configuration file, or defaults '
'to %s'
%
self
.
default_pidfile
)
ap
.
add_argument
(
'--key_file'
,
ap
.
add_argument
(
'--key_file'
,
help
=
'SSL Authorisation key file.'
)
help
=
'SSL Authorisation key file.'
)
ap
.
add_argument
(
'--cert_file'
,
ap
.
add_argument
(
'--cert_file'
,
...
@@ -59,14 +61,6 @@ class SlapgridCommand(ConfigCommand):
...
@@ -59,14 +61,6 @@ class SlapgridCommand(ConfigCommand):
ap
.
add_argument
(
'--all'
,
action
=
'store_true'
,
ap
.
add_argument
(
'--all'
,
action
=
'store_true'
,
help
=
'Launch slapgrid to process all Softare Releases '
help
=
'Launch slapgrid to process all Softare Releases '
'and/or Computer Partitions.'
)
'and/or Computer Partitions.'
)
ap
.
add_argument
(
'--only-sr'
,
help
=
'Force the update of a single software release (use url hash), '
'even if is already installed. This option will make all others '
'sofware releases be ignored.'
)
ap
.
add_argument
(
'--only-cp'
,
help
=
'Update a single or a list of computer partitions '
'(ie.:slappartX, slappartY), '
'this option will make all others computer partitions be ignored.'
)
return
ap
return
ap
def
take_action
(
self
,
args
):
def
take_action
(
self
,
args
):
...
@@ -97,6 +91,14 @@ class SoftwareCommand(SlapgridCommand):
...
@@ -97,6 +91,14 @@ class SoftwareCommand(SlapgridCommand):
method_name
=
'processSoftwareReleaseList'
method_name
=
'processSoftwareReleaseList'
default_pidfile
=
'/opt/slapos/slapgrid-sr.pid'
default_pidfile
=
'/opt/slapos/slapgrid-sr.pid'
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
SoftwareCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'--only-sr'
,
'--only'
,
help
=
'Force the update of a single software release (can be full URL or MD5 hash), '
'even if is already installed. This option will make all others '
'sofware releases be ignored.'
)
return
ap
class
InstanceCommand
(
SlapgridCommand
):
class
InstanceCommand
(
SlapgridCommand
):
"""Hook for entry point to process Computer Partitions"""
"""Hook for entry point to process Computer Partitions"""
...
@@ -104,6 +106,14 @@ class InstanceCommand(SlapgridCommand):
...
@@ -104,6 +106,14 @@ class InstanceCommand(SlapgridCommand):
method_name
=
'processComputerPartitionList'
method_name
=
'processComputerPartitionList'
default_pidfile
=
'/opt/slapos/slapgrid-cp.pid'
default_pidfile
=
'/opt/slapos/slapgrid-cp.pid'
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
InstanceCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'--only-cp'
,
'--only'
,
help
=
'Update a single or a list of computer partitions '
'(ie.:slappartX, slappartY), '
'this option will make all others computer partitions be ignored.'
)
return
ap
class
ReportCommand
(
SlapgridCommand
):
class
ReportCommand
(
SlapgridCommand
):
"""Hook for entry point to process Usage Reports"""
"""Hook for entry point to process Usage Reports"""
...
...
slapos/register/register.py
View file @
b7bf0cc5
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
##############################################################################
##############################################################################
# XXX dry_run will happily register a new node on the slapos master. Isn't it supposed to be no-op?
# XXX dry_run will happily register a new node on the slapos master. Isn't it supposed to be no-op?
# XXX does not create 'log' directory (required by slap2 entry point)
import
ConfigParser
import
ConfigParser
...
...
slapos/tests/slapgrid.py
View file @
b7bf0cc5
...
@@ -319,7 +319,7 @@ class ComputerForTest:
...
@@ -319,7 +319,7 @@ class ComputerForTest:
return
(
200
,
{},
''
)
return
(
200
,
{},
''
)
elif
method
==
'POST'
and
'url'
in
parsed_qs
:
elif
method
==
'POST'
and
'url'
in
parsed_qs
:
# XXX hardcoded to first sof
wt
are release!
# XXX hardcoded to first sof
tw
are release!
software
=
self
.
software_list
[
0
]
software
=
self
.
software_list
[
0
]
software
.
sequence
.
append
(
parsed_url
.
path
)
software
.
sequence
.
append
(
parsed_url
.
path
)
if
parsed_url
.
path
==
'buildingSoftwareRelease'
:
if
parsed_url
.
path
==
'buildingSoftwareRelease'
:
...
...
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