Commit b7bf0cc5 authored by Marco Mariani's avatar Marco Mariani

better docstrings, support for --only in addition to --only-sr or --only-cp

parent 92ea5d27
......@@ -7,12 +7,20 @@ from slapos.cache import do_lookup
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__)
def get_parser(self, prog_name):
ap = super(CacheLookupCommand, self).get_parser(prog_name)
# XXX this argument could use a better name
ap.add_argument('software_url',
help='Your software url or MD5 hash')
return ap
......
......@@ -8,8 +8,10 @@ from slapos.client import init, do_console, ClientConfig
class ConsoleCommand(ClientConfigCommand):
"""
slapconsole allows you interact with slap API. You can play with the global
"slap" object and with the global "request" method.
Python prompt to interact with slap API.
You can play with the global "slap" object and
with the global "request" method.
examples :
>>> # Request instance
......@@ -19,7 +21,6 @@ class ConsoleCommand(ClientConfigCommand):
>>> # Fetch instance informations on already launched instance
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")
"""
# XXX TODO: docstring is printed without newlines
log = logging.getLogger(__name__)
......
......@@ -16,8 +16,7 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
"""Given an argument list, find a command and
return the processor and any remaining arguments.
"""
# XXX a little cheating, 'slapos node' is not documented
# by the help command
# a little cheating, 'slapos node' is not documented by the help command
if argv == ['node']:
argv = ['node', 'status']
......
......@@ -22,7 +22,7 @@ class SlapgridCommand(ConfigCommand):
def get_parser(self, 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',
help='The instance root directory location.')
......@@ -39,7 +39,9 @@ class SlapgridCommand(ConfigCommand):
ap.add_argument('--buildout', default=None,
help='Location of buildout binary.')
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',
help='SSL Authorisation key file.')
ap.add_argument('--cert_file',
......@@ -59,14 +61,6 @@ class SlapgridCommand(ConfigCommand):
ap.add_argument('--all', action='store_true',
help='Launch slapgrid to process all Softare Releases '
'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
def take_action(self, args):
......@@ -97,6 +91,14 @@ class SoftwareCommand(SlapgridCommand):
method_name = 'processSoftwareReleaseList'
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):
"""Hook for entry point to process Computer Partitions"""
......@@ -104,6 +106,14 @@ class InstanceCommand(SlapgridCommand):
method_name = 'processComputerPartitionList'
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):
"""Hook for entry point to process Usage Reports"""
......
......@@ -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 does not create 'log' directory (required by slap2 entry point)
import ConfigParser
......
......@@ -319,7 +319,7 @@ class ComputerForTest:
return (200, {}, '')
elif method == 'POST' and 'url' in parsed_qs:
# XXX hardcoded to first sofwtare release!
# XXX hardcoded to first software release!
software = self.software_list[0]
software.sequence.append(parsed_url.path)
if parsed_url.path == 'buildingSoftwareRelease':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment