Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
106
Merge Requests
106
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
63a7d2ec
Commit
63a7d2ec
authored
Aug 29, 2011
by
Priscila Manhaes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cloudooo' of
https://git.erp5.org/repos/slapos
into cloudooo
parents
9d9ff2ff
78099114
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
80 deletions
+108
-80
slapos/recipe/cloudooo/__init__.py
slapos/recipe/cloudooo/__init__.py
+13
-16
slapos/recipe/cloudooo/template/cloudooo.cfg.in
slapos/recipe/cloudooo/template/cloudooo.cfg.in
+1
-0
slapos/recipe/cloudoootestnode/SlapOSControler.py
slapos/recipe/cloudoootestnode/SlapOSControler.py
+35
-34
slapos/recipe/cloudoootestnode/testnode.py
slapos/recipe/cloudoootestnode/testnode.py
+59
-30
No files found.
slapos/recipe/cloudooo/__init__.py
View file @
63a7d2ec
...
@@ -42,15 +42,20 @@ class Recipe(BaseSlapRecipe):
...
@@ -42,15 +42,20 @@ class Recipe(BaseSlapRecipe):
def
_install
(
self
):
def
_install
(
self
):
self
.
path_list
=
[]
self
.
path_list
=
[]
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
self
.
killpidfromfile
=
zc
.
buildout
.
easy_install
.
scripts
(
[(
'killpidfromfile'
,
__name__
+
'slapos.recipe.erp5.killpidfromfile'
,
'killpidfromfile'
)],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
)[
0
]
self
.
path_list
.
append
(
self
.
killpidfromfile
)
self
.
cron_d
=
self
.
installCrond
()
self
.
cron_d
=
self
.
installCrond
()
ca_conf
=
self
.
installCertificateAuthority
()
ca_conf
=
self
.
installCertificateAuthority
()
key
,
certificate
=
self
.
requestCertificate
(
'Cloudooo'
)
key
,
certificate
=
self
.
requestCertificate
(
'Cloudooo'
)
cloudooo_paster
=
os
.
path
.
join
(
self
.
bin_directory
,
'cloudooo_paster'
)
ooo_paster
=
self
.
options
[
'ooo_paster'
]
if
os
.
path
.
lexists
(
cloudooo_paster
):
if
not
os
.
readlink
(
cloudooo_paster
)
!=
ooo_paster
:
os
.
unlink
(
cloudooo_paster
)
if
not
os
.
path
.
lexists
(
cloudooo_paster
):
os
.
symlink
(
ooo_paster
,
cloudooo_paster
)
self
.
options
[
'cloudooo_paster'
]
=
cloudooo_paster
conversion_server_conf
=
self
.
installConversionServer
(
conversion_server_conf
=
self
.
installConversionServer
(
self
.
getLocalIPv4Address
(),
23000
,
23060
)
self
.
getLocalIPv4Address
(),
23000
,
23060
)
...
@@ -70,15 +75,6 @@ class Recipe(BaseSlapRecipe):
...
@@ -70,15 +75,6 @@ class Recipe(BaseSlapRecipe):
os
.
symlink
(
runUnitTest
,
runCloudoooUnitTest
)
os
.
symlink
(
runUnitTest
,
runCloudoooUnitTest
)
self
.
path_list
.
append
(
runCloudoooUnitTest
)
self
.
path_list
.
append
(
runCloudoooUnitTest
)
cloudooo_paster
=
os
.
path
.
join
(
self
.
bin_directory
,
'cloudooo_paster'
)
ooo_paster
=
self
.
options
[
'ooo_paster'
]
if
os
.
path
.
lexists
(
cloudooo_paster
):
if
not
os
.
readlink
(
cloudooo_paster
)
!=
ooo_paster
:
os
.
unlink
(
cloudooo_paster
)
if
not
os
.
path
.
lexists
(
cloudooo_paster
):
os
.
symlink
(
ooo_paster
,
cloudooo_paster
)
self
.
path_list
.
append
(
cloudooo_paster
)
self
.
linkBinary
()
self
.
linkBinary
()
self
.
setConnectionDict
(
dict
(
self
.
setConnectionDict
(
dict
(
site_url
=
"https://[%s]:%s/"
%
(
stunnel_conf
[
'public_ip'
],
site_url
=
"https://[%s]:%s/"
%
(
stunnel_conf
[
'public_ip'
],
...
@@ -190,7 +186,8 @@ class Recipe(BaseSlapRecipe):
...
@@ -190,7 +186,8 @@ class Recipe(BaseSlapRecipe):
email_address
=
ca_email
,
email_address
=
ca_email
,
)
)
self
.
_writeFile
(
openssl_configuration
,
self
.
_writeFile
(
openssl_configuration
,
self
.
getTemplateFilename
(
'openssl.cnf.ca.in'
))
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'openssl.cnf.ca.in'
),
config
))
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([
self
.
path_list
.
extend
(
zc
.
buildout
.
easy_install
.
scripts
([
(
'certificate_authority'
,
(
'certificate_authority'
,
'slapos.recipe.erp5.certificate_authority'
,
'slapos.recipe.erp5.certificate_authority'
,
...
@@ -241,7 +238,7 @@ class Recipe(BaseSlapRecipe):
...
@@ -241,7 +238,7 @@ class Recipe(BaseSlapRecipe):
port
=
port
,
port
=
port
,
openoffice_port
=
openoffice_port
,
openoffice_port
=
openoffice_port
,
openoffice_host
=
ip
,
openoffice_host
=
ip
,
PATH
=
"$PATH:%s"
%
self
.
bin_directory
PATH
=
self
.
bin_directory
)
)
for
env_line
in
self
.
options
[
'environment'
].
splitlines
():
for
env_line
in
self
.
options
[
'environment'
].
splitlines
():
env_line
=
env_line
.
strip
()
env_line
=
env_line
.
strip
()
...
@@ -261,7 +258,7 @@ class Recipe(BaseSlapRecipe):
...
@@ -261,7 +258,7 @@ class Recipe(BaseSlapRecipe):
'slapos.recipe.librecipe.execute'
,
'slapos.recipe.librecipe.execute'
,
'execute_with_signal_translation'
)],
self
.
ws
,
'execute_with_signal_translation'
)],
self
.
ws
,
sys
.
executable
,
self
.
wrapper_directory
,
sys
.
executable
,
self
.
wrapper_directory
,
arguments
=
[
self
.
options
[
'ooo_paster'
].
strip
(),
'serve'
,
config_file
]))
arguments
=
[
self
.
options
[
'
cloud
ooo_paster'
].
strip
(),
'serve'
,
config_file
]))
return
{
return
{
name
+
'_conf'
:
config_file
,
name
+
'_conf'
:
config_file
,
name
+
'_port'
:
conversion_server_dict
[
'port'
],
name
+
'_port'
:
conversion_server_dict
[
'port'
],
...
...
slapos/recipe/cloudooo/template/cloudooo.cfg.in
View file @
63a7d2ec
...
@@ -48,6 +48,7 @@ mimetype_registry =
...
@@ -48,6 +48,7 @@ mimetype_registry =
application/x-shockwave-flash * ffmpeg
application/x-shockwave-flash * ffmpeg
application/ogg * ffmpeg
application/ogg * ffmpeg
application/ogv * ffmpeg
application/ogv * ffmpeg
image/png image/jpeg imagemagick
image/png * ooo
image/png * ooo
image/* image/* imagemagick
image/* image/* imagemagick
text/* * ooo
text/* * ooo
...
...
slapos/recipe/cloudoootestnode/SlapOSControler.py
View file @
63a7d2ec
...
@@ -46,18 +46,12 @@ class SlapOSControler(object):
...
@@ -46,18 +46,12 @@ class SlapOSControler(object):
'reference'
:
config
[
'computer_id'
],
'reference'
:
config
[
'computer_id'
],
'software_root'
:
config
[
'software_root'
]}))
'software_root'
:
config
[
'software_root'
]}))
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
):
def
runSoftwareRelease
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
print
"SlapOSControler.runSoftwareRelease"
print
"SlapOSControler.runSoftwareRelease"
while
True
:
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
cpu_count
=
os
.
sysconf
(
"SC_NPROCESSORS_ONLN"
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
putenv
(
'MAKEFLAGS'
,
'-j%s'
%
cpu_count
)
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
os
.
environ
[
'PATH'
]
=
environment
[
'PATH'
]
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_out'
),
'w+'
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.runSoftwareRelease_err'
),
'w+'
)
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_software_binary'
],
'-v'
,
'-c'
,
#'--buildout-parameter',"'-U -N' -o",
#'--buildout-parameter',"'-U -N' -o",
config
[
'slapos_config'
]],
config
[
'slapos_config'
]],
...
@@ -75,19 +69,26 @@ class SlapOSControler(object):
...
@@ -75,19 +69,26 @@ class SlapOSControler(object):
stderr
.
close
()
stderr
.
close
()
return
status_dict
return
status_dict
def
runComputerPartition
(
self
,
config
,
process_group_pid_set
=
None
):
def
runComputerPartition
(
self
,
config
,
environment
,
process_group_pid_set
=
None
,
stdout
=
None
,
stderr
=
None
):
print
"SlapOSControler.runInstanceRelease"
print
"SlapOSControler.runInstanceRelease"
slap
=
slapos
.
slap
.
slap
()
slap
=
slapos
.
slap
.
slap
()
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
slap
.
registerOpenOrder
().
request
(
self
.
software_profile
,
partition_reference
=
'testing partition'
,
partition_reference
=
'testing partition'
,
partition_parameter_kw
=
config
[
'instance_dict'
])
partition_parameter_kw
=
config
[
'instance_dict'
])
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
slapgrid
=
subprocess
.
Popen
([
config
[
'slapgrid_partition_binary'
],
config
[
'slapos_config'
],
'-c'
,
'-v'
],
close_fds
=
True
,
preexec_fn
=
os
.
setsid
,
config
[
'slapos_config'
],
'-c'
,
'-v'
],
stdout
=-
1
,
stderr
=-
1
)
stdout
=
stdout
,
stderr
=
stderr
,
ss
,
se
=
slapgrid
.
communicate
()
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
print
"
\
n
%s
\
n
\
n
%s
\
n
"
%
(
ss
,
se
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
process_group_pid_set
.
add
(
slapgrid
.
pid
)
slapgrid
.
wait
()
slapgrid
.
wait
()
stdout
.
seek
(
0
)
stderr
.
seek
(
0
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
process_group_pid_set
.
remove
(
slapgrid
.
pid
)
if
slapgrid
.
returncode
!=
0
:
status_dict
=
{
'status_code'
:
slapgrid
.
returncode
,
raise
ValueError
(
'Slapgrid instance failed'
)
'stdout'
:
stdout
.
read
(),
'stderr'
:
stderr
.
read
()}
stdout
.
close
()
stderr
.
close
()
return
status_dict
slapos/recipe/cloudoootestnode/testnode.py
View file @
63a7d2ec
from
xml_marshaller
import
xml_marshaller
from
xml_marshaller
import
xml_marshaller
import
os
,
xmlrpclib
,
time
,
imp
import
os
,
xmlrpclib
,
time
,
imp
,
re
from
glob
import
glob
from
glob
import
glob
import
signal
import
signal
import
slapos.slap
import
slapos.slap
...
@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
...
@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
time
.
sleep
(
retry
)
time
.
sleep
(
retry
)
retry
+=
retry
>>
1
retry
+=
retry
>>
1
def
getInputOutputFileList
(
config
,
command_name
):
stdout
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_out'
%
command_name
),
'w+'
)
stdout
.
write
(
"%s
\
n
"
%
command_name
)
stderr
=
open
(
os
.
path
.
join
(
config
[
'instance_root'
],
'.%s_err'
%
command_name
),
'w+'
)
return
(
stdout
,
stderr
)
slapos_controler
=
None
slapos_controler
=
None
def
run
(
args
):
def
run
(
args
):
...
@@ -84,11 +94,9 @@ def run(args):
...
@@ -84,11 +94,9 @@ def run(args):
if
profile_content
is
None
:
if
profile_content
is
None
:
profile_content
=
"""
profile_content
=
"""
[buildout]
[buildout]
extends = /home/slap/config/cloudooo.cfg
extends = %(software_config_path)s
"""
"""
%
{
'software_config_path'
:
os
.
path
.
join
(
repository_path
,
#extends = %(software_config_path)s
config
[
'profile_path'
])}
#""" % {'software_config_path': os.path.join(repository_path,
# config['profile_path'])}
if
not
(
buildout_section_id
is
None
):
if
not
(
buildout_section_id
is
None
):
profile_content
+=
"""
\
n
profile_content
+=
"""
\
n
[%(buildout_section_id)s]
[%(buildout_section_id)s]
...
@@ -97,6 +105,7 @@ branch = %(branch)s
...
@@ -97,6 +105,7 @@ branch = %(branch)s
"""
%
{
'buildout_section_id'
:
buildout_section_id
,
"""
%
{
'buildout_section_id'
:
buildout_section_id
,
'repository_path'
:
repository_path
,
'repository_path'
:
repository_path
,
'branch'
:
vcs_repository
.
get
(
'branch'
,
'cloudooo'
)}
'branch'
:
vcs_repository
.
get
(
'branch'
,
'cloudooo'
)}
custom_profile
=
open
(
custom_profile_path
,
'w'
)
custom_profile
=
open
(
custom_profile_path
,
'w'
)
custom_profile
.
write
(
profile_content
)
custom_profile
.
write
(
profile_content
)
custom_profile
.
close
()
custom_profile
.
close
()
...
@@ -139,8 +148,9 @@ branch = %(branch)s
...
@@ -139,8 +148,9 @@ branch = %(branch)s
continue
continue
retry_software
=
False
retry_software
=
False
previous_revision
=
revision
previous_revision
=
revision
# Require build connection for runnig tests
print
config
print
config
# Require build connection for runnig tests
portal_url
=
config
[
'test_suite_master_url'
]
portal_url
=
config
[
'test_suite_master_url'
]
test_result_path
=
None
test_result_path
=
None
test_result
=
(
test_result_path
,
revision
)
test_result
=
(
test_result_path
,
revision
)
...
@@ -168,22 +178,25 @@ branch = %(branch)s
...
@@ -168,22 +178,25 @@ branch = %(branch)s
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
repository_revision
.
split
(
'-'
)[
1
])
revision
=
repository_revision
.
split
(
'-'
)[
1
])
updater
.
checkout
()
updater
.
checkout
()
# Now prepare the installation of SlapOS
# Now prepare the installation of SlapOS
slapos_controler
=
SlapOSControler
(
config
,
slapos_controler
=
SlapOSControler
(
config
,
process_group_pid_set
=
process_group_pid_set
)
process_group_pid_set
=
process_group_pid_set
)
# this should be always true later, but it is too slow for now
for
method_name
in
(
"runSoftwareRelease"
,
"runComputerPartition"
):
status_dict
=
slapos_controler
.
runSoftwareRelease
(
config
,
stdout
,
stderr
=
getInputOutputFileList
(
config
,
method_name
)
config
[
'environment'
],
slapos_method
=
getattr
(
slapos_controler
,
method_name
)
process_group_pid_set
,
status_dict
=
slapos_method
(
config
,
environment
=
config
[
'environment'
],
process_group_pid_set
=
process_group_pid_set
,
stdout
=
stdout
,
stderr
=
stderr
)
)
if
status_dict
[
'status_code'
]
!=
0
:
break
if
status_dict
[
'status_code'
]
!=
0
:
if
status_dict
[
'status_code'
]
!=
0
:
safeRpcCall
(
master
.
reportTaskFailure
,
safeRpcCall
(
master
.
reportTaskFailure
,
test_result_path
,
status_dict
,
config
[
'test_node_title'
])
test_result_path
,
status_dict
,
config
[
'test_node_title'
])
retry_software
=
True
retry_software
=
True
continue
continue
# create instances, it should take some seconds only
slapos_controler
.
runComputerPartition
(
config
,
process_group_pid_set
=
process_group_pid_set
)
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
partition_path
=
os
.
path
.
join
(
config
[
'instance_root'
],
config
[
'partition_reference'
])
config
[
'partition_reference'
])
...
@@ -203,17 +216,33 @@ branch = %(branch)s
...
@@ -203,17 +216,33 @@ branch = %(branch)s
file_object
=
open
(
run_test_suite_path
,
'r'
)
file_object
=
open
(
run_test_suite_path
,
'r'
)
line
=
file_object
.
readline
()
line
=
file_object
.
readline
()
file_object
.
close
()
file_object
.
close
()
# cloudooo_tests = glob(
# '%s/*/src/cloudooo/cloudooo/handler/*/tests/test*.py' %
wait_serve
=
True
# config['software_root'])
while
wait_serve
:
# for test in cloudooo_tests:
try
:
conf
=
open
(
cloudooo_conf
).
read
()
host
,
port
=
re
.
findall
(
'host=*.*.*.*
\
n
port
\
\
=.*'
,
conf
)[
0
].
split
(
'
\
n
'
)
serve
=
xmlrpclib
.
Server
(
"http://%s:%s/RPC2"
%
(
host
.
split
(
'='
)[
-
1
].
lstrip
(),
port
.
split
(
'='
)[
-
1
].
lstrip
()))
serve
.
system
.
listMethods
()
if
len
(
serve
.
system
.
listMethods
())
>
0
:
wait_serve
=
False
except
socket
.
error
,
e
:
wait_serve
=
True
time
.
sleep
(
10
)
cloudooo_tests
=
glob
(
'%s/*/src/cloudooo/cloudooo/handler/*/tests/test*.py'
%
config
[
'software_root'
])
for
test
in
cloudooo_tests
:
invocation_list
=
[]
invocation_list
=
[]
if
line
[:
2
]
==
'#!'
:
if
line
[:
2
]
==
'#!'
:
invocation_list
=
line
[
2
:].
split
()
invocation_list
=
line
[
2
:].
split
()
invocation_list
.
extend
([
run_test_suite_path
,
invocation_list
.
extend
([
run_test_suite_path
,
'--paster_path'
,
cloudooo_paster
,
'--paster_path'
,
cloudooo_paster
,
cloudooo_conf
,
cloudooo_conf
,
'testFfmpegServer'
])
test
.
split
(
'/'
)[
-
1
]
])
run_test_suite
=
subprocess
.
Popen
(
invocation_list
)
run_test_suite
=
subprocess
.
Popen
(
invocation_list
)
process_group_pid_set
.
add
(
run_test_suite
.
pid
)
process_group_pid_set
.
add
(
run_test_suite
.
pid
)
run_test_suite
.
wait
()
run_test_suite
.
wait
()
...
...
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