lists.checkmk.com
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
List overview
Download
Checkmk git commits
November 2018
----- 2024 -----
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
checkmk-commits@lists.checkmk.com
15 participants
465 discussions
Start a n
N
ew thread
Reserved 10 Werk IDS
by Andreas Umbreit
Module: check_mk Branch: master Commit: a07864da2838779f00f2f753362b9f56e18d0ca9 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a07864da283877…
Author: Andreas Umbreit <au(a)mathias-kettner.de> Date: Thu Nov 22 09:02:09 2018 +0100 Reserved 10 Werk IDS Change-Id: I9e7c49f230e134220a9735e5a86c0799a0a5c0d4 --- .werks/first_free | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.werks/first_free b/.werks/first_free index a05231e..3914622 100644 --- a/.werks/first_free +++ b/.werks/first_free @@ -1 +1 @@ -6931 +6941
5 years, 10 months
1
0
0
0
Increased expected docker image size
by Lars Michelsen
Module: check_mk Branch: master Commit: ea1eb68ee79a3c3167beb7481afc81afecde3c4a URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea1eb68ee79a3c…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Thu Nov 22 08:39:14 2018 +0100 Increased expected docker image size Change-Id: I85089e68b970bc155d9de383939fd89f2739e3df --- tests/docker/test_docker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/docker/test_docker.py b/tests/docker/test_docker.py index 6961f09..c7aac51 100644 --- a/tests/docker/test_docker.py +++ b/tests/docker/test_docker.py @@ -106,7 +106,9 @@ def _build(request, client, edition, version, add_args=None): u'6557/tcp': {}, } - assert attrs["Size"] < 920 * 1024 * 1024, \ + # 2018-11-14: 900 -> 920 + # 2018-11-22: 920 -> 940 + assert attrs["Size"] < 940 * 1024 * 1024, \ "Docker image size increased: Please verify that this is intended" assert len(attrs["RootFS"]["Layers"]) == 6
5 years, 10 months
1
0
0
0
YAPFed docker tests
by Lars Michelsen
Module: check_mk Branch: master Commit: 077432b5f611743f7a82b6f459da72e310efbe7d URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=077432b5f61174…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Thu Nov 22 08:38:46 2018 +0100 YAPFed docker tests Change-Id: I20512c1fada8889e527998472d9a083571ea0512 --- tests/docker/test_docker.py | 118 ++++++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/tests/docker/test_docker.py b/tests/docker/test_docker.py index 0e4d0a4..6961f09 100644 --- a/tests/docker/test_docker.py +++ b/tests/docker/test_docker.py @@ -27,7 +27,6 @@ import pytest import docker import os -import time import subprocess import testlib @@ -36,12 +35,10 @@ build_path = os.path.join(testlib.repo_path(), "docker") image_prefix = "docker-tests" branch_name = os.environ.get("BRANCH", "master") + def build_version(): return testlib.CMKVersion( - version=testlib.CMKVersion.DAILY, - edition=testlib.CMKVersion.CEE, - branch=branch_name - ) + version=testlib.CMKVersion.DAILY, edition=testlib.CMKVersion.CEE, branch=branch_name) @pytest.fixture(scope="session") @@ -60,17 +57,21 @@ def _image_name(edition, version): def _prepare_build(): assert subprocess.Popen(["make", "needed-packages"], - stdout=open(os.devnull, "w"), cwd=build_path).wait() == 0 + stdout=open(os.devnull, "w"), + cwd=build_path).wait() == 0 def _build(request, client, edition, version, add_args=None): _prepare_build() - image, build_logs = client.images.build(path=build_path, tag=_image_name(edition, version), buildargs={ - "CMK_VERSION": version.version, - "CMK_EDITION": edition, - "CMK_DL_CREDENTIALS": ":".join(testlib.get_cmk_download_credentials()), - }) + image, build_logs = client.images.build( + path=build_path, + tag=_image_name(edition, version), + buildargs={ + "CMK_VERSION": version.version, + "CMK_EDITION": edition, + "CMK_DL_CREDENTIALS": ":".join(testlib.get_cmk_download_credentials()), + }) # TODO: Enable this on CI system. Removing during development slows down testing #request.addfinalizer(lambda: client.images.remove(image.id, force=True)) @@ -119,11 +120,7 @@ def _start(request, client, edition="enterprise", version=None, is_update=False, _image, _build_logs = _build(request, client, edition, version) - c = client.containers.run( - image=_image_name(edition, version), - detach=True, - **kwargs - ) + c = client.containers.run(image=_image_name(edition, version), detach=True, **kwargs) try: site_id = kwargs.get("environment", {}).get("CMK_SITE_ID", "cmk") @@ -149,15 +146,17 @@ def _start(request, client, edition="enterprise", version=None, is_update=False, # TODO: Test with all editions (daily for enterprise + last stable for raw/managed) -(a)pytest.mark.parametrize("edition", [ -# "raw", - "enterprise", -# "managed", -]) +(a)pytest.mark.parametrize( + "edition", + [ + # "raw", + "enterprise", + # "managed", + ]) def test_start_simple(request, client, edition): c = _start(request, client, edition) - cmds = [ p[-1] for p in c.top()["Processes"] ] + cmds = [p[-1] for p in c.top()["Processes"]] assert "cron -f" in cmds # Check postfix / syslog not runnig by default @@ -183,31 +182,33 @@ def test_start_simple(request, client, edition): assert exit_code == 0 - def test_start_cmkadmin_passsword(request, client): - c = _start(request, client, environment={ - "CMK_PASSWORD": "blabla", - }) + c = _start( + request, client, environment={ + "CMK_PASSWORD": "blabla", + }) - assert c.exec_run(["htpasswd", "-vb", "/omd/sites/cmk/etc/htpasswd", - "cmkadmin", "blabla"])[0] == 0 + assert c.exec_run(["htpasswd", "-vb", "/omd/sites/cmk/etc/htpasswd", "cmkadmin", + "blabla"])[0] == 0 - assert c.exec_run(["htpasswd", "-vb", "/omd/sites/cmk/etc/htpasswd", - "cmkadmin", "blub"])[0] == 3 + assert c.exec_run(["htpasswd", "-vb", "/omd/sites/cmk/etc/htpasswd", "cmkadmin", + "blub"])[0] == 3 def test_start_custom_site_id(request, client): - c = _start(request, client, environment={ - "CMK_SITE_ID": "xyz", - }) + c = _start( + request, client, environment={ + "CMK_SITE_ID": "xyz", + }) assert c.exec_run(["omd", "status"], user="xyz")[0] == 0 def test_start_enable_livestatus(request, client): - c = _start(request, client, environment={ - "CMK_LIVESTATUS_TCP": "on", - }) + c = _start( + request, client, environment={ + "CMK_LIVESTATUS_TCP": "on", + }) exit_code, output = c.exec_run(["omd", "config", "show", "LIVESTATUS_TCP"], user="cmk") assert exit_code == 0 @@ -226,10 +227,7 @@ def test_start_with_custom_command(request, client, version): edition = "enterprise" _build(request, client, edition, version) output = client.containers.run( - image=_image_name(edition, version), - detach=False, - command=["bash", "-c", "echo 1"] - ) + image=_image_name(edition, version), detach=False, command=["bash", "-c", "echo 1"]) assert "Created new site" in output assert output.endswith("1\n") @@ -262,11 +260,15 @@ def test_build_using_local_gpg_pubkey(request, client, version): def test_start_enable_mail(request, client): - c = _start(request, client, environment={ - "MAIL_RELAY_HOST": "
mailrelay.mydomain.com
", - }, hostname="
myhost.mydomain.com
") + c = _start( + request, + client, + environment={ + "MAIL_RELAY_HOST": "
mailrelay.mydomain.com
", + }, + hostname="
myhost.mydomain.com
") - cmds = [ p[-1] for p in c.top()["Processes"] ] + cmds = [p[-1] for p in c.top()["Processes"]] assert "syslogd" in cmds assert "/usr/lib/postfix/sbin/master" in cmds @@ -278,7 +280,7 @@ def test_start_enable_mail(request, client): def test_update(request, client, version): - container_name="%s-monitoring" % branch_name + container_name = "%s-monitoring" % branch_name # Pick a random old version that we can use to the setup the initial site with # Later this site is being updated to the current daily build @@ -289,10 +291,15 @@ def test_update(request, client, version): ) # 1. create container with old version and add a file to mark the pre-update state - c_orig = _start(request, client, version=old_version, name=container_name, - volumes=["/omd/sites"], tmpfs=["/omd/sites/cmk/tmp"]) - assert c_orig.exec_run(["touch", "pre-update-marker"], - user="cmk", workdir="/omd/sites/cmk")[0] == 0 + c_orig = _start( + request, + client, + version=old_version, + name=container_name, + volumes=["/omd/sites"], + tmpfs=["/omd/sites/cmk/tmp"]) + assert c_orig.exec_run(["touch", "pre-update-marker"], user="cmk", + workdir="/omd/sites/cmk")[0] == 0 # 2. stop the container c_orig.stop() @@ -330,10 +337,15 @@ def test_update(request, client, version): c_orig.rename("%s-old" % container_name) # 7. create new container - c_new = _start(request, client, version=version, is_update=True, - name=container_name, volumes_from=c_orig.id) + c_new = _start( + request, + client, + version=version, + is_update=True, + name=container_name, + volumes_from=c_orig.id) # 8. verify result c_new.exec_run(["omd", "version"], user="cmk")[1].endswith("%s\n" % version.omd_version()) - assert c_new.exec_run(["test", "-f", "pre-update-marker"], - user="cmk", workdir="/omd/sites/cmk")[0] == 0 + assert c_new.exec_run(["test", "-f", "pre-update-marker"], user="cmk", + workdir="/omd/sites/cmk")[0] == 0
5 years, 10 months
1
0
0
0
Fix make call for openhardwaremonitor dist
by Alex Zurhake
Module: check_mk Branch: master Commit: 9fb74fdfd8180693ceae9870afcb0999c59a82e8 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9fb74fdfd81806…
Author: Alex Zurhake <az(a)mathias-kettner.de> Date: Thu Nov 22 08:33:24 2018 +0100 Fix make call for openhardwaremonitor dist Change-Id: I612ecc71d92ab846f71460a7dfa128fba12609c8 --- agents/windows/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agents/windows/Makefile.am b/agents/windows/Makefile.am index e58949c..920d08a 100644 --- a/agents/windows/Makefile.am +++ b/agents/windows/Makefile.am @@ -183,7 +183,7 @@ integrationtest: install-strip openhardwaremonitor # openhardwaremonitor cannot be built in parallel, ensure non-parallel with -j1: openhardwaremonitor: - $(MAKE) -j1 -C $(bindir)/../../omd/packages/openhardwaremonitor dist + $(MAKE) -j1 -C $(bindir)/../../omd/ openhardwaremonitor-dist # Force regeneration of coverage data during test run. coverage-reset:
5 years, 10 months
1
0
0
0
Fixed analyze config after c8c2a2575e7
by Lars Michelsen
Module: check_mk Branch: master Commit: 05751d3cc69f5589141061f9b967c45239330e4b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=05751d3cc69f55…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Thu Nov 22 07:30:02 2018 +0100 Fixed analyze config after c8c2a2575e7 Change-Id: I6992137c87a2c23c9e6cf0348f2229396315847e --- cmk/gui/wato/pages/analyze_configuration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmk/gui/wato/pages/analyze_configuration.py b/cmk/gui/wato/pages/analyze_configuration.py index 5de6b96..68408c1 100644 --- a/cmk/gui/wato/pages/analyze_configuration.py +++ b/cmk/gui/wato/pages/analyze_configuration.py @@ -335,7 +335,8 @@ class ModeAnalyzeConfig(WatoMode): log.init_logging() if config.site_is_local(site_id): - results_data = watolib.AutomationCheckAnalyzeConfig().execute() + automation = watolib.AutomationCheckAnalyzeConfig() + results_data = automation.execute(automation.get_request()) else: results_data = watolib.do_remote_automation(
5 years, 10 months
1
0
0
0
Python: Fixed inconsistent package / make target naming
by Lars Michelsen
Module: check_mk Branch: master Commit: 241ee3fb9ff8e5ed6da505ba742ddb74f79a6c24 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=241ee3fb9ff8e5…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Nov 21 20:45:28 2018 +0100 Python: Fixed inconsistent package / make target naming Change-Id: I4bb28a37563f5ffe00b9f7c77a9d292efa6564b4 --- omd/packages/Python/Python.make | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/omd/packages/Python/Python.make b/omd/packages/Python/Python.make index 9a1d177..6d80391 100644 --- a/omd/packages/Python/Python.make +++ b/omd/packages/Python/Python.make @@ -11,11 +11,11 @@ PYTHON_INSTALL = $(BUILD_HELPER_DIR)/$(PYTHON_DIR)-install PYTHON_PATCHING = $(BUILD_HELPER_DIR)/$(PYTHON_DIR)-patching -.PHONY: python python-install python-skel python-clean upstream +.PHONY: Python Python-install Python-skel Python-clean upstream -python: $(PYTHON_BUILD) +Python: $(PYTHON_BUILD) -python-install: $(PYTHON_INSTALL) +Python-install: $(PYTHON_INSTALL) # Environment variables PATH_VAR := PATH="$(abspath bin):$$PATH" @@ -111,9 +111,9 @@ bin/g++: install -m 644 $(PACKAGE_DIR)/$(PYTHON)/sitecustomize.py $(PACKAGE_DIR)/$(PYTHON)/sitecustomize.pyc $(DESTDIR)$(OMD_ROOT)/lib/python2.7/ $(TOUCH) $(PYTHON_INSTALL) -pyhton-skel: +Python-skel: -python-clean: +Python-clean: $(RM) -r $(DIR) $(BUILD_HELPER_DIR)/$(MSITOOLS)* bin build $(PACKAGE_PYTHON_DESTDIR) upstream:
5 years, 10 months
1
0
0
0
Fixed invalid package names (python -> Python, check_mk_{enterprise, managed} -> {enterprise, managed}
by Lars Michelsen
Module: check_mk Branch: master Commit: eb32dfd6c8592e4d7ebef7fa135e549255c9f06b URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eb32dfd6c8592e…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Wed Nov 21 20:29:10 2018 +0100 Fixed invalid package names (python -> Python, check_mk_{enterprise,managed} -> {enterprise,managed} Change-Id: I26850927512d7d08a462f86791f62224215f02d5 --- omd/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/omd/Makefile b/omd/Makefile index 09cd3b3..512334b 100644 --- a/omd/Makefile +++ b/omd/Makefile @@ -19,7 +19,7 @@ include packages/packages.make PACKAGES := \ libgsf \ perl-modules \ - python \ + Python \ freetds \ re2 \ python-modules \ @@ -121,7 +121,10 @@ $(PRE_SKEL): install-global # Install skeleton files (subdirs skel/ in packages' directories) mkdir -p $(DESTDIR)$(OMD_ROOT)/skel @set -e ; cd packages ; for p in $(PACKAGES) ; do \ - if [ -d "$$p" ] && [ -d "$$p/skel" ] ; then \ + if [ ! -d "$$p" ] ; then \ + echo "Invalid package: $$p"; exit 1 ; \ + fi ; \ + if [ -d "$$p/skel" ] ; then \ tar cf - -C $$p/skel --exclude="*~" --exclude=".gitignore" . | tar xvf - -C $(DESTDIR)$(OMD_ROOT)/skel ; \ fi ;\ done
5 years, 10 months
1
0
0
0
Fixed some insecure subprocess calls
by Lars Michelsen
Module: check_mk Branch: master Commit: 43a4e48e6c2af5171502630417584601d5cf7bfd URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=43a4e48e6c2af5…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Nov 20 16:39:06 2018 +0100 Fixed some insecure subprocess calls Change-Id: I58fe0bc2652056b11df1a341656d077231842d6f --- omd/packages/maintenance/diskspace | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/omd/packages/maintenance/diskspace b/omd/packages/maintenance/diskspace index e57341f..ce211bc 100755 --- a/omd/packages/maintenance/diskspace +++ b/omd/packages/maintenance/diskspace @@ -1,6 +1,11 @@ #!/usr/bin/env python -import os, sys, time, random, glob, traceback +import os +import sys +import time +import random +import glob +import traceback import subprocess from cmk.render import fmt_bytes @@ -132,9 +137,9 @@ def collect_file_infos(): def get_free_space(): # FIXME: Take eventual root reserved space into account - for l in os.popen('df -P -B1 ' + omd_root).readlines(): + for l in subprocess.check_output(['df', '-P', '-B1', omd_root]).split("\n"): if l[0] == '/': - vol, size_bytes, used_bytes, free_bytes, used_perc, mp = l.split() + _vol, _size_bytes, _used_bytes, free_bytes, _used_perc, _mp = l.split() return int(free_bytes) @@ -183,7 +188,7 @@ def cleanup_aged(): max_age = time.time() - max_file_age for plugin in plugins.values(): - for path, (size, mtime) in plugin.get('file_infos', {}).items(): + for path, (_size, mtime) in plugin.get('file_infos', {}).items(): if mtime < max_age: if delete_file(path, 'too old'): del plugin['file_infos'][path]
5 years, 10 months
1
0
0
0
Re-enable pylint for omd; Fix unidiomatic-typecheck
by Lars Michelsen
Module: check_mk Branch: master Commit: 029c7d9a20c271a3e010107704c5e336189862c0 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=029c7d9a20c271…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Nov 20 17:49:54 2018 +0100 Re-enable pylint for omd; Fix unidiomatic-typecheck Change-Id: If053969122e2460ea5bea02f8384a071a56a80fb --- omd/packages/omd/omdlib/main.py | 6 +++--- tests/pylint/test_pylint.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/omd/packages/omd/omdlib/main.py b/omd/packages/omd/omdlib/main.py index 6fc5f1f..b4e1726 100644 --- a/omd/packages/omd/omdlib/main.py +++ b/omd/packages/omd/omdlib/main.py @@ -2018,7 +2018,7 @@ def validate_config_change_commands(config_hooks, settings): # Check if value is valid. Choices are either a list of allowed # keys or a regular expression - if type(hook["choices"]) == list: + if isinstance(hook["choices"], list): choices = [var for (var, _descr) in hook["choices"]] if value not in choices: bail_out("Invalid value %r for %r. Allowed are: %s\n" % \ @@ -2048,7 +2048,7 @@ def config_set(site, config_hooks, args): # Check if value is valid. Choices are either a list of allowed # keys or a regular expression - if type(hook["choices"]) == list: + if isinstance(hook["choices"], list): choices = [var for (var, _descr) in hook["choices"]] if value not in choices: sys.stderr.write("Invalid value for '%s'. Allowed are: %s\n" % \ @@ -2199,7 +2199,7 @@ def config_configure_hook(site, config_hooks, hook_name): descr = hook["description"].replace("\n\n", "\001").replace("\n", " ").replace("\001", "\n\n") value = site.conf[hook_name] choices = hook["choices"] - if type(choices) == list: + if isinstance(choices, list): dialog_function = dialog_menu else: dialog_function = dialog_regex diff --git a/tests/pylint/test_pylint.py b/tests/pylint/test_pylint.py index 078ddff..a09747e 100755 --- a/tests/pylint/test_pylint.py +++ b/tests/pylint/test_pylint.py @@ -10,6 +10,7 @@ import shutil from testlib import cmk_path, cmc_path, cme_path, repo_path import testlib.pylint_cmk as pylint_cmk + @pytest.fixture(scope="function") def pylint_test_dir(): base_path = os.environ.get("WORKDIR") @@ -36,6 +37,9 @@ def pylint_test_dir(): def test_pylint(pylint_test_dir): # Only specify the path to python packages or modules here modules_or_packages = [ + # OMD + "omd/packages/omd/omdlib", + # Check_MK base "cmk_base", # TODO: Check if this kind of "overlay" really works. @@ -69,7 +73,7 @@ def test_pylint(pylint_test_dir): # We use our own search logic to find scripts without python extension search_paths = [ - "omd/packages/omd", + "omd/packages/omd.bin", "bin", "notifications", "agents/plugins", @@ -83,7 +87,7 @@ def test_pylint(pylint_test_dir): for path in search_paths: abs_path = cmk_path() + "/" + path for fname in pylint_cmk.get_pylint_files(abs_path, "*"): - modules_or_packages.append(path + "/" + fname) + modules_or_packages.append(path + "/" + fname) exit_code = pylint_cmk.run_pylint(cmk_path(), modules_or_packages) assert exit_code == 0, "PyLint found an error" @@ -139,7 +143,8 @@ def inv_tree(path, default_value=None): def _compile_bakery_plugins(pylint_test_dir): with open(pylint_test_dir + "/cmk_bakery_plugins.py", "w") as f: - pylint_cmk.add_file(f, os.path.realpath(os.path.join(cmc_path(), "cmk_base/cee/agent_bakery_plugins.py"))) + pylint_cmk.add_file( + f, os.path.realpath(os.path.join(cmc_path(), "cmk_base/cee/agent_bakery_plugins.py"))) # This pylint warning is incompatible with our "concatenation technology". f.write("# pylint: disable=reimported\n")
5 years, 10 months
1
0
0
0
Fixed some insecure subprocess calls in omd
by Lars Michelsen
Module: check_mk Branch: master Commit: 9ad448b63fd0a56a86439f76c964f41717366664 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9ad448b63fd0a5…
Author: Lars Michelsen <lm(a)mathias-kettner.de> Date: Tue Nov 20 20:26:09 2018 +0100 Fixed some insecure subprocess calls in omd Change-Id: I78207dc5bf1df31061b26476958f51212f859707 --- omd/packages/omd/omdlib/main.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/omd/packages/omd/omdlib/main.py b/omd/packages/omd/omdlib/main.py index b4e1726..706d7f3 100644 --- a/omd/packages/omd/omdlib/main.py +++ b/omd/packages/omd/omdlib/main.py @@ -268,7 +268,7 @@ def user_confirms(site, title, message, relpath, yes_choice, yes_text, no_choice elif choice == "shell": thedir = "/".join(user_path.split("/")[:-1]) sys.stdout.write("\n Starting BASH. Type CTRL-D to continue.\n\n") - os.system("cd '%s' ; bash -i" % thedir) + subprocess.Popen(["bash", "-i"], cwd=thedir).wait() else: return choice == yes_choice @@ -388,7 +388,10 @@ def ask_user_choices(title, message, choices): def find_processes_of_user(username): try: - return os.popen("pgrep -u '%s'" % username).read().split() + return subprocess.Popen(["pgrep", "-u", username], + stdin=open(os.devnull, "r"), + stdout=subprocess.PIPE, + close_fds=True).stdout.read().split() except: return [] @@ -409,12 +412,16 @@ def groupdel(groupname): def groupadd(groupname, gid=None): - cmd = "groupadd " + cmd = ["groupadd"] if gid is not None: - cmd += "-g %d " % int(gid) - cmd += groupname + cmd += ["-g", "%d" % int(gid)] + cmd.append(groupname) - if os.system(cmd) != 0: + if subprocess.Popen( + cmd, + close_fds=True, + stdin=open(os.devnull, "r"), + ).wait() != 0: bail_out("Cannot create group for site user.") @@ -523,8 +530,8 @@ def group_id(name): def user_logged_in(name): - # Check, if processes of named user are existing - return os.system("ps --no-headers --user '%s' >/dev/null 2>&1" % name) == 0 + """Check if processes of named user are existing""" + return any(p for p in psutil.process_iter() if p.username() == name) def user_verify(site, allow_populated=False): @@ -579,7 +586,9 @@ def switch_to_site_user(site): def groups_of(username): - return map(int, os.popen("id -G '%s'" % username).read().split()) + group_ids = set([g.gr_gid for g in grp.getgrall() if username in g.gr_mem]) + group_ids.add(pwd.getpwnam(username).pw_gid) + return list(group_ids) #. @@ -1622,7 +1631,7 @@ def unmount_tmpfs(site, output=True, kill=False): sys.stdout.write("Unmounting temporary filesystem...") for _t in range(0, 10): - if os.system("umount '%s'" % site.tmp_dir) == 0: + if subprocess.call(["umount", site.tmp_dir]) == 0: if output: ok() return True @@ -1630,7 +1639,7 @@ def unmount_tmpfs(site, output=True, kill=False): if kill: if output: sys.stdout.write("Killing processes still using '%s'\n" % site.tmp_dir) - os.system("fuser --silent -k '%s'" % site.tmp_dir) + subprocess.call(["fuser", "--silent", "-k", site.tmp_dir]) if output: sys.stdout.write(kill and "K" or ".") @@ -2362,7 +2371,7 @@ def init_cmd(name, action): def reload_apache(): sys.stdout.write("Reloading Apache...") sys.stdout.flush() - show_success(os.system("%s graceful" % g_info.APACHE_CTL) >> 8) + show_success(subprocess.call([g_info.APACHE_CTL, "graceful"]) >> 8) def restart_apache():
5 years, 10 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
47
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Results per page:
10
25
50
100
200