Skip to content

Commit

Permalink
Merge bddc73d into 62bea57
Browse files Browse the repository at this point in the history
  • Loading branch information
mohierf committed May 29, 2017
2 parents 62bea57 + bddc73d commit c2e507b
Show file tree
Hide file tree
Showing 172 changed files with 8,259 additions and 922 deletions.
3 changes: 1 addition & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ load-plugins=
# W0201 : *Attribute %r defined outside __init__*. Because we instanciate object with properties dict
# C0330 : *Wrong %s indentation%s%s.* Conflict with pep8
# E0203 : *Access to member %r before its definition line %s*. Because we instanciate object with properties dict
disable=C1001,W0201,W0212,I0011,W0511,C0330,E0203

disable=C1001,W0201,W0212,I0011,W0511,C0330,E0203, duplicate-code

[REPORTS]

Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ env:
- TEST_SUITE=unit
# Alignak daemons run tests
- TEST_SUITE=run
- TEST_SUITE=load
- TEST_SUITE=codingstandard
- TEST_SUITE=virtualenv

matrix:
exclude:
- python: "2.6"
env: TEST_SUITE=load
- python: "2.6"
env: TEST_SUITE=codingstandard
- python: "2.6"
Expand Down
14 changes: 14 additions & 0 deletions .travis/load.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -ev

cd test_load
# Delete previously existing coverage results
coverage erase

# Run test suite with py.test running its coverage plugin
pytest -v --cov=alignak --cov-config .coveragerc test_*.py

# Report about coverage
coverage report -m
cd ..
35 changes: 26 additions & 9 deletions alignak/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def execute(self):

logger.debug("Launch command: '%s'", self.command)
if self.log_actions:
logger.info("Launch command: '%s'", self.command)
if os.environ['TEST_LOG_ACTIONS'] == 'WARNING':
logger.warning("Launch command: '%s'", self.command)
else:
logger.info("Launch command: '%s'", self.command)

return self.execute__() # OS specific part

Expand Down Expand Up @@ -273,10 +276,16 @@ def get_outputs(self, out, max_plugins_output_length):
logger.debug("Command result for '%s': %d, %s",
self.command, self.exit_status, self.output)
if self.log_actions:
logger.info("Check result for '%s': %d, %s",
self.command, self.exit_status, self.output)
if self.perf_data:
logger.info("Performance data for '%s': %s", self.command, self.perf_data)
if os.environ['TEST_LOG_ACTIONS'] == 'WARNING':
logger.warning("Check result for '%s': %d, %s",
self.command, self.exit_status, self.output)
if self.perf_data:
logger.warning("Performance data for '%s': %s", self.command, self.perf_data)
else:
logger.info("Check result for '%s': %d, %s",
self.command, self.exit_status, self.output)
if self.perf_data:
logger.info("Performance data for '%s': %s", self.command, self.perf_data)

def check_finished(self, max_plugins_output_length):
"""Handle action if it is finished (get stdout, stderr, exit code...)
Expand Down Expand Up @@ -316,8 +325,12 @@ def check_finished(self, max_plugins_output_length):
self.u_time = n_child_utime - child_utime
self.s_time = n_child_stime - child_stime
if self.log_actions:
logger.info("Check for '%s' exited on timeout (%d s)",
self.command, self.timeout)
if os.environ['TEST_LOG_ACTIONS'] == 'WARNING':
logger.warning("Check for '%s' exited on timeout (%d s)",
self.command, self.timeout)
else:
logger.info("Check for '%s' exited on timeout (%d s)",
self.command, self.timeout)
return
return

Expand All @@ -334,8 +347,12 @@ def check_finished(self, max_plugins_output_length):

self.exit_status = self.process.returncode
if self.log_actions:
logger.info("Check for '%s' exited with return code %d",
self.command, self.exit_status)
if os.environ['TEST_LOG_ACTIONS'] == 'WARNING':
logger.warning("Check for '%s' exited with return code %d",
self.command, self.exit_status)
else:
logger.info("Check for '%s' exited with return code %d",
self.command, self.exit_status)

# we should not keep the process now
del self.process
Expand Down
2 changes: 1 addition & 1 deletion alignak/basemodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def manage_signal(self, sig, frame): # pylint: disable=W0613
:type frame:
:return: None
"""
logger.info("process %d received a signal: %s", os.getpid(), str(sig))
logger.info("module process %d received a signal: %s", os.getpid(), str(sig))
self.interrupted = True

def set_signal_handler(self, sigs=None):
Expand Down

0 comments on commit c2e507b

Please sign in to comment.