Module: check_mk
Branch: master
Commit: 583f402a470e472626a69b0bb9d9b907cf2e13ca
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=583f402a470e47…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Dec 3 16:00:06 2018 +0100
Small steps towards enabling wrong-import-position.
Change-Id: I47b324ef4bdd01a82b83618f018c2071dca1daca
---
agents/plugins/mk_tinkerforge | 6 +++---
agents/special/agent_tinkerforge | 6 +++---
bin/check_mk | 4 +++-
bin/mkbackup | 4 ++--
cmk/gui/key_mgmt.py | 4 +++-
cmk/gui/plugins/views/utils.py | 3 +--
cmk_base/packaging.py | 3 +--
tests/pylint/test_pylint.py | 4 ++--
8 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/agents/plugins/mk_tinkerforge b/agents/plugins/mk_tinkerforge
index 865df75..3ee5d8e 100755
--- a/agents/plugins/mk_tinkerforge
+++ b/agents/plugins/mk_tinkerforge
@@ -63,6 +63,9 @@
import sys
import os
+from optparse import OptionParser
+import time
+
def install():
dest = os.path.dirname(os.path.realpath(__file__))
@@ -96,9 +99,6 @@ DEFAULT_SETTINGS = {
'segment_display_brightness': 2
}
-from optparse import OptionParser
-import time
-
# globals
segment_display_value = None
segment_display_unit = ""
diff --git a/agents/special/agent_tinkerforge b/agents/special/agent_tinkerforge
index 7b6744c..b42b810 100755
--- a/agents/special/agent_tinkerforge
+++ b/agents/special/agent_tinkerforge
@@ -59,6 +59,9 @@
import os
+from optparse import OptionParser
+import time
+
DEFAULT_SETTINGS = {
'host': "localhost",
'port': 4223,
@@ -66,9 +69,6 @@ DEFAULT_SETTINGS = {
'segment_display_brightness': 2
}
-from optparse import OptionParser
-import time
-
# globals
segment_display_value = None
segment_display_unit = ""
diff --git a/bin/check_mk b/bin/check_mk
index f087e30..5dc93b9 100755
--- a/bin/check_mk
+++ b/bin/check_mk
@@ -36,7 +36,9 @@ import sys
import getopt
# Needs to be placed before cmk modules, because they are not available
-# when executed as non site user.
+# when executed as non site user. Alas, this screws up our import ordering
+# a bit, so we have to tell pylint about that.
+# pylint: disable=wrong-import-position
if not os.environ.get("OMD_SITE"):
sys.stderr.write("Check_MK can be used only as site user.\n")
sys.exit(1)
diff --git a/bin/mkbackup b/bin/mkbackup
index 213173c..5c59f81 100755
--- a/bin/mkbackup
+++ b/bin/mkbackup
@@ -24,8 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-VERSION = "1.4.0i1"
-
import ast
import errno
import fcntl
@@ -61,6 +59,8 @@ import cmk.schedule as schedule
import cmk.store as store
from cmk.exceptions import MKTerminate, MKGeneralException
+VERSION = "1.4.0i1"
+
# Is used to duplicate output from stdout/stderr to a the job log. This
# is e.g. used during "mkbackup backup" to store the output.
diff --git a/cmk/gui/key_mgmt.py b/cmk/gui/key_mgmt.py
index 561fbd5..4f052e0 100644
--- a/cmk/gui/key_mgmt.py
+++ b/cmk/gui/key_mgmt.py
@@ -30,8 +30,10 @@ import time
# This is needed for at least CentOS 5.5
# TODO: Drop this until all supported platforms have newer versions available.
+# It it not 100% sure if we need this before the OpenSSL import, but we play
+# safe here and tell pylint about that.
+# pylint: disable=wrong-import-position
os.environ["CRYPTOGRAPHY_ALLOW_OPENSSL_098"] = "1"
-
from OpenSSL import crypto
import cmk.render
diff --git a/cmk/gui/plugins/views/utils.py b/cmk/gui/plugins/views/utils.py
index 385acdb..f4c3b63 100644
--- a/cmk/gui/plugins/views/utils.py
+++ b/cmk/gui/plugins/views/utils.py
@@ -51,6 +51,7 @@ from cmk.gui.htmllib import HTML
from cmk.gui.i18n import _
from cmk.gui.globals import html
from cmk.gui.exceptions import MKGeneralException
+from cmk.gui.display_options import display_options
# TODO: Better name it PainterOptions or DisplayOptions? There are options which only
affect
@@ -293,8 +294,6 @@ def view_title(view):
return visuals.visual_title('view', view)
-from cmk.gui.display_options import display_options
-
# TODO: Move this to view processing code. This must not be module global as
# it contains request specific information
painter_options = PainterOptions()
diff --git a/cmk_base/packaging.py b/cmk_base/packaging.py
index 4cbd9a6..ae55be4 100644
--- a/cmk_base/packaging.py
+++ b/cmk_base/packaging.py
@@ -39,10 +39,9 @@ import cmk.paths
import cmk.ec.export
import cmk.log
-logger = cmk.log.get_logger(__name__)
-
import cmk_base.utils
+logger = cmk.log.get_logger(__name__)
pac_ext = ".mkp"
diff --git a/tests/pylint/test_pylint.py b/tests/pylint/test_pylint.py
index 8312049..1a8d795 100755
--- a/tests/pylint/test_pylint.py
+++ b/tests/pylint/test_pylint.py
@@ -127,7 +127,7 @@ def inv_tree(path, default_value=None):
# add the modules
# These pylint warnings are incompatible with our "concatenation
technology".
- f.write("# pylint:
disable=reimported,ungrouped-imports,wrong-import-order\n")
+ f.write("# pylint:
disable=reimported,ungrouped-imports,wrong-import-order,wrong-import-position\n")
pylint_cmk.add_file(f, repo_path() + "/cmk_base/check_api.py")
pylint_cmk.add_file(f, repo_path() + "/cmk_base/inventory_plugins.py")
@@ -146,7 +146,7 @@ def _compile_bakery_plugins(pylint_test_dir):
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,wrong-import-order\n")
+ f.write("# pylint:
disable=reimported,wrong-import-order,wrong-import-position\n")
# Also add bakery plugins
for path in pylint_cmk.check_files(os.path.join(cmc_path(),
"agents/bakery")):