Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
59ee2f81
Commit
59ee2f81
authored
Oct 10, 2018
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
6ac517c1
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
81 additions
and
68 deletions
+81
-68
slapos/recipe/apachephpconfigure/__init__.py
slapos/recipe/apachephpconfigure/__init__.py
+6
-4
slapos/recipe/boinc/__init__.py
slapos/recipe/boinc/__init__.py
+8
-6
slapos/recipe/bonjourgrid/__init__.py
slapos/recipe/bonjourgrid/__init__.py
+1
-1
slapos/recipe/certificate_authority/__init__.py
slapos/recipe/certificate_authority/__init__.py
+3
-3
slapos/recipe/certificate_authority/certificate_authority.py
slapos/recipe/certificate_authority/certificate_authority.py
+5
-3
slapos/recipe/condor/__init__.py
slapos/recipe/condor/__init__.py
+7
-8
slapos/recipe/davstorage/__init__.py
slapos/recipe/davstorage/__init__.py
+1
-1
slapos/recipe/dcron.py
slapos/recipe/dcron.py
+3
-1
slapos/recipe/erp5_promise/__init__.py
slapos/recipe/erp5_promise/__init__.py
+2
-2
slapos/recipe/erp5testnode/__init__.py
slapos/recipe/erp5testnode/__init__.py
+4
-4
slapos/recipe/free_port.py
slapos/recipe/free_port.py
+3
-3
slapos/recipe/lamp/__init__.py
slapos/recipe/lamp/__init__.py
+2
-2
slapos/recipe/libcloud/__init__.py
slapos/recipe/libcloud/__init__.py
+1
-1
slapos/recipe/librecipe/execute.py
slapos/recipe/librecipe/execute.py
+7
-3
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+6
-5
slapos/recipe/nosqltestbed/__init__.py
slapos/recipe/nosqltestbed/__init__.py
+3
-1
slapos/recipe/pbs.py
slapos/recipe/pbs.py
+5
-3
slapos/recipe/postgres/__init__.py
slapos/recipe/postgres/__init__.py
+2
-2
slapos/recipe/redis/__init__.py
slapos/recipe/redis/__init__.py
+1
-1
slapos/recipe/request.py
slapos/recipe/request.py
+6
-4
slapos/recipe/sheepdogtestbed/__init__.py
slapos/recipe/sheepdogtestbed/__init__.py
+0
-2
slapos/recipe/stunnel/__init__.py
slapos/recipe/stunnel/__init__.py
+1
-1
slapos/recipe/xwiki/__init__.py
slapos/recipe/xwiki/__init__.py
+1
-1
slapos/recipe/zabbixagent/__init__.py
slapos/recipe/zabbixagent/__init__.py
+0
-1
slapos/test/recipe/test_pbs.py
slapos/test/recipe/test_pbs.py
+2
-2
slapos/test/utils.py
slapos/test/utils.py
+1
-1
software/slapos-testing/software-py3.cfg
software/slapos-testing/software-py3.cfg
+0
-2
No files found.
slapos/recipe/apachephpconfigure/__init__.py
View file @
59ee2f81
...
...
@@ -24,6 +24,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
__future__
import
print_function
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
zc.buildout
import
sys
...
...
@@ -101,17 +103,17 @@ class Recipe(GenericBaseRecipe):
# TODO factor
if
delete
!=
[]:
print
"Creating lampconfigure with 'delete' arguments"
print
(
"Creating lampconfigure with 'delete' arguments"
)
command
=
argument
+
delete
if
rename
!=
[]:
for
parameters
in
rename
:
print
"Creating lampconfigure with 'rename' arguments"
print
(
"Creating lampconfigure with 'rename' arguments"
)
command
=
argument
+
rename
if
chmod
!=
[]:
print
"Creating lampconfigure with 'chmod' arguments"
print
(
"Creating lampconfigure with 'chmod' arguments"
)
command
=
argument
+
chmod
if
data
!=
[]:
print
"Creating lampconfigure with 'run' arguments"
print
(
"Creating lampconfigure with 'run' arguments"
)
command
=
argument
+
data
...
...
slapos/recipe/boinc/__init__.py
View file @
59ee2f81
...
...
@@ -24,6 +24,8 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
__future__
import
print_function
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
os
import
subprocess
...
...
@@ -177,7 +179,7 @@ class Recipe(GenericBaseRecipe):
copyright
=
self
.
copyright
,
installroot
=
self
.
installroot
))
)
path_list
.
append
(
sh_script
)
os
.
chmod
(
bash
,
0700
)
os
.
chmod
(
bash
,
0
o
700
)
#After make_project run configure_script to perform and restart apache php services
service_status
=
os
.
path
.
join
(
self
.
home
,
'.start_service'
)
...
...
@@ -234,9 +236,9 @@ class App(GenericBaseRecipe):
downloader
=
zc
.
buildout
.
download
.
Download
(
self
.
buildout
[
'buildout'
],
hash_name
=
True
,
cache
=
cache
)
path
,
_
=
downloader
(
param
,
md5sum
=
None
)
mode
=
0600
mode
=
0
o
600
if
key
==
'binary'
:
mode
=
0700
mode
=
0
o
700
os
.
chmod
(
path
,
mode
)
app
[
key
]
=
path
...
...
@@ -278,7 +280,7 @@ class App(GenericBaseRecipe):
if
not
current_app
[
'template-result'
]
or
not
current_app
[
'binary'
]
\
or
not
current_app
[
'input-file'
]
or
not
current_app
[
'template-wu'
]
\
or
not
current_app
[
'platform'
]:
print
"BOINC-APP: ERROR - Invalid argements values for % ...operation cancelled"
%
app
print
(
"BOINC-APP: ERROR - Invalid argements values for % ...operation cancelled"
%
app
)
app_list
[
app
][
version
]
=
None
continue
#write application to install
...
...
@@ -319,7 +321,7 @@ class App(GenericBaseRecipe):
dict
(
dash
=
self
.
options
[
'dash'
].
strip
()))
)
path_list
.
append
(
sh_script
)
os
.
chmod
(
bash
,
0700
)
os
.
chmod
(
bash
,
0
o
700
)
#If useful, download necessary files and update options path
start_boinc
=
os
.
path
.
join
(
home
,
'.start_boinc'
)
...
...
@@ -339,7 +341,7 @@ class App(GenericBaseRecipe):
platform
=
app_list
[
appname
][
version
][
'platform'
]
application
=
os
.
path
.
join
(
apps_dir
,
appname
,
version
,
platform
)
if
app_list
[
appname
][
version
][
'binary'
]
and
not
platform
:
print
"BOINC-APP: WARNING - Cannot specify binary without giving platform value"
print
(
"BOINC-APP: WARNING - Cannot specify binary without giving platform value"
)
app_list
[
appname
][
version
][
'binary'
]
=
''
#Binary will not be updated
parameter
=
dict
(
installroot
=
installroot
,
...
...
slapos/recipe/bonjourgrid/__init__.py
View file @
59ee2f81
...
...
@@ -94,7 +94,7 @@ class Recipe(GenericBaseRecipe):
dict
(
ip_address
=
self
.
options
[
'ipv6'
].
strip
(),
project
=
project
,
middleware
=
type
)))
os
.
chmod
(
config_info_file
,
0744
)
os
.
chmod
(
config_info_file
,
0
o
744
)
path_list
.
append
(
config_info
)
update
=
install
...
...
slapos/recipe/certificate_authority/__init__.py
View file @
59ee2f81
...
...
@@ -26,11 +26,11 @@
##############################################################################
import
os
import
hashlib
import
ConfigP
arser
from
six.moves
import
configp
arser
import
tempfile
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
certificate_authority
import
popenCommunicate
from
.
certificate_authority
import
popenCommunicate
class
Recipe
(
GenericBaseRecipe
):
...
...
@@ -119,7 +119,7 @@ class Request(Recipe):
open
(
certificate
,
'w'
).
write
(
cert_content
)
request_needed
=
False
else
:
parser
=
ConfigP
arser
.
RawConfigParser
()
parser
=
configp
arser
.
RawConfigParser
()
parser
.
add_section
(
'certificate'
)
parser
.
set
(
'certificate'
,
'name'
,
name
)
parser
.
set
(
'certificate'
,
'key_file'
,
key
)
...
...
slapos/recipe/certificate_authority/certificate_authority.py
View file @
59ee2f81
from
__future__
import
print_function
import
os
import
subprocess
import
time
import
ConfigP
arser
from
six.moves
import
configp
arser
import
uuid
...
...
@@ -95,12 +97,12 @@ class CertificateAuthority:
def
checkRequestDir
(
self
):
for
request_file
in
os
.
listdir
(
self
.
request_dir
):
parser
=
ConfigP
arser
.
RawConfigParser
()
parser
=
configp
arser
.
RawConfigParser
()
parser
.
readfp
(
open
(
os
.
path
.
join
(
self
.
request_dir
,
request_file
),
'r'
))
if
self
.
_checkCertificate
(
parser
.
get
(
'certificate'
,
'name'
),
parser
.
get
(
'certificate'
,
'key_file'
),
parser
.
get
(
'certificate'
,
'certificate_file'
)):
print
'Created certificate %r'
%
parser
.
get
(
'certificate'
,
'name'
)
print
(
'Created certificate %r'
%
parser
.
get
(
'certificate'
,
'name'
)
)
def
runCertificateAuthority
(
*
args
):
ca
=
CertificateAuthority
(
*
args
)
...
...
slapos/recipe/condor/__init__.py
View file @
59ee2f81
...
...
@@ -29,7 +29,6 @@ import os
import
subprocess
import
zc.buildout
import
filecmp
import
urlparse
import
shutil
import
re
import
json
...
...
@@ -130,9 +129,9 @@ class Recipe(GenericBaseRecipe):
#create condor binary launcher for slapos
if
not
os
.
path
.
exists
(
self
.
wrapper_bin
):
os
.
makedirs
(
self
.
wrapper_bin
,
int
(
'0744'
,
8
))
os
.
makedirs
(
self
.
wrapper_bin
,
int
(
'0
o
744'
,
8
))
if
not
os
.
path
.
exists
(
self
.
wrapper_sbin
):
os
.
makedirs
(
self
.
wrapper_sbin
,
int
(
'0744'
,
8
))
os
.
makedirs
(
self
.
wrapper_sbin
,
int
(
'0
o
744'
,
8
))
#generate script for each file in prefix/bin
for
binary
in
os
.
listdir
(
self
.
prefix
+
'/bin'
):
wrapper_location
=
os
.
path
.
join
(
self
.
wrapper_bin
,
binary
)
...
...
@@ -153,7 +152,7 @@ class Recipe(GenericBaseRecipe):
wrapper
.
write
(
content
)
wrapper
.
close
()
path_list
.
append
(
wrapper_location
)
os
.
chmod
(
wrapper_location
,
0744
)
os
.
chmod
(
wrapper_location
,
0
o
744
)
#generate script for each file in prefix/sbin
for
binary
in
os
.
listdir
(
self
.
prefix
+
'/sbin'
):
...
...
@@ -175,7 +174,7 @@ class Recipe(GenericBaseRecipe):
wrapper
.
write
(
content
)
wrapper
.
close
()
path_list
.
append
(
wrapper_location
)
os
.
chmod
(
wrapper_location
,
0744
)
os
.
chmod
(
wrapper_location
,
0
o
744
)
#generate script for start condor
wrapper
=
self
.
createPythonScript
(
...
...
@@ -228,7 +227,7 @@ class AppSubmit(GenericBaseRecipe):
for
file
in
file_list
:
if
file
and
(
file
.
startswith
(
'http'
)
or
file
.
startswith
(
'ftp'
)):
file_list
[
file
]
=
self
.
download
(
file_list
[
file
])
os
.
chmod
(
file_list
[
file
],
0600
)
os
.
chmod
(
file_list
[
file
],
0
o
600
)
else
:
app_list
[
app
][
'files'
]
=
{}
...
...
@@ -236,11 +235,11 @@ class AppSubmit(GenericBaseRecipe):
if
executable
and
(
executable
.
startswith
(
'http'
)
or
executable
.
startswith
(
'ftp'
)):
app_list
[
app
][
'executable'
]
=
self
.
download
(
executable
,
app_list
[
app
][
'executable-name'
])
os
.
chmod
(
app_list
[
app
][
'executable-name'
],
0700
)
os
.
chmod
(
app_list
[
app
][
'executable-name'
],
0
o
700
)
submit_file
=
app_list
[
app
].
get
(
'description-file'
,
''
)
if
submit_file
and
(
submit_file
.
startswith
(
'http'
)
or
submit_file
.
startswith
(
'ftp'
)):
app_list
[
app
][
'description-file'
]
=
self
.
download
(
submit_file
,
'submit'
)
os
.
chmod
(
app_list
[
app
][
'description-file'
],
0600
)
os
.
chmod
(
app_list
[
app
][
'description-file'
],
0
o
600
)
return
app_list
...
...
slapos/recipe/davstorage/__init__.py
View file @
59ee2f81
...
...
@@ -25,7 +25,7 @@
#
##############################################################################
import
subprocess
import
httplib
from
six.moves
import
http_client
as
httplib
import
base64
import
os
import
shutil
...
...
slapos/recipe/dcron.py
View file @
59ee2f81
...
...
@@ -29,6 +29,8 @@ import os
from
slapos.recipe.librecipe
import
GenericBaseRecipe
from
zc.buildout
import
UserError
from
six.moves
import
map
class
Recipe
(
GenericBaseRecipe
):
def
install
(
self
):
...
...
@@ -124,7 +126,7 @@ def systemd_to_cron(spec):
x
=
spec
[
i
]
if
x
!=
'*'
:
for
x
in
x
.
split
(
','
):
x
=
map
(
int
,
x
.
split
(
'/'
,
1
))
x
=
list
(
map
(
int
,
x
.
split
(
'/'
,
1
)
))
a
=
x
[
0
]
-
y
if
0
<=
a
<
z
:
if
len
(
x
)
==
1
:
...
...
slapos/recipe/erp5_promise/__init__.py
View file @
59ee2f81
...
...
@@ -26,7 +26,7 @@
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
ConfigP
arser
from
six.moves
import
configp
arser
class
Recipe
(
GenericBaseRecipe
):
"""
...
...
@@ -34,7 +34,7 @@ class Recipe(GenericBaseRecipe):
"""
def
install
(
self
):
promise_parser
=
ConfigP
arser
.
RawConfigParser
()
promise_parser
=
configp
arser
.
RawConfigParser
()
for
section_name
,
option_id_list
in
(
(
'portal_templates'
,
(
(
'repository'
,
'bt5-repository-url'
),
...
...
slapos/recipe/erp5testnode/__init__.py
View file @
59ee2f81
...
...
@@ -24,10 +24,10 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import
ConfigP
arser
from
six.moves
import
configp
arser
import
json
import
os
import
StringIO
import
six
from
slapos.recipe.librecipe
import
GenericBaseRecipe
...
...
@@ -40,13 +40,13 @@ class Recipe(GenericBaseRecipe):
CONFIG
[
'PATH'
]
=
os
.
environ
[
'PATH'
]
if
self
.
options
[
'instance-dict'
]:
config_instance_dict
=
ConfigP
arser
.
ConfigParser
()
config_instance_dict
=
configp
arser
.
ConfigParser
()
config_instance_dict
.
add_section
(
'instance_dict'
)
instance_dict
=
json
.
loads
(
self
.
options
[
'instance-dict'
])
for
k
,
v
in
instance_dict
.
iteritems
():
config_instance_dict
.
set
(
'instance_dict'
,
k
,
v
)
value
=
StringIO
.
StringIO
()
value
=
six
.
StringIO
()
config_instance_dict
.
write
(
value
)
CONFIG
[
'instance_dict'
]
=
value
.
getvalue
()
...
...
slapos/recipe/free_port.py
View file @
59ee2f81
...
...
@@ -25,7 +25,7 @@
#
##############################################################################
import
ConfigP
arser
from
six.moves
import
configp
arser
import
os
import
netaddr
import
socket
...
...
@@ -48,7 +48,7 @@ class Recipe(object):
# If this check isn't done, a new port would be picked for every upgrade
# of the software release
try
:
parser
=
ConfigPa
rser
.
RawConfigParser
()
parser
=
configPp
rser
.
RawConfigParser
()
if
os
.
path
.
exists
(
buildout
[
'buildout'
][
'installed'
]):
with
open
(
buildout
[
'buildout'
][
'installed'
])
as
config_file
:
parser
.
readfp
(
config_file
)
...
...
@@ -59,7 +59,7 @@ class Recipe(object):
if
port
!=
'0'
:
self
.
options
[
'port'
]
=
port
return
except
(
IOError
,
ConfigParser
.
NoSectionError
,
ConfigP
arser
.
NoOptionError
):
except
(
IOError
,
configparser
.
NoSectionError
,
configp
arser
.
NoOptionError
):
pass
# Otherwise, let's find one
...
...
slapos/recipe/lamp/__init__.py
View file @
59ee2f81
...
...
@@ -31,7 +31,7 @@ import pkg_resources
import
zc.buildout
import
sys
import
zc.recipe.egg
import
url
parse
from
six.moves.urllib
import
parse
# Warning : this recipe is deprecated and has been replaced by apachephp.
...
...
@@ -264,7 +264,7 @@ class Request(BaseRecipe):
mysql
=
self
.
request
(
self
.
options
[
'mariadb-software-url'
],
software_type
,
'MariaDB Server'
,
partition_parameter_kw
=
parameters
).
getConnectionParameter
(
'url'
)
mysql_parsed
=
url
parse
.
urlparse
(
mysql
)
mysql_parsed
=
parse
.
urlparse
(
mysql
)
mysql_host
,
mysql_port
=
mysql_parsed
.
hostname
,
mysql_parsed
.
port
if
mysql_parsed
.
scheme
==
'mysqls'
:
# Listen over stunnel
...
...
slapos/recipe/libcloud/__init__.py
View file @
59ee2f81
...
...
@@ -57,7 +57,7 @@ class Recipe(BaseSlapRecipe):
try
:
self
.
slave_partition_configuration_dict_list
.
append
(
self
.
_installSlavePartition
(
slave_partition
))
except
SlavePartitionError
,
e
:
except
SlavePartitionError
as
e
:
self
.
logger
.
warning
(
'Slave Parttion %r not installed, issue: %r'
%
(
slave_partition
.
getId
(),
e
))
# Installs wrappers
...
...
slapos/recipe/librecipe/execute.py
View file @
59ee2f81
from
__future__
import
print_function
import
sys
import
os
import
signal
...
...
@@ -5,6 +7,8 @@ import subprocess
from
collections
import
defaultdict
from
inotify_simple
import
INotify
,
flags
import
six
def
_wait_files_creation
(
file_list
):
# Establish a list of directory and subfiles.
# and test existence before watching, so that we don't miss an event.
...
...
@@ -14,7 +18,7 @@ def _wait_files_creation(file_list):
directories
[
dirname
][
filename
]
=
os
.
path
.
lexists
(
f
)
def
all_files_exists
():
return
all
(
all
(
files
.
itervalues
())
for
files
in
directories
.
itervalues
(
))
return
all
(
all
(
six
.
itervalues
(
files
))
for
files
in
six
.
itervalues
(
directories
))
with
INotify
()
as
inotify
:
watchdescriptors
=
{
inotify
.
add_watch
(
dirname
,
...
...
@@ -101,7 +105,7 @@ def generic_exec(args, extra_environ=None, wait_list=None,
child_pg
=
None
def
sig_handler
(
sig
,
frame
):
print
'Received signal %r, killing children and exiting'
%
sig
print
(
'Received signal %r, killing children and exiting'
%
sig
)
if
child_pg
is
not
None
:
os
.
killpg
(
child_pg
,
signal
.
SIGHUP
)
os
.
killpg
(
child_pg
,
signal
.
SIGTERM
)
...
...
@@ -116,7 +120,7 @@ def execute_with_signal_translation(args):
child
=
subprocess
.
Popen
(
args
,
close_fds
=
True
,
preexec_fn
=
os
.
setsid
)
child_pg
=
child
.
pid
try
:
print
'Process %r started'
%
(
args
,
)
print
(
'Process %r started'
%
(
args
,
)
)
signal
.
pause
()
finally
:
os
.
killpg
(
child_pg
,
signal
.
SIGHUP
)
...
...
slapos/recipe/librecipe/generic.py
View file @
59ee2f81
...
...
@@ -34,7 +34,8 @@ import inspect
import
re
import
shutil
import
urllib
from
six
import
iteritems
import
itertools
import
six
from
six.moves
import
map
from
six.moves.urllib
import
parse
...
...
@@ -131,9 +132,9 @@ class GenericBaseRecipe(object):
module
,
function
=
function
path
,
filename
=
os
.
path
.
split
(
os
.
path
.
abspath
(
name
))
assert
not
isinstance
(
args
,
(
basestring
,
dict
)),
args
args
=
map
(
repr
,
args
)
args
+=
map
(
'%s=%r'
.
__mod__
,
kw
.
iteritems
(
))
assert
not
isinstance
(
args
,
(
six
.
string_types
,
dict
)),
args
args
=
itertools
.
chain
(
map
(
repr
,
args
),
map
(
'%s=%r'
.
__mod__
,
six
.
iteritems
(
kw
)
))
return
zc
.
buildout
.
easy_install
.
scripts
(
[(
filename
,
module
,
function
)],
self
.
_ws
,
sys
.
executable
,
...
...
@@ -156,7 +157,7 @@ class GenericBaseRecipe(object):
lines
=
[
'#!/bin/sh'
]
if
env
:
for
k
,
v
in
sorted
(
iteritems
(
env
)):
for
k
,
v
in
sorted
(
six
.
iteritems
(
env
)):
lines
.
append
(
'export %s=%s'
%
(
k
,
shlex
.
quote
(
v
)))
lines
.
append
(
'exec'
)
...
...
slapos/recipe/nosqltestbed/__init__.py
View file @
59ee2f81
...
...
@@ -25,6 +25,8 @@
#
##############################################################################
from
__future__
import
print_function
import
sys
import
pkg_resources
from
logging
import
Formatter
...
...
@@ -41,7 +43,7 @@ class NoSQLTestBed(BaseSlapRecipe):
testbed
=
plugin_class
()
except
:
print
Formatter
().
formatException
(
sys
.
exc_info
(
))
print
(
Formatter
().
formatException
(
sys
.
exc_info
()
))
return
None
software_type
=
self
.
parameter_dict
.
get
(
'slap_software_type'
,
'default'
)
...
...
slapos/recipe/pbs.py
View file @
59ee2f81
...
...
@@ -25,12 +25,14 @@
#
##############################################################################
from
__future__
import
print_function
import
json
import
os
import
subprocess
import
sys
import
textwrap
import
url
parse
from
six.moves.urllib
import
parse
from
slapos.recipe.librecipe
import
GenericSlapRecipe
from
slapos.recipe.dropbear
import
KnownHostsFile
...
...
@@ -208,7 +210,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
# This behavior has been removed to accelerate deployment of the
# Software Release. The buildout, instead of failing, can process
# other sections, which will return parameters to the main instance faster
parsed_url
=
url
parse
.
urlparse
(
url
)
parsed_url
=
parse
.
urlparse
(
url
)
slave_type
=
entry
[
'type'
]
if
not
slave_type
in
[
'pull'
,
'push'
]:
...
...
@@ -216,7 +218,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
slave_id
=
entry
[
'notification-id'
]
print
'Processing PBS slave %s with type %s'
%
(
slave_id
,
slave_type
)
print
(
'Processing PBS slave %s with type %s'
%
(
slave_id
,
slave_type
)
)
path_list
.
append
(
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
options
[
'promises-directory'
],
"ssh-to-%s"
%
slave_id
),
...
...
slapos/recipe/postgres/__init__.py
View file @
59ee2f81
...
...
@@ -25,7 +25,7 @@
#
##############################################################################
import
md5
import
hashlib
import
os
import
subprocess
import
textwrap
...
...
@@ -195,7 +195,7 @@ class Recipe(GenericBaseRecipe):
password
=
self
.
options
[
'password'
]
# encrypt the password to avoid storing in the logs
enc_password
=
'md5'
+
md5
.
md5
(
password
+
user
).
hexdigest
()
enc_password
=
'md5'
+
hashlib
.
md5
(
password
+
user
).
hexdigest
()
self
.
runPostgresCommand
(
cmd
=
"""ALTER USER "%s" ENCRYPTED PASSWORD '%s'"""
%
(
user
,
enc_password
))
...
...
slapos/recipe/redis/__init__.py
View file @
59ee2f81
...
...
@@ -81,5 +81,5 @@ def promise(host, port, unixsocket):
r
=
Redis
(
host
=
host
,
port
=
port
,
unix_socket_path
=
unixsocket
,
db
=
0
)
r
.
publish
(
"Promise-Service"
,
"SlapOS Promise"
)
r
.
connection_pool
.
disconnect
()
except
Exception
,
e
:
except
Exception
as
e
:
sys
.
exit
(
e
)
slapos/recipe/request.py
View file @
59ee2f81
...
...
@@ -33,6 +33,8 @@ from slapos.slap import SoftwareProductCollection
import
slapos.recipe.librecipe.generic
as
librecipe
import
traceback
import
six
SOFTWARE_PRODUCT_NAMESPACE
=
"product."
DEFAULT_SOFTWARE_TYPE
=
'RootSoftwareInstance'
...
...
@@ -110,10 +112,10 @@ class Recipe(object):
raise
UserError
(
"'config' & 'sla' options are obsolete."
" Clean up your software release."
)
filter_kw
=
{
k
[
4
:]:
v
for
k
,
v
in
options
.
iteritems
(
)
for
k
,
v
in
six
.
iteritems
(
options
)
if
k
.
startswith
(
'sla-'
)
and
v
}
partition_parameter_kw
=
self
.
_filterForStorage
({
k
[
7
:]:
v
for
k
,
v
in
options
.
iteritems
(
)
for
k
,
v
in
six
.
iteritems
(
options
)
if
k
.
startswith
(
'config-'
)})
slave
=
options
.
get
(
'slave'
,
'false'
).
lower
()
in
\
librecipe
.
GenericBaseRecipe
.
TRUE_VALUES
...
...
@@ -307,12 +309,12 @@ class RequestEdge(Recipe):
self
.
request_dict
[
country
]
=
Recipe
(
buildout
,
name
,
local_options
)
# "Bubble" all connection parameters
for
option
,
value
in
local_options
.
iteritems
(
):
for
option
,
value
in
six
.
iteritems
(
local_options
):
if
option
.
startswith
(
CONNECTION_PARAMETER_STRING
):
self
.
options
[
'%s-%s'
%
(
option
,
country
)]
=
value
def
install
(
self
):
for
country
,
request
in
s
elf
.
request_dict
.
iteritems
(
):
for
country
,
request
in
s
ix
.
iteritems
(
self
.
request_dict
):
request
.
install
()
return
[]
...
...
slapos/recipe/sheepdogtestbed/__init__.py
View file @
59ee2f81
...
...
@@ -26,8 +26,6 @@
##############################################################################
import
os
import
urllib
import
urllib2
import
pkg_resources
from
slapos.recipe.librecipe
import
BaseSlapRecipe
...
...
slapos/recipe/stunnel/__init__.py
View file @
59ee2f81
...
...
@@ -36,7 +36,7 @@ def kill(pid_file, sig=signal.SIGUSR1):
pid
=
int
(
f
.
read
().
strip
())
try
:
os
.
kill
(
pid
,
sig
)
except
OSError
,
e
:
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
ESRCH
:
# No such process
raise
e
os
.
unlink
(
pid_file
)
...
...
slapos/recipe/xwiki/__init__.py
View file @
59ee2f81
...
...
@@ -69,7 +69,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"
bindir
=
os
.
path
.
join
(
tomcat_home
,
'bin'
)
for
f
in
os
.
listdir
(
bindir
):
if
f
.
endswith
(
'.sh'
):
os
.
chmod
(
os
.
path
.
join
(
bindir
,
f
),
0755
)
os
.
chmod
(
os
.
path
.
join
(
bindir
,
f
),
0
o
755
)
tomcat_wrapper
=
self
.
createRunningWrapper
(
'xwiki'
,
"""#!/bin/sh
export JRE_HOME=%(java_home)s
exec %(catalina)s run
...
...
slapos/recipe/zabbixagent/__init__.py
View file @
59ee2f81
...
...
@@ -33,7 +33,6 @@ import hashlib
import
sys
import
zc.buildout
import
zc.recipe.egg
import
ConfigParser
class
Recipe
(
BaseSlapRecipe
):
def
installLogrotate
(
self
):
...
...
slapos/test/recipe/test_pbs.py
View file @
59ee2f81
...
...
@@ -22,7 +22,7 @@ class PBSTest(unittest.TestCase):
def
test_push
(
self
):
recipe
=
self
.
new_recipe
()
with
tempfile
.
NamedTemporaryFile
()
as
rdiff_wrapper
:
with
tempfile
.
NamedTemporaryFile
(
'w+'
)
as
rdiff_wrapper
:
recipe
.
wrapper_push
(
remote_schema
=
'TEST_REMOTE_SCHEMA'
,
local_dir
=
'TEST_LOCAL_DIR'
,
remote_dir
=
'TEST_REMOTE_DIR'
,
...
...
@@ -35,7 +35,7 @@ class PBSTest(unittest.TestCase):
def
test_pull
(
self
):
recipe
=
self
.
new_recipe
()
with
tempfile
.
NamedTemporaryFile
()
as
rdiff_wrapper
:
with
tempfile
.
NamedTemporaryFile
(
'w+'
)
as
rdiff_wrapper
:
recipe
.
wrapper_pull
(
remote_schema
=
'TEST_REMOTE_SCHEMA'
,
local_dir
=
'TEST_LOCAL_DIR'
,
remote_dir
=
'TEST_REMOTE_DIR'
,
...
...
slapos/test/utils.py
View file @
59ee2f81
...
...
@@ -2,7 +2,7 @@
"""
import
sys
import
os.path
from
ConfigP
arser
import
ConfigParser
from
six.moves.configp
arser
import
ConfigParser
import
logging
...
...
software/slapos-testing/software-py3.cfg
View file @
59ee2f81
...
...
@@ -38,5 +38,3 @@ netifaces = 0.10.7
supervisor =
xml-marshaller = 0.9.7+SlapOSPatched001
slapos.recipe.build = 0.38
pyOpenSSL = 18.0.0
cryptography = 2.3.1
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