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
Carlos Ramos Carreño
slapos.core
Commits
1e726abc
Commit
1e726abc
authored
Apr 29, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new entry points for slapgrid-sr, slapgrid-cp, slapgrid-ur
parent
ef2d12bf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
11 deletions
+134
-11
setup.py
setup.py
+3
-0
slapos/cli/slapgrid.py
slapos/cli/slapgrid.py
+117
-0
slapos/cli_legacy/console.py
slapos/cli_legacy/console.py
+0
-2
slapos/cli_legacy/entry.py
slapos/cli_legacy/entry.py
+5
-0
slapos/cli_legacy/request.py
slapos/cli_legacy/request.py
+8
-8
slapos/cli_legacy/slapgrid.py
slapos/cli_legacy/slapgrid.py
+1
-1
No files found.
setup.py
View file @
1e726abc
...
...
@@ -83,6 +83,9 @@ setup(name=name,
'node stop = slapos.cli.supervisorctl:SupervisorctlStopCommand'
,
'node restart = slapos.cli.supervisorctl:SupervisorctlRestartCommand'
,
'node tail = slapos.cli.supervisorctl:SupervisorctlTailCommand'
,
'node report = slapos.cli.slapgrid:ReportCommand'
,
'node software = slapos.cli.slapgrid:SoftwareCommand'
,
'node instance = slapos.cli.slapgrid:InstanceCommand'
,
'console = slapos.cli.console:ConsoleCommand'
,
'supply = slapos.cli.supply:SupplyCommand'
,
'remove = slapos.cli.remove:RemoveCommand'
,
...
...
slapos/cli/slapgrid.py
0 → 100644
View file @
1e726abc
# -*- coding: utf-8 -*-
import
logging
from
slapos.cli.config
import
ConfigCommand
from
slapos.grid.utils
import
setRunning
,
setFinished
from
slapos.grid.slapgrid
import
(
merged_options
,
check_missing_parameters
,
check_missing_files
,
random_delay
,
create_slapgrid_object
)
class
SlapgridCommand
(
ConfigCommand
):
log
=
logging
.
getLogger
(
__name__
)
method_name
=
NotImplemented
default_pidfile
=
NotImplemented
def
get_parser
(
self
,
prog_name
):
ap
=
super
(
SlapgridCommand
,
self
).
get_parser
(
prog_name
)
ap
.
add_argument
(
'--instance-root'
,
help
=
'The instance root directory location.'
)
ap
.
add_argument
(
'--software-root'
,
help
=
'The software_root directory location.'
)
ap
.
add_argument
(
'--master-url'
,
help
=
'The master server URL. Mandatory.'
)
ap
.
add_argument
(
'--computer-id'
,
help
=
'The computer id defined in the server.'
)
ap
.
add_argument
(
'--supervisord-socket'
,
help
=
'The socket supervisor will use.'
)
ap
.
add_argument
(
'--supervisord-configuration-path'
,
help
=
'The location where supervisord configuration will be stored.'
)
ap
.
add_argument
(
'--buildout'
,
default
=
None
,
help
=
'Location of buildout binary.'
)
ap
.
add_argument
(
'--pidfile'
,
help
=
'The location where pidfile will be created.'
)
ap
.
add_argument
(
'--key_file'
,
help
=
'SSL Authorisation key file.'
)
ap
.
add_argument
(
'--cert_file'
,
help
=
'SSL Authorisation certificate file.'
)
ap
.
add_argument
(
'--signature_private_key_file'
,
help
=
'Signature private key file.'
)
ap
.
add_argument
(
'--master_ca_file'
,
help
=
'Root certificate of SlapOS master key.'
)
ap
.
add_argument
(
'--certificate_repository_path'
,
help
=
'Path to directory where downloaded certificates would be stored.'
)
ap
.
add_argument
(
'--maximum-periodicity'
,
type
=
int
,
default
=
None
,
help
=
'Periodicity at which buildout should be run in instance.'
)
ap
.
add_argument
(
'--promise-timeout'
,
type
=
int
,
default
=
3
,
help
=
'Promise timeout in seconds.'
)
ap
.
add_argument
(
'--now'
,
action
=
'store_true'
,
help
=
'Launch slapgrid without delay. Default behavior.'
)
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
):
config
=
self
.
fetch_config
(
args
)
options
=
merged_options
(
args
,
config
)
# XXX add formatter
# formatter = logging.Formatter(fmt='%(asctime)s %(name)-18s: '
# '%(levelname)-8s %(message)s',
# datefmt='%Y-%m-%dT%H:%M:%S')
#
# handler.setFormatter(formatter)
check_missing_parameters
(
options
)
check_missing_files
(
options
)
# XXX this action is logging twice
random_delay
(
options
,
logger
=
self
.
log
)
slapgrid_object
=
create_slapgrid_object
(
options
,
logger
=
self
.
log
)
pidfile
=
options
.
get
(
'pidfile'
)
or
self
.
default_pidfile
if
pidfile
:
setRunning
(
logger
=
self
.
log
,
pidfile
=
pidfile
)
try
:
return
getattr
(
slapgrid_object
,
self
.
method_name
)()
finally
:
if
pidfile
:
setFinished
(
pidfile
)
class
SoftwareCommand
(
SlapgridCommand
):
"""Hook for entry point to process Software Releases"""
method_name
=
'processSoftwareReleaseList'
default_pidfile
=
'/opt/slapos/slapgrid-sr.pid'
class
InstanceCommand
(
SlapgridCommand
):
"""Hook for entry point to process Computer Partitions"""
method_name
=
'processComputerPartitionList'
default_pidfile
=
'/opt/slapos/slapgrid-cp.pid'
class
ReportCommand
(
SlapgridCommand
):
"""Hook for entry point to process Usage Reports"""
method_name
=
'agregateAndSendUsage'
default_pidfile
=
'/opt/slapos/slapgrid-ur.pid'
slapos/cli_legacy/console.py
View file @
1e726abc
...
...
@@ -21,7 +21,6 @@ examples :
>>> # Fetch instance informations on already launched instance
>>> request(kvm, "myuniquekvm").getConnectionParameter("url")"""
%
sys
.
argv
[
0
]
ap
=
argparse
.
ArgumentParser
(
usage
=
usage
)
ap
.
add_argument
(
'-u'
,
'--master_url'
,
...
...
@@ -48,4 +47,3 @@ examples :
config
=
ClientConfig
(
args
,
get_config_parser
(
args
.
configuration_file
))
local
=
init
(
config
)
do_console
(
local
)
slapos/cli_legacy/entry.py
View file @
1e726abc
...
...
@@ -61,6 +61,7 @@ class EntryPointNotImplementedError(NotImplementedError):
def
__init__
(
self
,
*
args
,
**
kw_args
):
NotImplementedError
.
__init__
(
self
,
*
args
,
**
kw_args
)
def
checkSlaposCfg
():
"""
Check if a slapos configuration file was given as a argument.
...
...
@@ -78,6 +79,7 @@ def checkSlaposCfg():
return
True
return
False
def
checkOption
(
option
):
"""
Check if a given option is already in call line
...
...
@@ -93,6 +95,7 @@ def checkOption(option):
sys
.
argv
=
sys
.
argv
+
option
[
1
:]
return
True
def
call
(
fun
,
config
=
False
,
option
=
None
):
"""
Add missing options to sys.argv
...
...
@@ -109,6 +112,7 @@ def call(fun, config=False, option=None):
fun
()
sys
.
exit
(
0
)
def
dispatch
(
command
,
is_node_command
):
""" Dispatch to correct SlapOS module.
Here we could use introspection to get rid of the big "if" statements,
...
...
@@ -166,6 +170,7 @@ def dispatch(command, is_node_command):
else
:
return
False
def
main
():
"""
Main entry point of SlapOS Node. Used to dispatch commands to python
...
...
slapos/cli_legacy/request.py
View file @
1e726abc
...
...
@@ -28,18 +28,18 @@ def request():
ap
.
add_argument
(
'software_url'
,
help
=
'Your software url'
)
ap
.
add_argument
(
'--node'
,
nargs
=
'*'
,
help
=
'Node request option '
nargs
=
'*'
,
help
=
'Node request option '
"'option1=value1 option2=value2'"
)
ap
.
add_argument
(
'--type'
,
type
=
str
,
help
=
'Define software type to be requested'
)
type
=
str
,
help
=
'Define software type to be requested'
)
ap
.
add_argument
(
'--slave'
,
action
=
'store_true'
,
default
=
False
,
help
=
'Ask for a slave instance'
)
action
=
'store_true'
,
default
=
False
,
help
=
'Ask for a slave instance'
)
ap
.
add_argument
(
'--configuration'
,
nargs
=
'*'
,
help
=
'Give your configuration '
nargs
=
'*'
,
help
=
'Give your configuration '
"'option1=value1 option2=value2'"
)
args
=
ap
.
parse_args
()
...
...
slapos/cli_legacy/slapgrid.py
View file @
1e726abc
...
...
@@ -6,7 +6,7 @@ import ConfigParser
import
logging
import
sys
from
slapos.grid.utils
import
(
setRunning
,
setFinished
)
from
slapos.grid.utils
import
setRunning
,
setFinished
from
slapos.grid.slapgrid
import
(
merged_options
,
check_missing_parameters
,
check_missing_files
,
random_delay
,
create_slapgrid_object
)
...
...
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