Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cloudooo
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
cloudooo
Commits
edacbe10
Commit
edacbe10
authored
May 30, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve logging
parent
66e7ad71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
27 deletions
+21
-27
cloudooo/handler/ooo/application/application.py
cloudooo/handler/ooo/application/application.py
+19
-2
cloudooo/handler/ooo/application/openoffice.py
cloudooo/handler/ooo/application/openoffice.py
+2
-0
cloudooo/tests/handlerTestCase.py
cloudooo/tests/handlerTestCase.py
+0
-25
No files found.
cloudooo/handler/ooo/application/application.py
View file @
edacbe10
...
...
@@ -50,8 +50,14 @@ class Application(object):
if
hasattr
(
self
,
'process'
):
error
=
False
process_pid
=
self
.
process
.
pid
returncode
=
self
.
process
.
poll
()
# libreoffice daemon want go to background
# so it return 0, so ignore 0
if
returncode
is
not
None
and
returncode
!=
0
:
self
.
daemonOutputLog
()
logger
.
debug
(
"Process %s already ended with returncode %s"
,
process_pid
,
returncode
)
return
False
logger
.
debug
(
"Stop Pid - %s"
,
process_pid
)
returncode
=
None
try
:
process
=
Process
(
process_pid
)
cmdline
=
" "
.
join
(
process
.
cmdline
())
...
...
@@ -74,10 +80,21 @@ class Application(object):
returncode
=
self
.
process
.
returncode
if
error
and
returncode
:
logger
.
error
(
"Process %s cmdline: %s ended with returncode %s"
,
process_pid
,
cmdline
,
returncode
)
elif
returncode
!=
0
:
elif
returncode
is
not
None
and
returncode
!=
0
:
self
.
daemonOutputLog
()
logger
.
debug
(
"Process %s ended with returncode %s"
,
process_pid
,
returncode
)
delattr
(
self
,
"process"
)
def
daemonOutputLog
(
self
):
if
hasattr
(
self
,
'process'
):
process_pid
=
self
.
process
.
pid
stdout
=
self
.
process
.
stdout
.
read
()
if
stdout
:
logger
.
debug
(
"Process %s stdout: %s"
,
process_pid
,
stdout
)
stderr
=
self
.
process
.
stderr
.
read
()
if
stderr
:
logger
.
error
(
"Process %s stderr: %s"
,
process_pid
,
stderr
)
def
loadSettings
(
self
,
hostname
,
port
,
path_run_dir
,
**
kwargs
):
"""Define attributes for application instance
Keyword arguments:
...
...
cloudooo/handler/ooo/application/openoffice.py
View file @
edacbe10
...
...
@@ -122,6 +122,8 @@ class OpenOffice(Application):
for
i
in
range
(
5
):
self
.
stop
()
self
.
process
=
Popen
(
command
,
stdout
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
True
,
env
=
env
)
sleep
(
1
)
...
...
cloudooo/tests/handlerTestCase.py
View file @
edacbe10
...
...
@@ -107,31 +107,6 @@ def stopFakeEnvironment(stop_openoffice=True):
openoffice
.
stop
()
return
True
if
1
:
from
cloudooo.handler.ooo.application.openoffice
import
OpenOffice
from
cloudooo.handler.ooo.util
import
waitStartDaemon
from
subprocess
import
Popen
,
PIPE
from
time
import
sleep
# patch OpenOffice._startProcess not to put bogus output to stderr,
# that prevents detecting the end of unit test.
def
_startProcess
(
self
,
command
,
env
):
"""Start OpenOffice.org process"""
for
i
in
range
(
5
):
self
.
stop
()
self
.
process
=
Popen
(
command
,
stderr
=
PIPE
,
close_fds
=
True
,
env
=
env
)
sleep
(
1
)
if
self
.
process
.
poll
()
is
not
None
:
# process already terminated so
# rerun
continue
if
waitStartDaemon
(
self
,
self
.
timeout
-
1
):
break
OpenOffice
.
_startProcess
=
_startProcess
class
HandlerTestCase
(
unittest
.
TestCase
):
"""Test Case to load cloudooo conf."""
...
...
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