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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kwabena Antwi-Boasiako
slapos
Commits
fb52bb07
Commit
fb52bb07
authored
Sep 14, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve boinc update recipe
parent
f5e4f5b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
18 deletions
+67
-18
setup.py
setup.py
+2
-2
slapos/recipe/boinc/__init__.py
slapos/recipe/boinc/__init__.py
+36
-11
slapos/recipe/boinc/configure.py
slapos/recipe/boinc/configure.py
+29
-5
No files found.
setup.py
View file @
fb52bb07
...
...
@@ -45,7 +45,7 @@ setup(name=name,
'apachephp = slapos.recipe.apachephp:Recipe'
,
'apacheproxy = slapos.recipe.apacheproxy:Recipe'
,
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe'
,
'boinc = slapos.recipe.boinc:Recipe'
,
'boinc = slapos.recipe.boinc:Recipe'
,
'boinc.app = slapos.recipe.boinc:App'
,
'boinc.client = slapos.recipe.boinc:Client'
,
'certificate_authority.request = slapos.recipe.certificate_authority:Request'
,
...
...
@@ -55,7 +55,7 @@ setup(name=name,
'check_page_content = slapos.recipe.check_page_content:Recipe'
,
'cloud9 = slapos.recipe.cloud9:Recipe'
,
'cloudooo.test = slapos.recipe.erp5_test:CloudoooRecipe'
,
'condor = slapos.recipe.condor:Recipe'
,
'condor = slapos.recipe.condor:Recipe'
,
'cron.d = slapos.recipe.dcron:Part'
,
'cron = slapos.recipe.dcron:Recipe'
,
'davstorage = slapos.recipe.davstorage:Recipe'
,
...
...
slapos/recipe/boinc/__init__.py
View file @
fb52bb07
...
...
@@ -84,6 +84,23 @@ class Recipe(GenericBaseRecipe):
self
.
mysqlhost
=
options
[
'mysql-host'
].
strip
()
self
.
mysqlport
=
options
[
'mysql-port'
].
strip
()
def
haschanges
(
self
):
config_file
=
os
.
path
.
join
(
self
.
home
,
'.config'
)
current
=
[
self
.
fullname
,
self
.
copyright
,
self
.
port
,
self
.
password
,
self
.
mysqlhost
,
self
.
installroot
,
self
.
project
,
self
.
passwd
,
self
.
ipv6
]
previous
=
[]
result
=
False
if
os
.
path
.
exists
(
config_file
):
previous
=
open
(
config_file
,
'r'
).
read
().
split
(
'#'
)
#Check if config has changed
if
len
(
current
)
!=
len
(
set
(
current
).
intersection
(
set
(
previous
)))
or
\
not
os
.
path
.
exists
(
self
.
installroot
)
or
\
not
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
home
,
'.start_service'
)):
result
=
True
open
(
config_file
,
'w'
).
write
(
'#'
.
join
(
current
))
return
result
def
install
(
self
):
path_list
=
[]
make_project
=
os
.
path
.
join
(
self
.
package
,
'bin/make_project'
)
...
...
@@ -157,12 +174,19 @@ class Recipe(GenericBaseRecipe):
)
# Generate make project wrapper file
readme_file
=
os
.
path
.
join
(
self
.
installroot
,
self
.
project
+
'.readme'
)
launch_args
=
[
make_project
,
'--url_base'
,
url_base
,
"--db_name"
,
self
.
database
,
"--db_user"
,
self
.
username
,
"--db_passwd"
,
self
.
password
,
"--project_root"
,
self
.
installroot
,
"--db_host"
,
self
.
mysqlhost
,
"--user_name"
,
slapuser
,
"--srcdir"
,
self
.
sourcedir
,
"--no_query"
,
"--delete_prev_inst"
,
"--drop_db_first"
,
self
.
project
,
niceprojectname
]
self
.
sourcedir
,
"--no_query"
]
drop_install
=
self
.
haschanges
()
if
drop_install
:
#Allow to restart Boinc installation from the begining
launch_args
+=
[
"--delete_prev_inst"
,
"--drop_db_first"
]
if
os
.
path
.
exists
(
readme_file
):
os
.
unlink
(
readme_file
)
launch_args
+=
[
self
.
project
,
niceprojectname
]
install_wrapper
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'make_project'
),
...
...
@@ -173,11 +197,6 @@ class Recipe(GenericBaseRecipe):
#After make_project run configure_script to perform and restart apache php services
service_status
=
os
.
path
.
join
(
self
.
home
,
'.start_service'
)
readme_file
=
os
.
path
.
join
(
self
.
installroot
,
self
.
project
+
'.readme'
)
if
os
.
path
.
exists
(
readme_file
):
os
.
unlink
(
readme_file
)
if
os
.
path
.
exists
(
service_status
):
os
.
unlink
(
service_status
)
parameter
=
dict
(
readme
=
readme_file
,
htpasswd
=
self
.
htpasswd
,
...
...
@@ -189,7 +208,8 @@ class Recipe(GenericBaseRecipe):
service_status
=
service_status
,
project
=
niceprojectname
,
fullname
=
self
.
fullname
,
copyright
=
self
.
copyright
copyright
=
self
.
copyright
,
drop_install
=
drop_install
)
start_service
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'config_project'
),
...
...
@@ -199,10 +219,15 @@ class Recipe(GenericBaseRecipe):
#Generate Boinc start project wrapper
start_args
=
[
os
.
path
.
join
(
self
.
installroot
,
'bin/start'
)]
boinc_parameter
=
dict
(
service_status
=
service_status
,
installroot
=
self
.
installroot
,
drop_install
=
drop_install
,
mysql_port
=
self
.
mysqlport
,
mysql_host
=
self
.
mysqlhost
,
mysql_user
=
self
.
username
,
mysql_password
=
self
.
password
,
database
=
self
.
database
,
python_path
=
python_path
)
start_wrapper
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'start_
project
'
),
'
slapos.recipe.librecipe.execute.executee_wait'
,
(
start_args
,
[
service_status
],
environment
)
'start_
boinc
'
),
'
%s.configure.restart_boinc'
%
__name__
,
boinc_parameter
)
path_list
.
append
(
start_wrapper
)
...
...
slapos/recipe/boinc/configure.py
View file @
fb52bb07
...
...
@@ -44,9 +44,10 @@ def checkMysql(args):
db
=
args
[
'database'
])
conn
.
close
()
print
"Successfully connect to MySQL database... "
file
=
open
(
args
[
'file_status'
],
'w'
)
file
.
write
(
"starting"
)
file
.
close
()
if
args
.
has_key
(
'file_status'
):
file
=
open
(
args
[
'file_status'
],
'w'
)
file
.
write
(
"starting"
)
file
.
close
()
break
except
Exception
,
ex
:
print
"The result is:
\
n
"
+
ex
.
message
...
...
@@ -55,6 +56,11 @@ def checkMysql(args):
def
services
(
args
):
"""This function configure a new installed boinc project instance"""
print
"Checking if needed to install or reinstall Boinc-server..."
if
not
args
[
'drop_install'
]:
print
"Not need to install Boinc-server...skipped"
return
#Sleep until file 'boinc_project'.readme exist
while
True
:
print
"Search for file %s..."
%
args
[
'readme'
]
...
...
@@ -122,6 +128,25 @@ def services(args):
status
.
write
(
"started"
)
status
.
close
()
def
restart_boinc
(
args
):
"""Stop (if currently is running state) and start all Boinc service"""
if
args
[
'drop_install'
]:
while
True
:
print
"Search for file %s..."
%
args
[
'service_status'
]
if
not
os
.
path
.
exists
(
args
[
'service_status'
]):
print
"File not found... sleep for 3 secondes"
time
.
sleep
(
3
)
else
:
break
else
:
checkMysql
(
args
)
print
"Restart Boinc..."
binstart
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/start'
)
binstop
=
os
.
path
.
join
(
args
[
'installroot'
],
'bin/stop'
)
os
.
system
(
binstop
)
os
.
system
(
binstart
)
print
"Done."
def
deployApp
(
args
):
print
"Cheking if needed to install %s..."
%
args
[
'appname'
]
if
os
.
path
.
exists
(
os
.
path
.
join
(
args
[
'installroot'
],
"."
+
args
[
'appname'
])):
...
...
@@ -235,7 +260,6 @@ def create_wu(args, env):
process
=
subprocess
.
Popen
(
launch_args
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
env
=
env
,
cwd
=
args
[
'installroot'
])
result
=
process
.
communicate
()[
0
]
print
"Result for workunit num %
\
n
%s"
(
str
(
i
+
1
),
result
)
process
.
communicate
()[
0
]
\ No newline at end of file
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