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
Lisa Casino
slapos.core
Commits
fe08658f
Commit
fe08658f
authored
Dec 31, 2013
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SlapOS Core] Improve configure-local command and add test for this command
parent
de11308a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
258 additions
and
306 deletions
+258
-306
MANIFEST.in
MANIFEST.in
+3
-0
setup.py
setup.py
+7
-1
slapos-proxy.cfg.example
slapos-proxy.cfg.example
+6
-1
slapos/cli/command.py
slapos/cli/command.py
+2
-2
slapos/cli/configure_local/__init__.py
slapos/cli/configure_local/__init__.py
+116
-94
slapos/cli/configure_local/template/slapos-proxy.cfg.in
slapos/cli/configure_local/template/slapos-proxy.cfg.in
+0
-20
slapos/cli/configure_local/template/slapos.cfg.in
slapos/cli/configure_local/template/slapos.cfg.in
+0
-184
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+2
-1
slapos/proxy/__init__.py
slapos/proxy/__init__.py
+3
-3
slapos/tests/configure_local.py
slapos/tests/configure_local.py
+119
-0
No files found.
MANIFEST.in
View file @
fe08658f
include CHANGES.txt
include CHANGES.txt
include slapos/proxy/schema.sql
include slapos/proxy/schema.sql
include slapos/slapos-client.cfg.example
include slapos/slapos-proxy.cfg.example
include slapos/slapos.cfg.example
recursive-include slapos *.in *.txt *.xsd
recursive-include slapos *.in *.txt *.xsd
setup.py
View file @
fe08658f
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
from
shutil
import
copyfile
import
glob
import
glob
import
os
import
os
from
slapos.version
import
version
from
slapos.version
import
version
name
=
'slapos.core'
name
=
'slapos.core'
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
open
(
"CHANGES.txt"
).
read
()
+
"
\
n
"
...
@@ -11,6 +11,12 @@ long_description = open("README.txt").read() + "\n" + \
...
@@ -11,6 +11,12 @@ long_description = open("README.txt").read() + "\n" + \
for
f
in
sorted
(
glob
.
glob
(
os
.
path
.
join
(
'slapos'
,
'README.*.txt'
))):
for
f
in
sorted
(
glob
.
glob
(
os
.
path
.
join
(
'slapos'
,
'README.*.txt'
))):
long_description
+=
'
\
n
'
+
open
(
f
).
read
()
+
'
\
n
'
long_description
+=
'
\
n
'
+
open
(
f
).
read
()
+
'
\
n
'
slapos_folder_path
=
os
.
path
.
dirname
(
__file__
)
for
template_name
in
(
'slapos-client.cfg.example'
,
'slapos-proxy.cfg.example'
,
'slapos.cfg.example'
):
copyfile
(
os
.
path
.
join
(
slapos_folder_path
,
template_name
),
os
.
path
.
join
(
slapos_folder_path
,
'slapos'
,
template_name
))
additional_install_requires
=
[]
additional_install_requires
=
[]
# Even if argparse is available in python2.7, some python2.7 installations
# Even if argparse is available in python2.7, some python2.7 installations
# do not have it, so checking python version is dangerous
# do not have it, so checking python version is dangerous
...
...
slapos-proxy.cfg.example
View file @
fe08658f
# This is an example configuration file for a standalone micro slapos master
# This is an example configuration file for a standalone micro slapos master
# a.k.a slapproxy
# a.k.a slapproxy
[slapos]
instance_root = /srv/slapgrid
software_root = /opt/slapgrid
computer_id = local_computer
[slapproxy]
[slapproxy]
host = 127.0.0.1
host = 127.0.0.1
port = 5000
port = 5000
...
@@ -8,7 +13,7 @@ database_uri = /opt/slapos/slapproxy.db
...
@@ -8,7 +13,7 @@ database_uri = /opt/slapos/slapproxy.db
# Below is the list of software maintained by slapos.org and contributors
# Below is the list of software maintained by slapos.org and contributors
# It is used to simulate a proper configuration of a real slapos master.
# It is used to simulate a proper configuration of a real slapos master.
software_product_list =
software_product_list =
erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.1
43
:/software/erp5/software.cfg
erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.1
95
:/software/erp5/software.cfg
erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg
erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg
kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/kumofs/software.cfg
kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/kumofs/software.cfg
kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.193:/software/kvm/software.cfg
kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.193:/software/kvm/software.cfg
...
...
slapos/cli/command.py
View file @
fe08658f
...
@@ -5,10 +5,10 @@ import functools
...
@@ -5,10 +5,10 @@ import functools
import
os
import
os
import
sys
import
sys
import
cliff
from
cliff
import
command
class
Command
(
c
liff
.
c
ommand
.
Command
):
class
Command
(
command
.
Command
):
def
get_parser
(
self
,
prog_name
):
def
get_parser
(
self
,
prog_name
):
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
...
...
slapos/cli/configure_local/__init__.py
View file @
fe08658f
...
@@ -28,21 +28,23 @@
...
@@ -28,21 +28,23 @@
#
#
##############################################################################
##############################################################################
import
logging
import
os
import
os
import
pkg_resources
import
pkg_resources
import
re
import
re
import
subprocess
import
subprocess
import
sys
import
sys
from
slapos.cli.command
import
Command
,
must_be_root
from
slapos.cli.command
import
must_be_root
from
slapos.grid.utils
import
updateFile
from
slapos.format
import
FormatConfig
from
slapos.cli.config
import
ConfigCommand
from
slapos.grid.slapgrid
import
create_slapgrid_object
from
slapos.grid.utils
import
updateFile
,
createPrivateDirectory
from
slapos.grid.svcbackend
import
launchSupervisord
from
slapos.grid.svcbackend
import
launchSupervisord
DEFAULT_COMPUTER_ID
=
'local_computer'
DEFAULT_COMPUTER_ID
=
'local_computer'
class
ConfigureLocalCommand
(
Command
):
class
ConfigureLocalCommand
(
Co
nfigCo
mmand
):
"""
"""
Configure a slapos node, from scratch to ready-ro-use, using slapproxy.
Configure a slapos node, from scratch to ready-ro-use, using slapproxy.
"""
"""
...
@@ -74,10 +76,25 @@ class ConfigureLocalCommand(Command):
...
@@ -74,10 +76,25 @@ class ConfigureLocalCommand(Command):
' (default: %(default)s)'
)
' (default: %(default)s)'
)
ap
.
add_argument
(
'--daemon-listen-port'
,
ap
.
add_argument
(
'--daemon-listen-port'
,
default
=
'
127.0.0.1
'
,
default
=
'
8080
'
,
help
=
'Listening port of the "slapproxy" daemon'
help
=
'Listening port of the "slapproxy" daemon'
' (default: %(default)s)'
)
' (default: %(default)s)'
)
ap
.
add_argument
(
'--slapos-instance-root'
,
default
=
'/srv/slapgrid'
,
help
=
'Target location of the SlapOS configuration'
' directory (default: %(default)s)'
)
ap
.
add_argument
(
'--slapos-software-root'
,
default
=
'/opt/slapgrid'
,
help
=
'Target location of the SlapOS configuration'
' directory (default: %(default)s)'
)
ap
.
add_argument
(
'--slapos-buildout-directory'
,
default
=
'/opt/slapos'
,
help
=
'Target location of the SlapOS configuration'
' directory (default: %(default)s)'
)
ap
.
add_argument
(
'--slapos-configuration-directory'
,
ap
.
add_argument
(
'--slapos-configuration-directory'
,
default
=
'/etc/opt/slapos'
,
default
=
'/etc/opt/slapos'
,
help
=
'Target location of the SlapOS configuration'
help
=
'Target location of the SlapOS configuration'
...
@@ -88,100 +105,86 @@ class ConfigureLocalCommand(Command):
...
@@ -88,100 +105,86 @@ class ConfigureLocalCommand(Command):
@
must_be_root
@
must_be_root
def
take_action
(
self
,
args
):
def
take_action
(
self
,
args
):
try
:
try
:
return_code
=
do_configure
(
args
,
logger
)
return_code
=
do_configure
(
args
,
self
.
fetch_config
,
self
.
app
.
log
)
except
SystemExit
as
err
:
except
SystemExit
as
err
:
return_code
=
err
return_code
=
err
sys
.
exit
(
return_code
)
sys
.
exit
(
return_code
)
def
_createConfigurationDirectory
(
target_directory
):
def
_createDirectoryIfNotExist
(
target_directory
,
logger
):
target_directory
=
os
.
path
.
normpath
(
target_directory
)
target_directory
=
os
.
path
.
normpath
(
target_directory
)
# XXX: hardcoded
if
os
.
path
.
exists
(
os
.
path
.
join
(
target_directory
,
'slapos.cfg'
)):
logger
.
error
(
'A SlapOS configuration directory already exist at'
' %s. Aborting.'
%
target_directory
)
raise
SystemExit
(
1
)
if
not
os
.
path
.
exists
(
target_directory
):
if
not
os
.
path
.
exists
(
target_directory
):
os
.
mkdir
(
target_directory
,
0o711
)
os
.
makedirs
(
target_directory
)
return
target_directory
def
_replaceParameterValue
(
original_content
,
to_replace
):
def
_replaceParameterValue
(
original_content
,
to_replace
):
"""
"""
Replace in a .ini-like file the value of all parameters specified in
Replace in a .ini-like file the value of all parameters specified in
to_replace by their value.
to_replace by their value.
"""
"""
# XXX: Can be cleaned up by being replaced by a simple dict
new_content
=
''
for
key
,
value
in
to_replace
:
for
key
,
value
in
to_replace
:
# Replace all values of the given parameters to the specified values
original_content
=
re
.
sub
(
'%s
\
s+=.*
'
% key, '
%
s
=
%
s
' % (key, value),
new_content
=
re
.
sub
(
original_content)
'%s
\
s+=.*
'
% key, '
%
s
=
%
s
' % (key, value),
return original_content
original_content
)
def _generateSlaposNodeConfigurationFile(slapos_node_config_path, args):
return new_content
template_arg_list = (__name__.split('
.
')[0], '
slapos
.
cfg
.
example
')
with pkg_resources.resource_stream(*template_arg_list) as fout:
def _generateSlaposNodeConfigurationFile(target_directory,
slapos_node_configuration_template = fout.read()
listening_ip, listening_port,
master_url = '
http
:
//%
s
:
%
s
' % (args.daemon_listen_ip, args.daemon_listen_port)
interface_name,
slapos_home = args.slapos_buildout_directory
ipv4_local_network,
partition_number):
slapos_node_configuration_template = pkg_resources.resource_stream(
__name__, '
template
/
slapos
.
cfg
.
in
').read()
slapos_node_configuration_file_location = os.path.join(
target_directory, '
slapos
.
cfg
')
to_replace = [
to_replace = [
('
computer_id
', DEFAULT_COMPUTER_ID),
('
computer_id
', DEFAULT_COMPUTER_ID),
('
master_url
', '
http
:
//%
s
:
%
s
' % (listening_ip, listening_port)),
('
master_url
', master_url),
('
interface_name
', interface_name),
('
interface_name
', args.interface_name),
('
ipv4_local_network
', ipv4_local_network),
('
ipv4_local_network
', args.ipv4_local_network),
('
partition_amount
', partition_number),
('
partition_amount
', args.partition_number),
('
instance_root
', args.slapos_instance_root),
('
software_root
', args.slapos_software_root),
('
computer_xml
', '
%
s
/
slapos
.
xml
' % slapos_home),
('
log_file
', '
%
s
/
log
/
slapos
-
node
-
format
.
log
' % slapos_home),
('
use_unique_local_address
', '
true
')
('
use_unique_local_address
', '
true
')
]
]
slapos_node_configuration_content = _replaceParameterValue(
slapos_node_configuration_content = _replaceParameterValue(
slapos_node_configuration_template, to_replace)
slapos_node_configuration_template, to_replace)
slapos_node_configuration_content = re.sub(
with open(slapos_node_configuration_file_location, '
w
') as fout:
'
(
key_file
|
cert_file
|
certificate_repository_path
).
*=
.
*
\
n
',
'', slapos_node_configuration_content)
with open(slapos_node_config_path, '
w
') as fout:
fout.write(slapos_node_configuration_content.encode('
utf8
'))
fout.write(slapos_node_configuration_content.encode('
utf8
'))
def _generateSlaposProxyConfigurationFile(conf):
def _generateSlaposProxyConfigurationFile(target_directory,
template_arg_list = (__name__.split('
.
')[0], '
slapos
-
proxy
.
cfg
.
example
')
listening_ip, listening_port
with pkg_resources.resource_stream(*template_arg_list) as fout:
):
slapos_proxy_configuration_template = fout.read()
slapos_proxy_configuration_
template = pkg_resources.resource_stream
(
slapos_proxy_configuration_
path = os.path.join
(
__name__, '
template
/
slapos
-
proxy
.
cfg
.
in
').read(
)
conf.slapos_configuration_directory, '
slapos
-
proxy
.
cfg
'
)
slapos_proxy_configuration_file_location = os.path.join(
listening_ip, listening_port =
\
target_directory, '
slapos
-
proxy
.
cfg
')
conf.daemon_listen_ip, conf.daemon_listen_port
to_replace = [
to_replace = [
('
host
', listening_ip),
('
host
', listening_ip),
('
port
', listening_port),
('
port
', listening_port),
('
master_url
', '
http
:
//%
s
:
%
s
/
' % (listening_ip, listening_port)),
('
computer_id
', DEFAULT_COMPUTER_ID),
('
instance_root
', conf.instance_root),
('
software_root
', conf.software_root)
]
]
slapos_proxy_configuration_content = _replaceParameterValue(
slapos_proxy_configuration_content = _replaceParameterValue(
slapos_proxy_configuration_template, to_replace)
slapos_proxy_configuration_template, to_replace)
with open(slapos_proxy_configuration_
file_location
, '
w
') as fout:
with open(slapos_proxy_configuration_
path
, '
w
') as fout:
fout.write(slapos_proxy_configuration_content.encode('
utf8
'))
fout.write(slapos_proxy_configuration_content.encode('
utf8
'))
return slapos_proxy_configuration_
file_location
return slapos_proxy_configuration_
path
def _addProxyToSupervisor(
proxy_configuration_file
):
def _addProxyToSupervisor(
conf
):
"""
"""
Create a supervisord configuration file containing informations to run
Create a supervisord configuration file containing informations to run
slapproxy as daemon
slapproxy as daemon
"""
"""
# In the beginning God created SlapOS.
# And SlapOS was without form, and void; and darkness was upon the face of the deep.
# And God said, Let there be supervisord manager.
# But God was drunk. The result can be found by the Brave in slapgrid, but it may turn the Brave blind forever.
# So, for the sake of God, I'
m
not
using
that
helper
.
# XXX every path here is hardcoded, assuming default values
program_partition_template = """
\
program_partition_template = """
\
[program:slapproxy]
[program:slapproxy]
directory=
/opt/slapo
s
directory=
%(slapos_buildout_directory)
s
command=%(program_command)s
command=%(program_command)s
process_name=slapproxy
process_name=slapproxy
autostart=true
autostart=true
...
@@ -201,24 +204,28 @@ stdout_logfile_backups=1
...
@@ -201,24 +204,28 @@ stdout_logfile_backups=1
stderr_logfile=%(log_file)s
stderr_logfile=%(log_file)s
stderr_logfile_maxbytes=100KB
stderr_logfile_maxbytes=100KB
stderr_logfile_backups=1
stderr_logfile_backups=1
"""
%
{
'log_file'
:
'/opt/slapos/log/slapos-proxy.log'
,
""" % {'
log_file
': '
%
s
/
log
/
slapos
-
proxy
.
log
' % conf.slapos_buildout_directory,
'program_command'
:
'/opt/slapos/bin/slapproxy %s'
%
proxy_configuration_file
}
'
slapos_buildout_directory
': conf.slapos_buildout_directory,
'
program_command
': '
%
s
/
bin
/
slapproxy
%
s
' %
\
(conf.slapos_buildout_directory, conf.proxy_configuration_file)}
supervisord_conf_folder_path = os.path.join(conf.instance_root,
'
etc
', '
supervisord
.
conf
.
d
')
_createConfigurationDirectory(supervisord_conf_folder_path)
updateFile(
updateFile(
'/srv/slapgrid/etc/supervisord.conf.d/slapproxy.conf'
,
os.path.join(supervisord_conf_folder_path, '
slapproxy
.
conf
'),
program_partition_template
program_partition_template)
)
def
_runFormat
():
def _runFormat(
slapos_directory
):
"""
"""
Launch slapos node format.
Launch slapos node format.
"""
"""
# XXX: hardcoded
subprocess.Popen(
command
=
'/opt/slapos/bin/slapos node format --now -v'
.
split
()
["%s/bin/slapos" % slapos_directory,
subprocess
.
Popen
(
command
).
communicate
()
"node", "format", "--now"]
).communicate()
def
do_configure
(
conf
,
logger
):
def do_configure(
args, fetch_config_func
, logger):
"""
"""
Generate configuration files,
Generate configuration files,
Create the instance path by running slapformat (but will crash),
Create the instance path by running slapformat (but will crash),
...
@@ -226,28 +233,43 @@ def do_configure(conf, logger):
...
@@ -226,28 +233,43 @@ def do_configure(conf, logger):
Run supervisor, which will run the proxy,
Run supervisor, which will run the proxy,
Run format, which will finish correctly.
Run format, which will finish correctly.
"""
"""
slapos_configuration_directory
=
_createDirectoryIfNotExist
(
slapos_node_config_path = os.path.join(
conf
.
slapos_configuration_directory
,
logger
)
args.slapos_configuration_directory, '
slapos
.
cfg
')
if os.path.exists(slapos_node_config_path):
_generateSlaposNodeConfigurationFile
(
logger.error('
A
SlapOS
configuration
directory
already
exist
at
'
slapos_configuration_directory
,
'
%
s
.
Aborting
.
' % slapos_node_config_path)
conf
.
daemon_listen_ip
,
raise SystemExit(1)
conf
.
daemon_listen_port
,
if not getattr(args, '
cfg
', None):
conf
.
interface_name
,
args.cfg = slapos_node_config_path
conf
.
ipv4_local_network
,
_createConfigurationDirectory(args.slapos_configuration_directory)
conf
.
partition_number
_generateSlaposNodeConfigurationFile(slapos_node_config_path, args)
)
configp = fetch_config_func(args)
proxy_configuration_file_location
=
_generateSlaposProxyConfigurationFile
(
conf = FormatConfig(logger=logger)
slapos_configuration_directory
,
conf.mergeConfig(args, configp)
conf
.
daemon_listen_ip
,
supervisord_socket_path = os.path.join(conf.instance_root,
conf
.
daemon_listen_port
'
supervisord
.
socket
')
supervisord_conf_path = os.path.join(conf.instance_root,
'
etc
', '
supervisord
.
conf
')
conf_property_list = (
('
supervisord_socket
', supervisord_socket_path),
('
supervisord_configuration_path
', supervisord_conf_path),
)
)
_runFormat
()
for key, value in conf_property_list:
_addProxyToSupervisor
(
proxy_configuration_file_location
)
if not getattr(conf, key, None):
# XXX hardcoded
setattr(conf, key, value)
launchSupervisord
(
slapgrid = create_slapgrid_object(conf.__dict__, logger)
'/srv/slapgrid/supervisord.socket'
,
createPrivateDirectory(os.path.join(conf.slapos_buildout_directory, '
log
'))
'/srv/slapgrid/etc/supervisord.conf'
,
_runFormat(conf.slapos_buildout_directory)
logger
=
logger
)
slapgrid.checkEnvironmentAndCreateStructure()
_runFormat
()
proxy_configuration_file = _generateSlaposProxyConfigurationFile(conf)
conf.proxy_configuration_file = proxy_configuration_file
_addProxyToSupervisor(conf)
home_folder_path = os.environ['
HOME
']
createPrivateDirectory("%s/.slapos" % home_folder_path)
slapos_client_cfg_path = '
%
s
/
.
slapos
/
slapos
-
client
.
cfg
' % home_folder_path
if not os.path.exists(slapos_client_cfg_path):
os.symlink(slapos_node_config_path, slapos_client_cfg_path)
launchSupervisord(socket=supervisord_socket_path,
configuration_file=supervisord_conf_path, logger=logger)
_runFormat(conf.slapos_buildout_directory)
return 0
return 0
slapos/cli/configure_local/template/slapos-proxy.cfg.in
deleted
100644 → 0
View file @
de11308a
# This is an example configuration file for a standalone micro slapos master
# a.k.a slapproxy
[slapproxy]
host = %(host)s
port = %(port)s
database_uri = /opt/slapos/slapproxy.db
# Below is the list of software maintained by slapos.org and contributors
# It is used to simulate a proper configuration of a real slapos master.
software_product_list =
erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.143:/software/erp5/software.cfg
erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg
kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/kumofs/software.cfg
kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.193:/software/kvm/software.cfg
maarch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.159:/software/maarch/software.cfg
mariadb http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.152:/software/mariadb/software.cfg
memcached http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.82:/software/memcached/software.cfg
slaposwebrunner http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.160:/software/slaprunner/software.cfg
wordpress http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.163:/software/wordpress/software.cfg
zabbixagent http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.162:/software/zabbix-agent/software.cfg
slapos/cli/configure_local/template/slapos.cfg.in
deleted
100644 → 0
View file @
de11308a
[slapos]
# Replace computer_id by the unique identifier of your computer on your SlapOS,
# Master, usually starting by COMP-
computer_id = %(computer_id)s
master_url = %(master_url)s
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
[slapformat]
# Replace by your network interface providing IPv6 if you don't use re6st
interface_name = %(interface_name)s
# Change "create_tap" into "true" if you need to host KVM services
create_tap = false
partition_amount = %(partition_amount)s
computer_xml = /opt/slapos/slapos.xml
log_file = /opt/slapos/log/slapos-node-format.log
partition_base_name = slappart
user_base_name = slappart
# You can choose any other local network which does not conflict with your
# current machine configuration
ipv4_local_network = %(ipv4_local_network)
# Change to true if you want slapos to use local-only IPv6
use_unique_local_address = True
[networkcache]
# Define options for binary cache, used to download already compiled software.
download-binary-cache-url = http://www.shacache.org/shacache
download-cache-url = https://www.shacache.org/shacache
download-binary-dir-url = http://www.shacache.org/shadir
# Configuration to Upload Configuration for Binary cache
#upload-binary-dir-url = https://www.shacache.org/shadir
#upload-binary-cache-url = https://www.shacache.org/shacache
#signature_private_key_file = /etc/opt/slapos/shacache/signature.key
#signature_certificate_file = /etc/opt/slapos/shacache/signature.cert
#upload-cache-url = https://www.shacache.org/shacache
#shacache-cert-file = /etc/opt/slapos/shacache/shacache.cert
#shacache-key-file = /etc/opt/slapos/shacache/shacache.key
#upload-binary-dir-url = https://www.shacache.org/shadir
#upload-binary-cache-url = https://www.shacache.org/shacache
#upload-dir-url = https://www.shacache.org/shadir
#shadir-cert-file = /etc/opt/slapos/shacache/shacache.cert
#shadir-key-file = /etc/opt/slapos/shacache/shacache.key
# List of signatures of uploaders we trust:
# Romain Courteaud
# Sebastien Robin
# Kazuhiko Shiozaki
# Cedric de Saint Martin
# Yingjie Xu
# Gabriel Monnerat
# Lukasz Nowak
# Marco Mariani
# Test Agent Signature
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
ZmF1bHQgUHJvdmluY2Ux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ctozXrotb8NIis2MtLIj+WonE0wSqYefxwBmAGjB9cfWz/sNamhM4rn
BP1A2ojVhF6hOE1qvTP5YxcGXOoYTrEQSuDF1hn12WlA4vqIAz1f+4CiMJNlXPwh
7N+X2kvRpHdXAHkBOxX3j34AeCZrSpu/yDQ=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
# List of URL(s) which shouldn't be downloaded from binary cache.
# Any URL beginning by a blacklisted URL will be blacklisted as well.
download-from-binary-cache-url-blacklist =
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD
http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads
/
# List of URL(s) which shouldn't be uploaded into binary cache.
# Any URL beginning by a blacklisted URL will be blacklisted as well.
upload-to-binary-cache-url-blacklist =
http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD
http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads
/
slapos/grid/slapgrid.py
View file @
fe08658f
...
@@ -65,6 +65,7 @@ COMPUTER_PARTITION_STOPPED_STATE = 'stopped'
...
@@ -65,6 +65,7 @@ COMPUTER_PARTITION_STOPPED_STATE = 'stopped'
SLAPGRID_SUCCESS
=
0
SLAPGRID_SUCCESS
=
0
SLAPGRID_FAIL
=
1
SLAPGRID_FAIL
=
1
SLAPGRID_PROMISE_FAIL
=
2
SLAPGRID_PROMISE_FAIL
=
2
PROMISE_TIMEOUT
=
3
# XXX hardcoded watchdog_path
# XXX hardcoded watchdog_path
WATCHDOG_PATH
=
'/opt/slapos/bin/slapos-watchdog'
WATCHDOG_PATH
=
'/opt/slapos/bin/slapos-watchdog'
...
@@ -214,7 +215,7 @@ def create_slapgrid_object(options, logger):
...
@@ -214,7 +215,7 @@ def create_slapgrid_object(options, logger):
upload_dir_url
=
op
.
get
(
'upload-dir-url'
),
upload_dir_url
=
op
.
get
(
'upload-dir-url'
),
master_ca_file
=
op
.
get
(
'master_ca_file'
),
master_ca_file
=
op
.
get
(
'master_ca_file'
),
certificate_repository_path
=
op
.
get
(
'certificate_repository_path'
),
certificate_repository_path
=
op
.
get
(
'certificate_repository_path'
),
promise_timeout
=
op
[
'promise_timeout'
]
,
promise_timeout
=
op
.
get
(
'promise_timeout'
,
PROMISE_TIMEOUT
)
,
shacache_cert_file
=
op
.
get
(
'shacache-cert-file'
),
shacache_cert_file
=
op
.
get
(
'shacache-cert-file'
),
shacache_key_file
=
op
.
get
(
'shacache-key-file'
),
shacache_key_file
=
op
.
get
(
'shacache-key-file'
),
shadir_cert_file
=
op
.
get
(
'shadir-cert-file'
),
shadir_cert_file
=
op
.
get
(
'shadir-cert-file'
),
...
...
slapos/proxy/__init__.py
View file @
fe08658f
...
@@ -69,8 +69,6 @@ class ProxyConfig(object):
...
@@ -69,8 +69,6 @@ class ProxyConfig(object):
def
setConfig
(
self
):
def
setConfig
(
self
):
if
not
self
.
database_uri
:
if
not
self
.
database_uri
:
raise
ValueError
(
'database-uri is required.'
)
raise
ValueError
(
'database-uri is required.'
)
self
.
software_product_list
=
_generateSoftwareProductListFromString
(
getattr
(
self
,
'software_product_list'
,
''
))
def
do_proxy
(
conf
):
def
do_proxy
(
conf
):
...
@@ -80,5 +78,7 @@ def do_proxy(conf):
...
@@ -80,5 +78,7 @@ def do_proxy(conf):
app
.
logger
.
setLevel
(
logging
.
INFO
)
app
.
logger
.
setLevel
(
logging
.
INFO
)
app
.
config
[
'computer_id'
]
=
conf
.
computer_id
app
.
config
[
'computer_id'
]
=
conf
.
computer_id
app
.
config
[
'DATABASE_URI'
]
=
conf
.
database_uri
app
.
config
[
'DATABASE_URI'
]
=
conf
.
database_uri
app
.
config
[
'software_product_list'
]
=
conf
.
software_product_list
app
.
config
[
'software_product_list'
]
=
\
_generateSoftwareProductListFromString
(
getattr
(
conf
,
'software_product_list'
,
""
))
app
.
run
(
host
=
conf
.
host
,
port
=
int
(
conf
.
port
))
app
.
run
(
host
=
conf
.
host
,
port
=
int
(
conf
.
port
))
slapos/tests/configure_local.py
0 → 100644
View file @
fe08658f
##############################################################################
#
# Copyright (c) 2014 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
os
import
unittest
import
shutil
import
tempfile
import
slapos.slap
import
slapos.cli.configure_local
from
slapos.cli.configure_local
import
ConfigureLocalCommand
,
_createConfigurationDirectory
from
slapos.cli.entry
import
SlapOSApp
from
argparse
import
Namespace
from
ConfigParser
import
ConfigParser
# Disable any command to launch slapformat and supervisor
slapos
.
cli
.
configure_local
.
_runFormat
=
lambda
x
:
"Do nothing"
slapos
.
cli
.
configure_local
.
launchSupervisord
=
lambda
socket
,
\
configuration_file
,
logger
:
"Do nothing"
class
TestConfigureLocal
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
slap
=
slapos
.
slap
.
slap
()
self
.
app
=
SlapOSApp
()
self
.
temp_dir
=
tempfile
.
mkdtemp
()
os
.
environ
[
"HOME"
]
=
self
.
temp_dir
self
.
instance_root
=
tempfile
.
mkdtemp
()
self
.
software_root
=
tempfile
.
mkdtemp
()
if
os
.
path
.
exists
(
self
.
temp_dir
):
shutil
.
rmtree
(
self
.
temp_dir
)
def
tearDown
(
self
):
for
temp_path
in
(
self
.
temp_dir
,
\
self
.
instance_root
,
self
.
software_root
):
if
os
.
path
.
exists
(
temp_path
):
shutil
.
rmtree
(
temp_path
)
def
test_configure_local_environment_with_default_value
(
self
):
config
=
ConfigureLocalCommand
(
self
.
app
,
Namespace
())
config
.
__dict__
.
update
({
i
.
dest
:
i
.
default
\
for
i
in
config
.
get_parser
(
None
).
_option_string_actions
.
values
()})
config
.
slapos_configuration_directory
=
self
.
temp_dir
config
.
slapos_buildout_directory
=
self
.
temp_dir
config
.
slapos_instance_root
=
self
.
instance_root
slapos
.
cli
.
configure_local
.
do_configure
(
config
,
config
.
fetch_config
,
self
.
app
.
log
)
expected_software_root
=
"/opt/slapgrid"
self
.
assertTrue
(
os
.
path
.
exists
(
"%s/.slapos/slapos-client.cfg"
%
self
.
temp_dir
))
with
open
(
self
.
temp_dir
+
'/slapos-proxy.cfg'
)
as
fout
:
proxy_config
=
ConfigParser
()
proxy_config
.
readfp
(
fout
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'instance_root'
),
self
.
instance_root
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'software_root'
),
expected_software_root
)
with
open
(
self
.
temp_dir
+
'/slapos.cfg'
)
as
fout
:
proxy_config
=
ConfigParser
()
proxy_config
.
readfp
(
fout
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'instance_root'
),
self
.
instance_root
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'software_root'
),
expected_software_root
)
def
test_configure_local_environment
(
self
):
config
=
ConfigureLocalCommand
(
self
.
app
,
Namespace
())
config
.
__dict__
.
update
({
i
.
dest
:
i
.
default
\
for
i
in
config
.
get_parser
(
None
).
_option_string_actions
.
values
()})
config
.
slapos_configuration_directory
=
self
.
temp_dir
config
.
slapos_buildout_directory
=
self
.
temp_dir
config
.
slapos_instance_root
=
self
.
instance_root
config
.
slapos_software_root
=
self
.
software_root
slapos
.
cli
.
configure_local
.
do_configure
(
config
,
config
.
fetch_config
,
self
.
app
.
log
)
log_folder
=
os
.
path
.
join
(
config
.
slapos_buildout_directory
,
'log'
)
self
.
assertTrue
(
os
.
path
.
exists
(
log_folder
),
"%s not exists"
%
log_folder
)
self
.
assertTrue
(
os
.
path
.
exists
(
"%s/.slapos/slapos-client.cfg"
%
self
.
temp_dir
))
with
open
(
self
.
temp_dir
+
'/slapos-proxy.cfg'
)
as
fout
:
proxy_config
=
ConfigParser
()
proxy_config
.
readfp
(
fout
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'instance_root'
),
self
.
instance_root
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'software_root'
),
self
.
software_root
)
with
open
(
self
.
temp_dir
+
'/slapos.cfg'
)
as
fout
:
proxy_config
=
ConfigParser
()
proxy_config
.
readfp
(
fout
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'instance_root'
),
self
.
instance_root
)
self
.
assertEquals
(
proxy_config
.
get
(
'slapos'
,
'software_root'
),
self
.
software_root
)
log_file
=
proxy_config
.
get
(
'slapformat'
,
'log_file'
)
self
.
assertTrue
(
log_file
.
startswith
(
log_folder
),
"%s don't starts with %s"
%
(
log_file
,
log_folder
))
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