Module: check_mk
Branch: master
Commit: 472aabc3638c569b1acb3da9b2646115ea025f4a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=472aabc3638c56…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 11 12:06:37 2019 +0100
Remove ancient cmk --donate command
This function was used by the demo site. This mechanism was not used by
many users and is not working with the current demo site.
CMK-661
Change-Id: I1ccc9d8ebb2b63e22e960733b1ef7431d04ca9f6
---
cmk_base/default_config/base.py | 4 ---
cmk_base/donate.py | 61 --------------------------------
cmk_base/modes/check_mk.py | 35 ------------------
tests/integration/cmk_base/test_modes.py | 19 ----------
4 files changed, 119 deletions(-)
diff --git a/cmk_base/default_config/base.py b/cmk_base/default_config/base.py
index e3d925c..869af24 100644
--- a/cmk_base/default_config/base.py
+++ b/cmk_base/default_config/base.py
@@ -28,8 +28,6 @@
# variables that can be overridden in main.mk. Some configuration
# variables are preset in checks/* as well.
-import cmk as _cmk
-
# TODO: Remove the duplication with cmk_base.config
_ALL_HOSTS = ['@all'] # physical and cluster hosts
_NEGATE = '@negate' # negation in boolean lists
@@ -187,8 +185,6 @@ extra_host_conf = {}
extra_service_conf = {}
extra_nagios_conf = ""
service_descriptions = {}
-donation_hosts = []
-donation_command = 'mail -r checkmk(a)yoursite.de -s "Host donation %s"
donatehosts(a)mathias-kettner.de' % _cmk.__version__
scanparent_hosts = [(_ALL_HOSTS)]
host_attributes = {} # needed by WATO, ignored by Check_MK
ping_levels = [] # special parameters for host/PING check_command
diff --git a/cmk_base/donate.py b/cmk_base/donate.py
deleted file mode 100644
index 123a690..0000000
--- a/cmk_base/donate.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8; py-indent-offset: 4 -*-
-# +------------------------------------------------------------------+
-# | ____ _ _ __ __ _ __ |
-# | / ___| |__ ___ ___| | __ | \/ | |/ / |
-# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-# | | |___| | | | __/ (__| < | | | | . \ |
-# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-# | |
-# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
-# +------------------------------------------------------------------+
-#
-# This file is part of Check_MK.
-# The official homepage is at
http://mathias-kettner.de/check_mk.
-#
-# check_mk is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation in version 2. check_mk is distributed
-# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU General Public License for more de-
-# tails. You should have received a copy of the GNU General Public
-# License along with GNU Make; see the file COPYING. If not, write
-# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-import base64
-import os
-import sys
-
-import cmk.utils.paths
-
-import cmk_base.config as config
-import cmk_base.console as console
-
-
-def do_donation():
- donate = []
- cache_files = os.listdir(cmk.utils.paths.tcp_cache_dir)
- for host in config.all_active_realhosts():
- if config.in_binary_hostlist(host, config.donation_hosts):
- for f in cache_files:
- if f == host or f.startswith("%s." % host):
- donate.append(f)
-
- if not donate:
- console.error("No hosts specified. You need to set donation_hosts in
main.mk.\n")
- sys.exit(1)
-
- console.verbose("Donating files %s\n" % " ".join(cache_files))
- indata = base64.b64encode(
- os.popen( # nosec
- "tar czf - -C %s %s" % (cmk.utils.paths.tcp_cache_dir, "
".join(donate))).read())
-
- output = os.popen(config.donation_command, "w") # nosec
- output.write("\n\n@STARTDATA\n")
- while len(indata) > 0:
- line = indata[:64]
- output.write(line)
- output.write('\n')
- indata = indata[64:]
diff --git a/cmk_base/modes/check_mk.py b/cmk_base/modes/check_mk.py
index 84b55dd..a9a7931 100644
--- a/cmk_base/modes/check_mk.py
+++ b/cmk_base/modes/check_mk.py
@@ -51,7 +51,6 @@ import cmk_base.data_sources.abstract
import cmk_base.core_nagios
import cmk_base.parent_scan
import cmk_base.dump_host
-import cmk_base.donate
import cmk_base.backup
import cmk_base.packaging
import cmk_base.localize
@@ -562,40 +561,6 @@ modes.register(
))
#.
-# .--donate--------------------------------------------------------------.
-# | _ _ |
-# | __| | ___ _ __ __ _| |_ ___ |
-# | / _` |/ _ \| '_ \ / _` | __/ _ \ |
-# | | (_| | (_) | | | | (_| | || __/ |
-# | \__,_|\___/|_| |_|\__,_|\__\___| |
-# | |
-# '----------------------------------------------------------------------'
-
-
-def mode_donate():
- cmk_base.donate.do_donation()
-
-
-modes.register(
- Mode(
- long_option="donate",
- handler_function=mode_donate,
- short_help="Email data of configured hosts to MK",
- long_help=[
- "This is for those who decided to help the Check_MK project "
- "by donating live host data. It tars the cached agent data of "
- "those host which are configured in main.mk:donation_hosts and sends
"
- "them via email to donatehosts(a)mathias-kettner.de. The host data "
- "is then publicly available for others and can be used for setting
"
- "up demo sites, implementing checks and so on.",
- "Do this only with test data from test hosts - not with productive
"
- "data! By donating real-live host data you help others trying out
"
- "Check_MK and developing checks by donating hosts. This is completely
"
- "voluntary and turned off by default."
- ],
- ))
-
-#.
# .--backup/restore------------------------------------------------------.
# | _ _ __ _ |
# | | |__ __ _ ___| | ___ _ _ __ / / __ ___ ___| |_ |
diff --git a/tests/integration/cmk_base/test_modes.py
b/tests/integration/cmk_base/test_modes.py
index f81b0ee..19639f0 100644
--- a/tests/integration/cmk_base/test_modes.py
+++ b/tests/integration/cmk_base/test_modes.py
@@ -277,25 +277,6 @@ def test_paths(test_cfg, site):
#.
-# .--donate--------------------------------------------------------------.
-# | _ _ |
-# | __| | ___ _ __ __ _| |_ ___ |
-# | / _` |/ _ \| '_ \ / _` | __/ _ \ |
-# | | (_| | (_) | | | | (_| | || __/ |
-# | \__,_|\___/|_| |_|\__,_|\__\___| |
-# | |
-# '----------------------------------------------------------------------'
-
-
-def test_donate_no_hosts(test_cfg, site):
- p = site.execute(["cmk", "--donate"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- stdout, stderr = p.communicate()
- assert p.wait() == 1
- assert stderr.startswith("No hosts specified.")
- assert stdout == ""
-
-
-#.
# .--backup/restore------------------------------------------------------.
# | _ _ __ _ |
# | | |__ __ _ ___| | ___ _ _ __ / / __ ___ ___| |_ |