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
Papa Tamsir Kane
erp5
Commits
12345392
Commit
12345392
authored
Aug 03, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start to use provided logging.
parent
7c4aa9b8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
22 deletions
+10
-22
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+2
-6
erp5/util/testnode/Updater.py
erp5/util/testnode/Updater.py
+2
-7
erp5/util/testnode/__init__.py
erp5/util/testnode/__init__.py
+4
-4
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+2
-5
No files found.
erp5/util/testnode/SlapOSControler.py
View file @
12345392
...
@@ -32,12 +32,8 @@ import xml_marshaller
...
@@ -32,12 +32,8 @@ import xml_marshaller
class
SlapOSControler
(
object
):
class
SlapOSControler
(
object
):
def
log
(
self
,
message
):
def
__init__
(
self
,
config
,
log
,
process_group_pid_set
=
None
):
print
message
self
.
log
=
log
def
__init__
(
self
,
config
,
process_group_pid_set
=
None
,
log
=
None
):
if
log
is
not
None
:
self
.
log
=
log
self
.
config
=
config
self
.
config
=
config
# By erasing everything, we make sure that we are able to "update"
# By erasing everything, we make sure that we are able to "update"
# existing profiles. This is quite dirty way to do updates...
# existing profiles. This is quite dirty way to do updates...
...
...
erp5/util/testnode/Updater.py
View file @
12345392
...
@@ -85,13 +85,8 @@ class Updater(object):
...
@@ -85,13 +85,8 @@ class Updater(object):
realtime_output
=
True
realtime_output
=
True
stdin
=
file
(
os
.
devnull
)
stdin
=
file
(
os
.
devnull
)
def
log
(
self
,
message
):
def
__init__
(
self
,
repository_path
,
log
,
revision
=
None
,
git_binary
=
None
):
print
message
self
.
log
=
log
def
__init__
(
self
,
repository_path
,
revision
=
None
,
git_binary
=
None
,
log
=
None
):
if
log
is
not
None
:
self
.
log
=
log
self
.
revision
=
revision
self
.
revision
=
revision
self
.
_path_list
=
[]
self
.
_path_list
=
[]
self
.
repository_path
=
repository_path
self
.
repository_path
=
repository_path
...
...
erp5/util/testnode/__init__.py
View file @
12345392
...
@@ -48,9 +48,8 @@ def main(*args):
...
@@ -48,9 +48,8 @@ def main(*args):
parsed_argument
=
parser
.
parse_args
(
list
(
args
))
parsed_argument
=
parser
.
parse_args
(
list
(
args
))
else
:
else
:
parsed_argument
=
parser
.
parse_args
()
parsed_argument
=
parser
.
parse_args
()
logger
=
None
logger
=
logging
.
getLogger
(
'erp5testnode'
)
if
parsed_argument
.
console
or
parsed_argument
.
logfile
:
if
parsed_argument
.
console
or
parsed_argument
.
logfile
:
logger
=
logging
.
getLogger
(
'erp5testnode'
)
logger
.
setLevel
(
logging
.
INFO
)
logger
.
setLevel
(
logging
.
INFO
)
if
parsed_argument
.
console
:
if
parsed_argument
.
console
:
logger
.
addHandler
(
logging
.
StreamHandler
())
logger
.
addHandler
(
logging
.
StreamHandler
())
...
@@ -58,8 +57,9 @@ def main(*args):
...
@@ -58,8 +57,9 @@ def main(*args):
if
parsed_argument
.
logfile
:
if
parsed_argument
.
logfile
:
logger
.
addHandler
(
logging
.
FileHandler
(
filename
=
parsed_argument
.
logfile
))
logger
.
addHandler
(
logging
.
FileHandler
(
filename
=
parsed_argument
.
logfile
))
logger
.
info
(
'Activated logfile %r output'
%
parsed_argument
.
logfile
)
logger
.
info
(
'Activated logfile %r output'
%
parsed_argument
.
logfile
)
if
logger
is
not
None
:
else
:
CONFIG
[
'logger'
]
=
logger
.
info
logger
.
addHandler
(
logging
.
NullHandler
())
CONFIG
[
'logger'
]
=
logger
.
info
config
=
ConfigParser
.
SafeConfigParser
()
config
=
ConfigParser
.
SafeConfigParser
()
# do not change case of option keys
# do not change case of option keys
config
.
optionxform
=
str
config
.
optionxform
=
str
...
...
erp5/util/testnode/testnode.py
View file @
12345392
...
@@ -46,10 +46,6 @@ class SubprocessError(EnvironmentError):
...
@@ -46,10 +46,6 @@ class SubprocessError(EnvironmentError):
from
Updater
import
Updater
from
Updater
import
Updater
def
log
(
message
):
# Log to stdout, with a timestamp.
print
time
.
strftime
(
'%Y/%m/%d %H:%M:%S'
),
message
supervisord_pid_file
=
None
supervisord_pid_file
=
None
process_group_pid_set
=
set
()
process_group_pid_set
=
set
()
def
sigterm_handler
(
signal
,
frame
):
def
sigterm_handler
(
signal
,
frame
):
...
@@ -100,6 +96,7 @@ def killPreviousRun():
...
@@ -100,6 +96,7 @@ def killPreviousRun():
PROFILE_PATH_KEY
=
'profile_path'
PROFILE_PATH_KEY
=
'profile_path'
def
run
(
config
):
def
run
(
config
):
log
=
config
[
'logger'
]
slapgrid
=
None
slapgrid
=
None
global
supervisord_pid_file
global
supervisord_pid_file
supervisord_pid_file
=
os
.
path
.
join
(
config
[
'instance_root'
],
'var'
,
'run'
,
supervisord_pid_file
=
os
.
path
.
join
(
config
[
'instance_root'
],
'var'
,
'run'
,
...
@@ -225,7 +222,7 @@ branch = %(branch)s
...
@@ -225,7 +222,7 @@ branch = %(branch)s
# revision
# revision
log
(
' %s at %s'
%
(
repository_path
,
revision
))
log
(
' %s at %s'
%
(
repository_path
,
revision
))
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
revision
=
revision
)
revision
=
revision
,
log
=
log
)
updater
.
checkout
()
updater
.
checkout
()
# Now prepare the installation of SlapOS and create instance
# Now prepare the installation of SlapOS and create instance
...
...
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