Skip to content
Permalink
Browse files

Revert "check_sql: Migrate to Python 3"

This reverts commit 0a4cb16.
  • Loading branch information
LarsMichelsen committed Jan 9, 2020
1 parent 2838e6b commit 97a9452543b34d6e2974c8e03b3b2cd207f3d5a3
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
@@ -238,7 +238,7 @@ def _default_execute(cursor, cmd, inpt, procedure):


def postgres_connect(host, port, db_name, user, pwd):
import psycopg2 # type: ignore[import] # pylint: disable=import-outside-toplevel
import psycopg2
return psycopg2.connect(host=host, port=port, \
database=db_name, user=user, password=pwd)

@@ -248,7 +248,7 @@ def postgres_execute(cursor, cmd, inpt, procedure):


def mysql_connect(host, port, db_name, user, pwd):
import MySQLdb # type: ignore[import] # pylint: disable=import-outside-toplevel
import MySQLdb
return MySQLdb.connect(host=host, port=port, db=db_name, \
user=user, passwd=pwd)

@@ -258,7 +258,7 @@ def mysql_execute(cursor, cmd, inpt, procedure):


def mssql_connect(host, port, db_name, user, pwd):
import pymssql # type: ignore[import] # pylint: disable=import-outside-toplevel
import pymssql
return pymssql.connect(host=host, port=port, \
database=db_name, user=user, password=pwd)

@@ -279,7 +279,7 @@ def oracle_connect(host, port, db_name, user, pwd):
sys.path.append('/usr/lib/python%s.%s/site-packages' %
(sys.version_info.major, sys.version_info.minor))
try:
import cx_Oracle # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel
import cx_Oracle # pylint: disable=import-error
except ImportError as exc:
bail_out(3, "%s. Please install it via 'pip install cx_Oracle'." % exc)

@@ -289,7 +289,7 @@ def oracle_connect(host, port, db_name, user, pwd):

def oracle_execute(cursor, cmd, inpt, procedure):
try:
import cx_Oracle # pylint: disable=import-error,import-outside-toplevel
import cx_Oracle # pylint: disable=import-error
except ImportError as exc:
bail_out(3, "%s. Please install it via 'pip install cx_Oracle'." % exc)

@@ -326,8 +326,8 @@ def oracle_execute(cursor, cmd, inpt, procedure):
def db2_connect(host, port, db_name, user, pwd):
# IBM data server driver
try:
import ibm_db # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel
import ibm_db_dbi # type: ignore[import] # pylint: disable=import-error,import-outside-toplevel
import ibm_db # pylint: disable=import-error
import ibm_db_dbi # pylint: disable=import-error
except ImportError as exc:
bail_out(3, "%s. Please install it via pip." % exc)

This file was deleted.

This file was deleted.

@@ -2,9 +2,7 @@ PYTHON3_MODULES := python3-modules
PYTHON3_MODULES_VERS := $(OMD_VERSION)
PYTHON3_MODULES_DIR := $(PYTHON3_MODULES)-$(PYTHON3_MODULES_VERS)

