Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Kasra Jamshidi
erp5
Commits
b6921405
Commit
b6921405
authored
Apr 05, 2012
by
Vincent Pelletier
Committed by
Sebastien Robin
Apr 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup erp5testnode a bit
parent
0e3e4b17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
45 deletions
+30
-45
erp5/util/testnode/__init__.py
erp5/util/testnode/__init__.py
+30
-45
No files found.
erp5/util/testnode/__init__.py
View file @
b6921405
...
@@ -32,10 +32,10 @@ import pkg_resources
...
@@ -32,10 +32,10 @@ import pkg_resources
import
testnode
import
testnode
CONFIG
=
dict
(
CONFIG
=
{
computer_id
=
'COMPUTER'
,
'computer_id'
:
'COMPUTER'
,
partition_reference
=
'test0'
,
'partition_reference'
:
'test0'
,
)
}
def
main
(
*
args
):
def
main
(
*
args
):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
@@ -64,40 +64,34 @@ def main(*args):
...
@@ -64,40 +64,34 @@ def main(*args):
# do not change case of option keys
# do not change case of option keys
config
.
optionxform
=
str
config
.
optionxform
=
str
config
.
readfp
(
parsed_argument
.
configuration_file
[
0
])
config
.
readfp
(
parsed_argument
.
configuration_file
[
0
])
def
geto
(
o
):
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
return
config
.
get
(
'testnode'
,
o
)
'log_directory'
,
'run_directory'
,
'proxy_host'
,
'proxy_port'
,
CONFIG
[
'slapos_directory'
]
=
geto
(
'slapos_directory'
)
'git_binary'
,
'zip_binary'
,
'test_suite_title'
,
'test_node_title'
,
CONFIG
[
'working_directory'
]
=
geto
(
'working_directory'
)
'test_suite'
,
'project_title'
,
'node_quantity'
,
'ipv4_address'
,
CONFIG
[
'test_suite_directory'
]
=
geto
(
'test_suite_directory'
)
'ipv6_address'
,
'test_suite_master_url'
,
'slapgrid_partition_binary'
,
CONFIG
[
'log_directory'
]
=
geto
(
'log_directory'
)
'slapgrid_software_binary'
,
'slapproxy_binary'
):
CONFIG
[
'run_directory'
]
=
geto
(
'run_directory'
)
CONFIG
[
key
]
=
config
.
get
(
'testnode'
,
key
)
for
d
in
CONFIG
[
'slapos_directory'
],
CONFIG
[
'working_directory'
],
\
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
CONFIG
[
'test_suite_directory'
],
CONFIG
[
'log_directory'
],
\
'log_directory'
,
'run_directory'
):
CONFIG
[
'run_directory'
]:
d
=
CONFIG
[
key
]
if
not
os
.
path
.
isdir
(
d
):
if
not
os
.
path
.
isdir
(
d
):
raise
ValueError
(
'Directory %r does not exists.'
%
d
)
raise
ValueError
(
'Directory %r does not exists.'
%
d
)
CONFIG
[
'software_root'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
slapos_directory
=
CONFIG
[
'slapos_directory'
]
'software'
)
CONFIG
[
'software_root'
]
=
software_root
=
os
.
path
.
join
(
slapos_directory
,
CONFIG
[
'instance_root'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'software'
)
'instance'
)
CONFIG
[
'instance_root'
]
=
instance_root
=
os
.
path
.
join
(
slapos_directory
,
for
d
in
CONFIG
[
'software_root'
],
CONFIG
[
'instance_root'
]:
'instance'
)
CONFIG
[
'proxy_database'
]
=
os
.
path
.
join
(
slapos_directory
,
'proxy.db'
)
CONFIG
[
'slapos_config'
]
=
slapos_config
=
os
.
path
.
join
(
slapos_directory
,
'slapos.cfg'
)
for
d
in
software_root
,
instance_root
:
if
not
os
.
path
.
lexists
(
d
):
if
not
os
.
path
.
lexists
(
d
):
os
.
mkdir
(
d
)
os
.
mkdir
(
d
)
CONFIG
[
'proxy_database'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'proxy.db'
)
CONFIG
[
'proxy_host'
]
=
geto
(
'proxy_host'
)
CONFIG
[
'proxy_port'
]
=
geto
(
'proxy_port'
)
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
CONFIG
[
'proxy_port'
])
CONFIG
[
'proxy_port'
])
slapos_config
=
pkg_resources
.
resource_string
(
'erp5.util.testnode'
,
open
(
slapos_config
,
'w'
).
write
(
pkg_resources
.
resource_string
(
'template/slapos.cfg.in'
)
'erp5.util.testnode'
,
'template/slapos.cfg.in'
)
%
CONFIG
)
slapos_config
=
slapos_config
%
CONFIG
CONFIG
[
'runTestSuite'
]
=
os
.
path
.
join
(
instance_root
,
CONFIG
[
'slapos_config'
]
=
os
.
path
.
join
(
CONFIG
[
'slapos_directory'
],
'slapos.cfg'
)
open
(
CONFIG
[
'slapos_config'
],
'w'
).
write
(
slapos_config
)
CONFIG
[
'git_binary'
]
=
geto
(
'git_binary'
)
CONFIG
[
'zip_binary'
]
=
geto
(
'zip_binary'
)
CONFIG
[
'runTestSuite'
]
=
os
.
path
.
join
(
CONFIG
[
'instance_root'
],
CONFIG
[
'partition_reference'
],
'bin'
,
'runTestSuite'
)
CONFIG
[
'partition_reference'
],
'bin'
,
'runTestSuite'
)
# generate vcs_repository_list
# generate vcs_repository_list
...
@@ -113,24 +107,15 @@ def main(*args):
...
@@ -113,24 +107,15 @@ def main(*args):
CONFIG
[
'bt5_path'
]
=
bt5_path
CONFIG
[
'bt5_path'
]
=
bt5_path
CONFIG
[
'vcs_repository_list'
]
=
vcs_repository_list
CONFIG
[
'vcs_repository_list'
]
=
vcs_repository_list
CONFIG
[
'test_suite_title'
]
=
geto
(
'test_suite_title'
)
CONFIG
[
'test_node_title'
]
=
geto
(
'test_node_title'
)
CONFIG
[
'test_suite'
]
=
geto
(
'test_suite'
)
CONFIG
[
'project_title'
]
=
geto
(
'project_title'
)
CONFIG
[
'node_quantity'
]
=
geto
(
'node_quantity'
)
CONFIG
[
'ipv4_address'
]
=
geto
(
'ipv4_address'
)
CONFIG
[
'ipv6_address'
]
=
geto
(
'ipv6_address'
)
CONFIG
[
'test_suite_master_url'
]
=
geto
(
'test_suite_master_url'
)
CONFIG
[
'slapgrid_partition_binary'
]
=
geto
(
'slapgrid_partition_binary'
)
CONFIG
[
'slapgrid_software_binary'
]
=
geto
(
'slapgrid_software_binary'
)
bot_environment
=
{}
if
'bot_environment'
in
config
.
sections
():
if
'bot_environment'
in
config
.
sections
():
bot_environment
=
dict
(
config
.
items
(
'bot_environment'
))
bot_environment
=
dict
(
config
.
items
(
'bot_environment'
))
else
:
bot_environment
=
{}
CONFIG
[
'bot_environment'
]
=
bot_environment
CONFIG
[
'bot_environment'
]
=
bot_environment
CONFIG
[
'environment'
]
=
dict
(
config
.
items
(
'environment'
))
CONFIG
[
'environment'
]
=
dict
(
config
.
items
(
'environment'
))
CONFIG
[
'slapproxy_binary'
]
=
geto
(
'slapproxy_binary'
)
instance_dict
=
{}
if
'instance_dict'
in
config
.
sections
():
if
'instance_dict'
in
config
.
sections
():
instance_dict
=
dict
(
config
.
items
(
'instance_dict'
))
instance_dict
=
dict
(
config
.
items
(
'instance_dict'
))
else
:
instance_dict
=
{}
CONFIG
[
'instance_dict'
]
=
instance_dict
CONFIG
[
'instance_dict'
]
=
instance_dict
testnode
.
run
(
CONFIG
)
testnode
.
run
(
CONFIG
)
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