Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Thomas Leymonerie
slapos.toolbox
Commits
5f34b3f6
Commit
5f34b3f6
authored
Jul 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some pep8 love
parent
17a77af3
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
272 additions
and
133 deletions
+272
-133
slapos/runner/__init__.py
slapos/runner/__init__.py
+8
-4
slapos/runner/decorators.py
slapos/runner/decorators.py
+0
-1
slapos/runner/fileBrowser.py
slapos/runner/fileBrowser.py
+8
-7
slapos/runner/gittools.py
slapos/runner/gittools.py
+11
-4
slapos/runner/runnertest.py
slapos/runner/runnertest.py
+69
-54
slapos/runner/utils.py
slapos/runner/utils.py
+100
-48
slapos/runner/views.py
slapos/runner/views.py
+76
-15
No files found.
slapos/runner/__init__.py
View file @
5f34b3f6
...
@@ -21,8 +21,7 @@ class Parser(OptionParser):
...
@@ -21,8 +21,7 @@ class Parser(OptionParser):
"""
"""
Initialize all possible options.
Initialize all possible options.
"""
"""
OptionParser
.
__init__
(
self
,
usage
=
usage
,
version
=
version
,
option_list
=
[
option_list
=
[
Option
(
"-l"
,
"--log_file"
,
Option
(
"-l"
,
"--log_file"
,
help
=
"The path to the log file used by the script."
,
help
=
"The path to the log file used by the script."
,
type
=
str
),
type
=
str
),
...
@@ -38,7 +37,10 @@ class Parser(OptionParser):
...
@@ -38,7 +37,10 @@ class Parser(OptionParser):
default
=
False
,
default
=
False
,
action
=
"store_true"
,
action
=
"store_true"
,
help
=
"Debug mode."
),
help
=
"Debug mode."
),
])
]
OptionParser
.
__init__
(
self
,
usage
=
usage
,
version
=
version
,
option_list
=
option_list
)
def
check_args
(
self
):
def
check_args
(
self
):
"""
"""
...
@@ -50,6 +52,7 @@ class Parser(OptionParser):
...
@@ -50,6 +52,7 @@ class Parser(OptionParser):
return
options
,
args
[
0
]
return
options
,
args
[
0
]
class
Config
:
class
Config
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
configuration_file_path
=
None
self
.
configuration_file_path
=
None
...
@@ -125,6 +128,7 @@ def run():
...
@@ -125,6 +128,7 @@ def run():
sys
.
exit
(
return_code
)
sys
.
exit
(
return_code
)
def
serve
(
config
):
def
serve
(
config
):
from
views
import
app
from
views
import
app
from
werkzeug.contrib.fixers
import
ProxyFix
from
werkzeug.contrib.fixers
import
ProxyFix
...
@@ -134,7 +138,7 @@ def serve(config):
...
@@ -134,7 +138,7 @@ def serve(config):
app
.
config
.
update
(
app
.
config
.
update
(
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
workspace
=
workdir
,
workspace
=
workdir
,
software_link
=
software_link
,
software_link
=
software_link
,
instance_profile
=
'instance.cfg'
,
instance_profile
=
'instance.cfg'
,
software_profile
=
'software.cfg'
,
software_profile
=
'software.cfg'
,
...
...
slapos/runner/decorators.py
View file @
5f34b3f6
...
@@ -11,4 +11,3 @@ def as_json(f):
...
@@ -11,4 +11,3 @@ def as_json(f):
def
inner
(
*
args
,
**
kwargs
):
def
inner
(
*
args
,
**
kwargs
):
return
Response
(
json
.
dumps
(
f
(
*
args
,
**
kwargs
)),
mimetype
=
'application/json'
)
return
Response
(
json
.
dumps
(
f
(
*
args
,
**
kwargs
)),
mimetype
=
'application/json'
)
return
inner
return
inner
slapos/runner/fileBrowser.py
View file @
5f34b3f6
...
@@ -31,14 +31,14 @@ class FileBrowser(object):
...
@@ -31,14 +31,14 @@ class FileBrowser(object):
html
=
'var gsdirs = [], gsfiles = [];'
html
=
'var gsdirs = [], gsfiles = [];'
dir
=
urllib
.
unquote
(
dir
)
dir
=
urllib
.
unquote
(
dir
)
#
'dir' is used below. XXX should not shadow a builtin name
#
XXX-Marco 'dir' and 'all' should not shadow builtin names
realdir
=
realpath
(
self
.
config
,
dir
)
realdir
=
realpath
(
self
.
config
,
dir
)
if
not
realdir
:
if
not
realdir
:
raise
NameError
(
'Could not load directory %s: Permission denied'
%
dir
)
raise
NameError
(
'Could not load directory %s: Permission denied'
%
dir
)
ldir
=
sorted
(
os
.
listdir
(
realdir
),
key
=
str
.
lower
)
ldir
=
sorted
(
os
.
listdir
(
realdir
),
key
=
str
.
lower
)
for
f
in
ldir
:
for
f
in
ldir
:
if
f
.
startswith
(
'.'
)
and
not
all
:
#
do not display this file/folder
if
f
.
startswith
(
'.'
)
and
not
all
:
#
do not display this file/folder
continue
continue
ff
=
os
.
path
.
join
(
dir
,
f
)
ff
=
os
.
path
.
join
(
dir
,
f
)
realfile
=
os
.
path
.
join
(
realdir
,
f
)
realfile
=
os
.
path
.
join
(
realdir
,
f
)
...
@@ -61,7 +61,6 @@ class FileBrowser(object):
...
@@ -61,7 +61,6 @@ class FileBrowser(object):
ff + '", "
0
", "' + md5sum + '", "
dir
", "' + mdate + '"));'
ff + '", "
0
", "' + md5sum + '", "
dir
", "' + mdate + '"));'
return html
return html
def makeDirectory(self, dir, filename):
def makeDirectory(self, dir, filename):
"""Create a directory"""
"""Create a directory"""
realdir = self._realdir(dir)
realdir = self._realdir(dir)
...
@@ -72,7 +71,6 @@ class FileBrowser(object):
...
@@ -72,7 +71,6 @@ class FileBrowser(object):
else:
else:
return '{result:
\
'
0
\
'
}'
return '{result:
\
'
0
\
'
}'
def makeFile(self, dir, filename):
def makeFile(self, dir, filename):
"""Create a file in a directory dir taken"""
"""Create a file in a directory dir taken"""
realdir = self._realdir(dir)
realdir = self._realdir(dir)
...
@@ -85,17 +83,19 @@ class FileBrowser(object):
...
@@ -85,17 +83,19 @@ class FileBrowser(object):
def deleteItem(self, dir, files):
def deleteItem(self, dir, files):
"""Delete a list of files or directories"""
"""Delete a list of files or directories"""
# XXX-Marco do not shadow 'dir'
realdir = self._realdir(dir)
realdir = self._realdir(dir)
lfiles = urllib.unquote(files).split(',,,')
lfiles = urllib.unquote(files).split(',,,')
try:
try:
# XXX-Marco do not shadow 'file'
for file in lfiles:
for file in lfiles:
file = os.path.join(realdir, file)
file = os.path.join(realdir, file)
if not os.path.exists(file):
if not os.path.exists(file):
continue
#
silent skip file....
continue
#
silent skip file....
details = file.split('/')
details = file.split('/')
last = details[-1]
last = details[-1]
if last and last.startswith('.'):
if last and last.startswith('.'):
continue
#
cannot delete this file/directory, to prevent security
continue
#
cannot delete this file/directory, to prevent security
if os.path.isdir(file):
if os.path.isdir(file):
shutil.rmtree(file)
shutil.rmtree(file)
else:
else:
...
@@ -109,6 +109,7 @@ class FileBrowser(object):
...
@@ -109,6 +109,7 @@ class FileBrowser(object):
realdir = self._realdir(dir)
realdir = self._realdir(dir)
lfiles = urllib.unquote(files).split(',,,')
lfiles = urllib.unquote(files).split(',,,')
try:
try:
# XXX-Marco do not shadow 'file'
for file in lfiles:
for file in lfiles:
realfile = realpath(self.config, file)
realfile = realpath(self.config, file)
if not realfile:
if not realfile:
...
...
slapos/runner/gittools.py
View file @
5f34b3f6
...
@@ -29,7 +29,7 @@ def cloneRepo(data):
...
@@ -29,7 +29,7 @@ def cloneRepo(data):
json
=
""
json
=
""
try
:
try
:
if
os
.
path
.
exists
(
workDir
)
and
len
(
os
.
listdir
(
workDir
))
<
2
:
if
os
.
path
.
exists
(
workDir
)
and
len
(
os
.
listdir
(
workDir
))
<
2
:
shutil
.
rmtree
(
workDir
)
#
delete useless files
shutil
.
rmtree
(
workDir
)
#
delete useless files
repo
=
Repo
.
clone_from
(
data
[
"repo"
],
workDir
)
repo
=
Repo
.
clone_from
(
data
[
"repo"
],
workDir
)
config_writer
=
repo
.
config_writer
()
config_writer
=
repo
.
config_writer
()
config_writer
.
add_section
(
"user"
)
config_writer
.
add_section
(
"user"
)
...
@@ -42,6 +42,7 @@ def cloneRepo(data):
...
@@ -42,6 +42,7 @@ def cloneRepo(data):
json
=
safeResult
(
str
(
e
))
json
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
json
)
return
jsonify
(
code
=
code
,
result
=
json
)
def
gitStatus
(
project
):
def
gitStatus
(
project
):
"""Run git status and return status of specified project folder
"""Run git status and return status of specified project folder
Args:
Args:
...
@@ -61,6 +62,7 @@ def gitStatus(project):
...
@@ -61,6 +62,7 @@ def gitStatus(project):
json
=
safeResult
(
str
(
e
))
json
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
json
,
branch
=
branch
,
dirty
=
isdirty
)
return
jsonify
(
code
=
code
,
result
=
json
,
branch
=
branch
,
dirty
=
isdirty
)
def
switchBranch
(
project
,
name
):
def
switchBranch
(
project
,
name
):
"""Switch a git branch
"""Switch a git branch
Args:
Args:
...
@@ -83,6 +85,7 @@ def switchBranch(project, name):
...
@@ -83,6 +85,7 @@ def switchBranch(project, name):
json
=
safeResult
(
str
(
e
))
json
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
json
)
return
jsonify
(
code
=
code
,
result
=
json
)
def
addBranch
(
project
,
name
,
onlyCheckout
=
False
):
def
addBranch
(
project
,
name
,
onlyCheckout
=
False
):
"""Add new git branch to the repository
"""Add new git branch to the repository
Args:
Args:
...
@@ -105,6 +108,7 @@ def addBranch(project, name, onlyCheckout=False):
...
@@ -105,6 +108,7 @@ def addBranch(project, name, onlyCheckout=False):
json
=
safeResult
(
str
(
e
))
json
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
json
)
return
jsonify
(
code
=
code
,
result
=
json
)
def
getDiff
(
project
):
def
getDiff
(
project
):
"""Get git diff for the specified project directory"""
"""Get git diff for the specified project directory"""
result
=
""
result
=
""
...
@@ -117,6 +121,7 @@ def getDiff(project):
...
@@ -117,6 +121,7 @@ def getDiff(project):
result
=
safeResult
(
str
(
e
))
result
=
safeResult
(
str
(
e
))
return
result
return
result
def
gitPush
(
project
,
msg
):
def
gitPush
(
project
,
msg
):
"""Commit and Push changes for the specified repository
"""Commit and Push changes for the specified repository
Args:
Args:
...
@@ -145,10 +150,11 @@ def gitPush(project, msg):
...
@@ -145,10 +150,11 @@ def gitPush(project, msg):
code
=
1
code
=
1
except
Exception
as
e
:
except
Exception
as
e
:
if
undo_commit
:
if
undo_commit
:
git
.
reset
(
"HEAD~"
)
#
undo previous commit
git
.
reset
(
"HEAD~"
)
#
undo previous commit
json
=
safeResult
(
str
(
e
))
json
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
json
)
return
jsonify
(
code
=
code
,
result
=
json
)
def
gitPull
(
project
):
def
gitPull
(
project
):
result
=
""
result
=
""
code
=
0
code
=
0
...
@@ -161,6 +167,7 @@ def gitPull(project):
...
@@ -161,6 +167,7 @@ def gitPull(project):
result
=
safeResult
(
str
(
e
))
result
=
safeResult
(
str
(
e
))
return
jsonify
(
code
=
code
,
result
=
result
)
return
jsonify
(
code
=
code
,
result
=
result
)
def
safeResult
(
result
):
def
safeResult
(
result
):
"""Parse string and remove credential of the user"""
"""Parse string and remove credential of the user"""
regex
=
re
.
compile
(
"(https:
\
/
\
/)([
\
w
\
d
\
._-]+:[
\
w
\
d
\
._-]+)
\
@([
\
S]+
\
s)
"
, re.VERBOSE)
regex
=
re
.
compile
(
"(https:
\
/
\
/)([
\
w
\
d
\
._-]+:[
\
w
\
d
\
._-]+)
\
@([
\
S]+
\
s)
"
, re.VERBOSE)
...
...
slapos/runner/runnertest.py
View file @
5f34b3f6
...
@@ -18,6 +18,7 @@ from slapos.runner.process import killRunningProcess, isRunning
...
@@ -18,6 +18,7 @@ from slapos.runner.process import killRunningProcess, isRunning
from
slapos.runner
import
views
from
slapos.runner
import
views
import
slapos.slap
import
slapos.slap
#Helpers
#Helpers
def
loadJson
(
response
):
def
loadJson
(
response
):
return
json
.
loads
(
response
.
data
)
return
json
.
loads
(
response
.
data
)
...
@@ -48,6 +49,7 @@ class Config:
...
@@ -48,6 +49,7 @@ class Config:
if
not
getattr
(
self
,
key
,
None
):
if
not
getattr
(
self
,
key
,
None
):
setattr
(
self
,
key
,
configuration_dict
[
key
])
setattr
(
self
,
key
,
configuration_dict
[
key
])
class
SlaprunnerTestCase
(
unittest
.
TestCase
):
class
SlaprunnerTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -57,8 +59,8 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -57,8 +59,8 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
updateUser
=
[
"newslapuser"
,
"newslappwd"
,
"slaprunner@nexedi.com"
,
"SlapOS web runner"
]
self
.
updateUser
=
[
"newslapuser"
,
"newslappwd"
,
"slaprunner@nexedi.com"
,
"SlapOS web runner"
]
self
.
rcode
=
"41bf2657"
self
.
rcode
=
"41bf2657"
self
.
repo
=
'http://git.erp5.org/repos/slapos.git'
self
.
repo
=
'http://git.erp5.org/repos/slapos.git'
self
.
software
=
"workspace/slapos/software/"
#
relative directory fo SR
self
.
software
=
"workspace/slapos/software/"
#
relative directory fo SR
self
.
project
=
'slapos'
#
Default project name
self
.
project
=
'slapos'
#
Default project name
self
.
template
=
'template.cfg'
self
.
template
=
'template.cfg'
self
.
partitionPrefix
=
'slappart'
self
.
partitionPrefix
=
'slappart'
self
.
slaposBuildout
=
"1.6.0-dev-SlapOS-010"
self
.
slaposBuildout
=
"1.6.0-dev-SlapOS-010"
...
@@ -77,7 +79,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -77,7 +79,7 @@ class SlaprunnerTestCase(unittest.TestCase):
views
.
app
.
config
.
update
(
views
.
app
.
config
.
update
(
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
software_log
=
config
.
software_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
instance_log
=
config
.
instance_root
.
rstrip
(
'/'
)
+
'.log'
,
workspace
=
workdir
,
workspace
=
workdir
,
software_link
=
software_link
,
software_link
=
software_link
,
instance_profile
=
'instance.cfg'
,
instance_profile
=
'instance.cfg'
,
software_profile
=
'software.cfg'
,
software_profile
=
'software.cfg'
,
...
@@ -117,20 +119,24 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -117,20 +119,24 @@ class SlaprunnerTestCase(unittest.TestCase):
def
configAccount
(
self
,
username
,
password
,
email
,
name
,
rcode
):
def
configAccount
(
self
,
username
,
password
,
email
,
name
,
rcode
):
"""Helper for configAccount"""
"""Helper for configAccount"""
return
self
.
app
.
post
(
'/configAccount'
,
data
=
dict
(
return
self
.
app
.
post
(
'/configAccount'
,
data
=
dict
(
username
=
username
,
username
=
username
,
password
=
password
,
password
=
password
,
email
=
email
,
email
=
email
,
name
=
name
,
name
=
name
,
rcode
=
rcode
rcode
=
rcode
),
follow_redirects
=
True
)
),
follow_redirects
=
True
)
def
login
(
self
,
username
,
password
):
def
login
(
self
,
username
,
password
):
"""Helper for Login method"""
"""Helper for Login method"""
return
self
.
app
.
post
(
'/doLogin'
,
data
=
dict
(
return
self
.
app
.
post
(
'/doLogin'
,
data
=
dict
(
clogin
=
username
,
clogin
=
username
,
cpwd
=
password
cpwd
=
password
),
follow_redirects
=
True
)
),
follow_redirects
=
True
)
def
setAccount
(
self
):
def
setAccount
(
self
):
"""Initialize user account and log user in"""
"""Initialize user account and log user in"""
...
@@ -146,13 +152,15 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -146,13 +152,15 @@ class SlaprunnerTestCase(unittest.TestCase):
def
updateAccount
(
self
,
newaccount
,
rcode
):
def
updateAccount
(
self
,
newaccount
,
rcode
):
"""Helper for update user account data"""
"""Helper for update user account data"""
return
self
.
app
.
post
(
'/updateAccount'
,
data
=
dict
(
return
self
.
app
.
post
(
'/updateAccount'
,
data
=
dict
(
username
=
newaccount
[
0
],
username
=
newaccount
[
0
],
password
=
newaccount
[
1
],
password
=
newaccount
[
1
],
email
=
newaccount
[
2
],
email
=
newaccount
[
2
],
name
=
newaccount
[
3
],
name
=
newaccount
[
3
],
rcode
=
rcode
rcode
=
rcode
),
follow_redirects
=
True
)
),
follow_redirects
=
True
)
def
getCurrentSR
(
self
):
def
getCurrentSR
(
self
):
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
return
getProfilePath
(
self
.
app
.
config
[
'etc_dir'
],
...
@@ -189,7 +197,8 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -189,7 +197,8 @@ class SlaprunnerTestCase(unittest.TestCase):
"""Helper for setup compiled software release dir"""
"""Helper for setup compiled software release dir"""
self
.
setupProjectFolder
(
withSoftware
=
True
)
self
.
setupProjectFolder
(
withSoftware
=
True
)
md5
=
hashlib
.
md5
(
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
md5
=
hashlib
.
md5
(
os
.
path
.
join
(
self
.
app
.
config
[
'workspace'
],
"slapos/software/slaprunner-test"
,
self
.
app
.
config
[
'software_profile'
])
"slapos/software/slaprunner-test"
,
self
.
app
.
config
[
'software_profile'
])
).
hexdigest
()
).
hexdigest
()
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'software_root'
],
md5
)
base
=
os
.
path
.
join
(
self
.
app
.
config
[
'software_root'
],
md5
)
template
=
os
.
path
.
join
(
base
,
self
.
template
)
template
=
os
.
path
.
join
(
base
,
self
.
template
)
...
@@ -208,7 +217,6 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -208,7 +217,6 @@ class SlaprunnerTestCase(unittest.TestCase):
"""Kill slapproxy process"""
"""Kill slapproxy process"""
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
killRunningProcess
(
'slapproxy'
,
recursive
=
True
)
#Begin test case here
#Begin test case here
def
test_wrong_login
(
self
):
def
test_wrong_login
(
self
):
"""Test Login user before create session. This should return error value"""
"""Test Login user before create session. This should return error value"""
...
@@ -266,12 +274,16 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -266,12 +274,16 @@ class SlaprunnerTestCase(unittest.TestCase):
"""Start scenario 1 for deploying SR: Clone a project from git repository"""
"""Start scenario 1 for deploying SR: Clone a project from git repository"""
self
.
setAccount
()
self
.
setAccount
()
folder
=
'workspace/'
+
self
.
project
folder
=
'workspace/'
+
self
.
project
data
=
{
"repo"
:
self
.
repo
,
"user"
:
'Slaprunner test'
,
data
=
{
"email"
:
'slaprunner@nexedi.com'
,
"name"
:
folder
}
'repo'
:
self
.
repo
,
'user'
:
'Slaprunner test'
,
'email'
:
'slaprunner@nexedi.com'
,
'name'
:
folder
}
response
=
loadJson
(
self
.
app
.
post
(
'/cloneRepository'
,
data
=
data
,
response
=
loadJson
(
self
.
app
.
post
(
'/cloneRepository'
,
data
=
data
,
follow_redirects
=
True
))
follow_redirects
=
True
))
self
.
assertEqual
(
response
[
'result'
],
""
)
self
.
assertEqual
(
response
[
'result'
],
""
)
#Get realpath of create project
#
Get realpath of create project
path_data
=
dict
(
file
=
folder
)
path_data
=
dict
(
file
=
folder
)
response
=
loadJson
(
self
.
app
.
post
(
'/getPath'
,
data
=
path_data
,
response
=
loadJson
(
self
.
app
.
post
(
'/getPath'
,
data
=
path_data
,
follow_redirects
=
True
))
follow_redirects
=
True
))
...
@@ -281,10 +293,12 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -281,10 +293,12 @@ class SlaprunnerTestCase(unittest.TestCase):
config
=
open
(
os
.
path
.
join
(
realFolder
,
'.git/config'
),
'r'
).
read
()
config
=
open
(
os
.
path
.
join
(
realFolder
,
'.git/config'
),
'r'
).
read
()
assert
"slaprunner@nexedi.com"
in
config
and
"Slaprunner test"
in
config
assert
"slaprunner@nexedi.com"
in
config
and
"Slaprunner test"
in
config
#Checkout to slaprunner branch, this supose that branch slaprunner exit
#Checkout to slaprunner branch, this supose that branch slaprunner exit
response
=
loadJson
(
self
.
app
.
post
(
'/newBranch'
,
data
=
dict
(
response
=
loadJson
(
self
.
app
.
post
(
'/newBranch'
,
data
=
dict
(
project
=
folder
,
project
=
folder
,
create
=
'0'
,
create
=
'0'
,
name
=
'slaprunner'
),
name
=
'slaprunner'
),
follow_redirects
=
True
))
follow_redirects
=
True
))
self
.
assertEqual
(
response
[
'result'
],
""
)
self
.
assertEqual
(
response
[
'result'
],
""
)
self
.
logout
()
self
.
logout
()
...
@@ -308,7 +322,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -308,7 +322,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
test_cloneProject
()
self
.
test_cloneProject
()
#Login
#Login
self
.
login
(
self
.
users
[
0
],
self
.
users
[
1
])
self
.
login
(
self
.
users
[
0
],
self
.
users
[
1
])
software
=
os
.
path
.
join
(
self
.
software
,
'drupal'
)
#
Drupal SR must exist in SR folder
software
=
os
.
path
.
join
(
self
.
software
,
'drupal'
)
#
Drupal SR must exist in SR folder
response
=
loadJson
(
self
.
app
.
post
(
'/setCurrentProject'
,
response
=
loadJson
(
self
.
app
.
post
(
'/setCurrentProject'
,
data
=
dict
(
path
=
software
),
data
=
dict
(
path
=
software
),
follow_redirects
=
True
))
follow_redirects
=
True
))
...
@@ -391,8 +405,8 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -391,8 +405,8 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
assertNotEqual
(
partitionList
,
[])
self
.
assertNotEqual
(
partitionList
,
[])
#Assume that the requested partition is partition 0
#Assume that the requested partition is partition 0
slapParameterDict
=
partitionList
[
0
].
getInstanceParameterDict
()
slapParameterDict
=
partitionList
[
0
].
getInstanceParameterDict
()
self
.
assertTrue
(
slapParameterDict
.
has_key
(
'appname'
)
)
self
.
assertTrue
(
'appname'
in
slapParameterDict
)
self
.
assertTrue
(
slapParameterDict
.
has_key
(
'cacountry'
)
)
self
.
assertTrue
(
'cacountry'
in
slapParameterDict
)
self
.
assertEqual
(
slapParameterDict
[
'appname'
],
'slaprunnerTest'
)
self
.
assertEqual
(
slapParameterDict
[
'appname'
],
'slaprunnerTest'
)
self
.
assertEqual
(
slapParameterDict
[
'cacountry'
],
'France'
)
self
.
assertEqual
(
slapParameterDict
[
'cacountry'
],
'France'
)
self
.
assertEqual
(
slapParameterDict
[
'slap_software_type'
],
'production'
)
self
.
assertEqual
(
slapParameterDict
[
'slap_software_type'
],
'production'
)
...
@@ -439,6 +453,7 @@ class SlaprunnerTestCase(unittest.TestCase):
...
@@ -439,6 +453,7 @@ class SlaprunnerTestCase(unittest.TestCase):
self
.
stopSlapproxy
()
self
.
stopSlapproxy
()
self
.
logout
()
self
.
logout
()
def
main
():
def
main
():
# Empty parser for now - so that erp5testnode is happy when doing --help
# Empty parser for now - so that erp5testnode is happy when doing --help
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
...
slapos/runner/utils.py
View file @
5f34b3f6
This diff is collapsed.
Click to expand it.
slapos/runner/views.py
View file @
5f34b3f6
This diff is collapsed.
Click to expand it.
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