PYTHON3_MODULES_UNPACK := $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-unpack
# The custom patching rule for python-modules needs to be called
PYTHON3_MODULES_PATCHING := $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-patching-c
PYTHON3_MODULES_UNPACK:= $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-unpack
PYTHON3_MODULES_BUILD := $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-build
PYTHON3_MODULES_INTERMEDIATE_INSTALL := $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-install-intermediate
PYTHON3_MODULES_INSTALL := $(BUILD_HELPER_DIR)/$(PYTHON3_MODULES_DIR)-install
@@ -13,8 +11,6 @@ PYTHON3_MODULES_INSTALL_DIR := $(INTERMEDIATE_INSTALL_BASE)/$(PYTHON3_MODULES_DI
PYTHON3_MODULES_BUILD_DIR := $(PACKAGE_BUILD_DIR)/$(PYTHON3_MODULES_DIR)
PYTHON3_MODULES_WORK_DIR := $(PACKAGE_WORK_DIR)/$(PYTHON3_MODULES_DIR)

PYTHON3_MODULES_PATCHES := $(wildcard $(PACKAGE_DIR)/$(PYTHON3_MODULES)/patches/*.dif)

# Used by other OMD packages
PACKAGE_PYTHON3_MODULES_DESTDIR := $(PYTHON3_MODULES_INSTALL_DIR)
PACKAGE_PYTHON3_MODULES_PYTHONPATH := $(PACKAGE_PYTHON3_MODULES_DESTDIR)/lib/python3
@@ -58,13 +54,9 @@ PYTHON3_MODULES_LIST += requests-kerberos-0.12.0.tar.gz
PYTHON3_MODULES_LIST += psutil-5.6.7.tar.gz # needed for omdlib
PYTHON3_MODULES_LIST += passlib-1.7.2.tar.gz # needed for omdlib

PYTHON3_MODULES_LIST += mysqlclient-1.4.6.tar.gz # needed by check_sql
PYTHON3_MODULES_LIST += psycopg2-2.6.2.tar.gz # needed by check_sql
PYTHON3_MODULES_LIST += pymssql-2.1.4.tar.gz # needed for check_sql (together with freetds)

# TODO: Can we clean this up and use the intermediate install step results? Would be possible
# in the moment we merge the build and intermediate install in a single target
$(PYTHON3_MODULES_BUILD): $(PYTHON3_CACHE_PKG_PROCESS) $(OPENSSL_INTERMEDIATE_INSTALL) $(FREETDS_INTERMEDIATE_INSTALL) $(PYTHON3_MODULES_PATCHING)
$(PYTHON3_MODULES_BUILD): $(PYTHON3_CACHE_PKG_PROCESS) $(OPENSSL_INTERMEDIATE_INSTALL) $(FREETDS_INTERMEDIATE_INSTALL) $(PYTHON3_MODULES_UNPACK)
set -e ; cd $(PYTHON3_MODULES_BUILD_DIR) ; \
unset DESTDIR MAKEFLAGS ; \
$(MKDIR) $(PACKAGE_PYTHON3_MODULES_PYTHONPATH) ; \
@@ -105,14 +97,6 @@ $(PYTHON3_MODULES_UNPACK): $(addprefix $(PACKAGE_DIR)/$(PYTHON3_MODULES)/src/,$(
$(MKDIR) $(BUILD_HELPER_DIR)
$(TOUCH) $@

$(PYTHON3_MODULES_PATCHING): $(PYTHON3_MODULES_UNPACK)
echo $(PYTHON3_MODULES_PATCHES)
set -e ; for p in $$(echo $(PYTHON3_MODULES_PATCHES) | tr " " "\n" | sort); do \
echo "applying $$p..." ; \
patch -p1 -b -d $(PYTHON3_MODULES_BUILD_DIR) < $$p ; \
done
$(TOUCH) $@

$(PYTHON3_MODULES_INTERMEDIATE_INSTALL): $(PYTHON3_MODULES_BUILD)
# Ensure all native modules have the correct rpath set
set -e ; for F in $$(find $(PACKAGE_PYTHON3_MODULES_PYTHONPATH) -name \*.so); do \
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -58,9 +58,6 @@ requests = { version = "==2.22.0", extras = ["security"] } # needed by DCD
requests-kerberos = "==0.12.0" # needed for check_bi_aggr
passlib = "==1.7.2" # needed for omdlib
psutil = "==5.6.7" # needed for omdlib
mysqlclient = "==1.4.6" # needed by check_sql
psycopg2 = "==2.7.6.1" # needed by check_sql. This is actually a lie: We ship 2.6.2, but installation fails for PostgreSQL > 9. Alas, 2.7 removed support for clients < 9.1. >:-(
pymssql = "==2.1.4" # needed by check_sql

[requires]
python_version = "3.7"

Some generated files are not rendered by default. Learn more.

0 comments on commit 97a9452

Please sign in to comment.
You can’t perform that action at this time.