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
mk_logwatch: minor refactoring
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 10bca23d6da3b2c3b956b2e6d313a68a7838b664 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=10bca23d6da3b2…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Wed Oct 31 10:56:58 2018 +0100 mk_logwatch: minor refactoring Move some code from the global namespace to the appropriate place. Push the remaining global variables to the top of the file. Change-Id: If4b32b3b2b923bae055f543078a63d94e8366db4 --- agents/plugins/mk_logwatch | 56 +++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch index eb27781..05100c0 100755 --- a/agents/plugins/mk_logwatch +++ b/agents/plugins/mk_logwatch @@ -33,6 +33,23 @@ import shutil import sys import time +if '-d' in sys.argv[1:] or '--debug' in sys.argv[1:]: + tty_red = '\033[1;31m' + tty_green = '\033[1;32m' + tty_yellow = '\033[1;33m' + tty_blue = '\033[1;34m' + tty_normal = '\033[0m' + debug = True +else: + tty_red = '' + tty_green = '' + tty_yellow = '' + tty_blue = '' + tty_normal = '' + debug = False + +pushed_back_line = None + # .--MEI-Cleanup---------------------------------------------------------. # | __ __ _____ ___ ____ _ | # | | \/ | ____|_ _| / ___| | ___ __ _ _ __ _ _ _ __ | @@ -108,21 +125,6 @@ class MEIFolderCleaner(object): pass #. -if '-d' in sys.argv[1:] or '--debug' in sys.argv[1:]: - tty_red = '\033[1;31m' - tty_green = '\033[1;32m' - tty_yellow = '\033[1;33m' - tty_blue = '\033[1;34m' - tty_normal = '\033[0m' - debug = True -else: - tty_red = '' - tty_green = '' - tty_yellow = '' - tty_blue = '' - tty_normal = '' - debug = False - # The configuration file and status file are searched # in the directory named by the environment variable @@ -137,16 +139,6 @@ def mk_confdir(): return os.getenv("LOGWATCH_DIR") or os.getenv("MK_CONFDIR") or "." -config_filename = mk_confdir() + "/logwatch.cfg" -config_dir = mk_confdir() + "/logwatch.d/*.cfg" - -sys.stdout.write("<<<logwatch>>>\n") - -# Copy the last known state from the logwatch.state when there is no status_filename yet. -if not os.path.exists(status_filename()) and os.path.exists("%s/logwatch.state" % mk_vardir()): - shutil.copy("%s/logwatch.state" % mk_vardir(), status_filename()) - - def status_filename(): # Determine the name of the state file # $REMOTE set -> logwatch.state.$REMOTE @@ -191,6 +183,8 @@ def parse_pattern(level, pattern, line): def read_config(): + config_filename = mk_confdir() + "/logwatch.cfg" + config_lines = [] try: config_lines += [ @@ -202,6 +196,7 @@ def read_config(): raise # Add config from a logwatch.d folder + config_dir = mk_confdir() + "/logwatch.d/*.cfg" for config_file in glob.glob(config_dir): config_lines += [ line.rstrip() for line in filter(is_not_comment, @@ -288,9 +283,6 @@ def save_status(status): f.write("%s|%d|%d\n" % (filename, offset, inode)) -pushed_back_line = None - - def next_line(file_handle): global pushed_back_line if pushed_back_line is not None: @@ -497,7 +489,6 @@ def process_logfile(logfile, patterns, opt, status): class Options(object): - MAP_OVERFLOW = {'C': 2, 'W': 1, 'I': 0, 'O': 0} MAP_BOOL = {'true': True, 'false': False} @@ -567,7 +558,6 @@ class Options(object): def parse_sections(config): - logfile_patterns = {} for filenames, patterns in config: @@ -597,6 +587,12 @@ def parse_sections(config): def main(): + sys.stdout.write("<<<logwatch>>>\n") + + # Copy the last known state from the logwatch.state when there is no status_filename yet. + if not os.path.exists(status_filename()) and os.path.exists("%s/logwatch.state" % mk_vardir()): + shutil.copy("%s/logwatch.state" % mk_vardir(), status_filename()) + try: # This removes leftover folders which may be generated by crashing frozen binaries folder_cleaner = MEIFolderCleaner()
5 years, 11 months
1
0
0
0
mk_logwatch: minor refactoring
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 41e59bb70fe3ff71d857c0fd381ae3fe20cd9de4 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41e59bb70fe3ff…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Wed Oct 31 11:20:15 2018 +0100 mk_logwatch: minor refactoring Extract function debug. Move the tty_colors to the appropriate place. Change-Id: I4d4f0d8dd84d29fd989de1460074a818c9f17d79 --- agents/plugins/mk_logwatch | 50 ++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch index 05100c0..b0ade70 100755 --- a/agents/plugins/mk_logwatch +++ b/agents/plugins/mk_logwatch @@ -33,21 +33,6 @@ import shutil import sys import time -if '-d' in sys.argv[1:] or '--debug' in sys.argv[1:]: - tty_red = '\033[1;31m' - tty_green = '\033[1;32m' - tty_yellow = '\033[1;33m' - tty_blue = '\033[1;34m' - tty_normal = '\033[0m' - debug = True -else: - tty_red = '' - tty_green = '' - tty_yellow = '' - tty_blue = '' - tty_normal = '' - debug = False - pushed_back_line = None # .--MEI-Cleanup---------------------------------------------------------. @@ -126,6 +111,10 @@ class MEIFolderCleaner(object): #. +def debug(): + return '-d' in sys.argv[1:] or '--debug' in sys.argv[1:] + + # The configuration file and status file are searched # in the directory named by the environment variable # LOGWATCH_DIR. If that is not set, MK_CONFDIR is used. @@ -192,7 +181,7 @@ def read_config(): file(config_filename).readlines()) ] except IOError: - if debug: + if debug(): raise # Add config from a logwatch.d folder @@ -242,7 +231,7 @@ def parse_cont_pattern(pattern): try: return re.compile(pattern) except: - if debug: + if debug(): raise raise Exception("Invalid regular expression in line '%s'" % pattern) @@ -252,7 +241,7 @@ def parse_cont_pattern(pattern): # /var/log/messages|7767698|32455445 # /var/test/x12134.log|12345|32444355 def read_status(): - if debug: + if debug(): return {} status = {} @@ -319,6 +308,19 @@ def is_inode_cabable(path): def process_logfile(logfile, patterns, opt, status): global pushed_back_line + if debug(): + tty_red = '\033[1;31m' + tty_green = '\033[1;32m' + tty_yellow = '\033[1;33m' + tty_blue = '\033[1;34m' + tty_normal = '\033[0m' + else: + tty_red = '' + tty_green = '' + tty_yellow = '' + tty_blue = '' + tty_normal = '' + # Look at which file offset we have finished scanning # the logfile last time. If we have never seen this file # before, we set the offset to -1 @@ -330,7 +332,7 @@ def process_logfile(logfile, patterns, opt, status): else: inode = os.fstat(file_desc)[1] # 1 = st_ino except: - if debug: + if debug(): raise sys.stdout.write("[[[%s:cannotopen]]]\n" % logfile) return @@ -345,7 +347,7 @@ def process_logfile(logfile, patterns, opt, status): # current pointer to the file end. We do not want to make # a fuss about ancient log messages... if offset == -1: - if not debug: + if not debug(): return else: offset = 0 @@ -461,7 +463,7 @@ def process_logfile(logfile, patterns, opt, status): break # matching rule found and executed color = {'C': tty_red, 'W': tty_yellow, 'O': tty_green, 'I': tty_blue, '.': ''}[level] - if debug: + if debug(): line = line.replace("\1", "\nCONT:") if level == "I": level = "." @@ -551,7 +553,7 @@ class Options(object): else: raise ValueError("Invalid option: %r" % opt_str) except ValueError, e: - if debug: + if debug(): raise sys.stdout.write("INVALID CONFIGURATION: %s\n" % e) sys.exit(1) @@ -604,7 +606,7 @@ def main(): try: config = read_config() except Exception, e: - if debug: + if debug(): raise sys.stdout.write("CANNOT READ CONFIG FILE: %s\n" % e) sys.exit(1) @@ -620,7 +622,7 @@ def main(): for logfile, (patterns, options) in parse_sections(config): process_logfile(logfile, patterns, options, status) - if not debug: + if not debug(): save_status(status)
5 years, 11 months
1
0
0
0
mk_logwatch: remove last global variable pushed_back_line
by Tom Baerwinkel
Module: check_mk Branch: master Commit: 79829965107894b361fcbfb9bdde10c0b6e27e91 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=79829965107894…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de> Date: Wed Oct 31 16:49:51 2018 +0100 mk_logwatch: remove last global variable pushed_back_line Change-Id: I0ff99d01b3d5aeb0459f13720ab3a760e6c0a723 --- agents/plugins/mk_logwatch | 47 +++++++++++++++++++++------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/agents/plugins/mk_logwatch b/agents/plugins/mk_logwatch index b0ade70..464d5ff 100755 --- a/agents/plugins/mk_logwatch +++ b/agents/plugins/mk_logwatch @@ -33,8 +33,6 @@ import shutil import sys import time -pushed_back_line = None - # .--MEI-Cleanup---------------------------------------------------------. # | __ __ _____ ___ ____ _ | # | | \/ | ____|_ _| / ___| | ___ __ _ _ __ _ _ _ __ | @@ -272,25 +270,22 @@ def save_status(status): f.write("%s|%d|%d\n" % (filename, offset, inode)) -def next_line(file_handle): - global pushed_back_line - if pushed_back_line is not None: - line = pushed_back_line - pushed_back_line = None - return line - else: - try: - line = file_handle.next() - # Avoid parsing of (yet) incomplete lines (when acutal application - # is just in the process of writing) - # Just check if the line ends with a \n. This handles \n and \r\n - if not line.endswith("\n"): - begin_of_line_offset = file_handle.tell() - len(line) - os.lseek(file_handle.fileno(), begin_of_line_offset, 0) - return None - return line - except: - return None +def next_line(file_handle, continuation_line): + if continuation_line is not None: + return continuation_line, None + + try: + line = file_handle.next() + # Avoid parsing of (yet) incomplete lines (when actual application + # is just in the process of writing) + # Just check if the line ends with a \n. This handles \n and \r\n + if not line.endswith("\n"): + begin_of_line_offset = file_handle.tell() - len(line) + os.lseek(file_handle.fileno(), begin_of_line_offset, 0) + return None, None + return line, None + except: + return None, None def is_inode_cabable(path): @@ -306,8 +301,6 @@ def is_inode_cabable(path): def process_logfile(logfile, patterns, opt, status): - global pushed_back_line - if debug(): tty_red = '\033[1;31m' tty_green = '\033[1;32m' @@ -389,13 +382,15 @@ def process_logfile(logfile, patterns, opt, status): file_handle = io.open(file_desc, encoding=use_encoding) else: file_handle = os.fdopen(file_desc) + worst = -1 outputtxt = "" lines_parsed = 0 start_time = time.time() + pushed_back_line = None while True: - line = next_line(file_handle) + line, pushed_back_line = next_line(file_handle, pushed_back_line) if line is None: break # End of file @@ -438,14 +433,14 @@ def process_logfile(logfile, patterns, opt, status): for cont_pattern in cont_patterns: if type(cont_pattern) == int: # add that many lines for _unused_x in range(cont_pattern): - cont_line = next_line(file_handle) + cont_line, pushed_back_line = next_line(file_handle, pushed_back_line) if cont_line is None: # end of file break line = line[:-1] + "\1" + cont_line else: # pattern is regex while True: - cont_line = next_line(file_handle) + cont_line, pushed_back_line = next_line(file_handle, pushed_back_line) if cont_line is None: # end of file break elif cont_pattern.search(cont_line[:-1]):
5 years, 11 months
1
0
0
0
Fix bug on parameter update in ps-check
by Óscar Nájera
Module: check_mk Branch: master Commit: 4191ef2387c3bb723a4b9dc03db0ca923ddb4c50 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4191ef2387c3bb…
Author: Óscar Nájera <on(a)mathias-kettner.de> Date: Fri Nov 2 17:15:03 2018 +0100 Fix bug on parameter update in ps-check Process count levels were overwritten, when parameters where from the newest configuration. Change-Id: Icd5efa4bfa0af2a833d048910d59e371767d8a44 --- checks/ps.include | 4 +-- tests/unit/checks/test_ps.py | 80 ++++++++++++++++++++++++++++++++------------ 2 files changed, 61 insertions(+), 23 deletions(-) diff --git a/checks/ps.include b/checks/ps.include index 2fb38f1..c1c6429 100644 --- a/checks/ps.include +++ b/checks/ps.include @@ -336,7 +336,7 @@ def ps_cleanup_params(params): params["user"] = user - elif isinstance(params, dict): + elif any(k in params for k in ['okmin', 'warnmin', 'okmax', 'warnmax']): params["levels"] = ( params.pop("warnmin", 1), params.pop("okmin", 1), @@ -430,7 +430,7 @@ def memory_check(processes, params): (processes.virtual_size, "virtual", "virtual_levels", "vsz"), (processes.resident_size, "physical", "resident_levels", "rss"), ]: - if size is None: + if size == 0: continue infotext = "%s %s" % (get_bytes_human_readable(size * 1024.0), title) diff --git a/tests/unit/checks/test_ps.py b/tests/unit/checks/test_ps.py index 08f088a..4921539 100644 --- a/tests/unit/checks/test_ps.py +++ b/tests/unit/checks/test_ps.py @@ -256,7 +256,9 @@ PS_DISCOVERY_WATO_RULES = [ ] PS_DISCOVERY_SPECS = [ - ("smss", "~smss.exe", None, None, {'cpu_rescale_max': None}), + ("smss", "~smss.exe", None, None, { + 'cpu_rescale_max': None + }), ("svchost", "svchost.exe", None, None, { "cpulevels": (90.0, 98.0), 'cpu_rescale_max': None, @@ -287,7 +289,9 @@ PS_DISCOVERY_SPECS = [ "single_cpulevels": (90.0, 98.0), "resident_levels": (104857600, 209715200) }), - ("sshd", "~.*sshd", None, None, {'cpu_rescale_max': None}), + ("sshd", "~.*sshd", None, None, { + 'cpu_rescale_max': None + }), ] @@ -486,19 +490,23 @@ def test_check_ps_common(check_manager, monkeypatch, inv_item, reference): parsed = sum([check.run_parse(info)[1] for info in generate_inputs()], []) total_ram = 1024**3 if inv_item[0] == "emacs" else None monkeypatch.setattr('time.time', lambda: 1540375342) + factory_defaults = {"levels": (1, 1, 99999, 99999)} + factory_defaults.update(inv_item[1]) test_result = CheckResult(check.context["check_ps_common"]( - inv_item[0], inv_item[1], parsed, total_ram=total_ram)) + inv_item[0], factory_defaults, parsed, total_ram=total_ram)) assertCheckResultsEqual(test_result, reference) cpu_config = namedtuple("CPU_config", "name agent_info cputime cpu_cores exp_load cpu_rescale_max") cpu_util_data = [ - cpu_config('linux no cpu scale conf 1 core', "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, 1, 50, None), - cpu_config('linux no cpu scale conf 2 cores', "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, 2, 50, None), - cpu_config('linux No_Core_division 2 cores', - "(on,105,30,00:00:{:02}/03:59:39,902) test", 120, 2, 200, False), - cpu_config('linux Core_division 2 cores', - "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, 2, 25, True), + cpu_config('linux no cpu scale conf 1 core', "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, 1, + 50, None), + cpu_config('linux no cpu scale conf 2 cores', "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, + 2, 50, None), + cpu_config('linux No_Core_division 2 cores', "(on,105,30,00:00:{:02}/03:59:39,902) test", 120, + 2, 200, False), + cpu_config('linux Core_division 2 cores', "(on,105,30,00:00:{:02}/03:59:39,902) test", 30, 2, + 25, True), cpu_config("Win no cpu scale conf 2 cores", "(\\KLAPPRECHNER\ab,105,30,0,3124,904,{0}0000000,{0}0000000,0,1,14340) test.exe", 54, 2, 90, None), @@ -508,14 +516,14 @@ cpu_util_data = [ cpu_config("Win Core_division 2 cores", "(\\KLAPPRECHNER\ab,105,30,0,3124,904,{0}0000000,{0}0000000,0,1,14340) test.exe", 54, 2, 90, True), - cpu_config('Solaris,BSD,etc no cpu conf 1 core', "(on,105,30,{}/03:59:39,902) test", - 30.8, 1, 30.8, None), - cpu_config('Solaris,BSD,etc no cpu conf 2 cores', "(on,105,30,{}/03:59:39,902) test", - 174.8, 2, 174.8, None), - cpu_config('Solaris,BSD,etc No_Core_division 2 cores', - "(on,105,30,{}/03:59:39,902) test", 174.8, 2, 174.8, False), - cpu_config('Solaris,BSD,etc Core_division 2 cores', - "(on,105,30,{}/03:59:39,902) test", 174.8, 2, 174.8 / 2, True), + cpu_config('Solaris,BSD,etc no cpu conf 1 core', "(on,105,30,{}/03:59:39,902) test", 30.8, 1, + 30.8, None), + cpu_config('Solaris,BSD,etc no cpu conf 2 cores', "(on,105,30,{}/03:59:39,902) test", 174.8, 2, + 174.8, None), + cpu_config('Solaris,BSD,etc No_Core_division 2 cores', "(on,105,30,{}/03:59:39,902) test", + 174.8, 2, 174.8, False), + cpu_config('Solaris,BSD,etc Core_division 2 cores', "(on,105,30,{}/03:59:39,902) test", 174.8, + 2, 174.8 / 2, True), ] @@ -530,10 +538,13 @@ def test_check_ps_common_cpu(check_manager, monkeypatch, data): return CheckResult(check.context["check_ps_common"]( inv_item[0], inv_item[1], parsed, cpu_cores=cpu_cores)) - inv_item = ("test", { - "process": "~test", - "user": None, - }) + inv_item = ( + "test", + { + "process": "~test", + "user": None, + "levels": (1, 1, 99999, 99999) # from factory defaults + }) if data.cpu_rescale_max is not None: inv_item[1].update({"cpu_rescale_max": data.cpu_rescale_max}) @@ -551,3 +562,30 @@ def test_check_ps_common_cpu(check_manager, monkeypatch, data): ]) assertCheckResultsEqual(output, reference) + + +(a)pytest.mark.parametrize("levels, reference", [ + ((1, 1, 99999, 99999), + CheckResult([ + (2, "0 processes: (ok from 1 to 99999)", [("count", 0, 100000, 100000, 0)]), + (0, "0.0% CPU", [("pcpu", 0)]), + ])), + ((0, 0, 99999, 99999), + CheckResult([ + (0, "0 processes", [("count", 0, 100000, 100000, 0)]), + (0, "0.0% CPU", [("pcpu", 0)]), + ])), +]) +def test_check_ps_common_count(check_manager, levels, reference): + check = check_manager.get_check("ps") + + parsed = check.run_parse(splitter("(on,105,30,00:00:{:02}/03:59:39,902) single"))[1] + + params = { + "process": "~test", + "user": None, + "levels": levels, + } + + output = CheckResult(check.context["check_ps_common"]('empty', params, parsed, cpu_cores=1)) + assertCheckResultsEqual(output, reference)
5 years, 11 months
1
0
0
0
Added a few patches back which got lost in 010c2052c.
by Sven Panne
Module: check_mk Branch: master Commit: f841e959096d7e84cb262982afce03414d9b2f50 URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f841e959096d7e…
Author: Sven Panne <sp(a)mathias-kettner.de> Date: Mon Nov 5 15:31:27 2018 +0100 Added a few patches back which got lost in 010c2052c. Change-Id: I1f538b5d494c62599fa7a526e5bdae7654c5a41b --- .../patches/0007-psycopg-wrong-ifdef.dif | 19 +++++++++++++ ...0016-make-psycopg2-build-with-ubuntu-bionic.dif | 31 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/omd/packages/python-modules/patches/0007-psycopg-wrong-ifdef.dif b/omd/packages/python-modules/patches/0007-psycopg-wrong-ifdef.dif new file mode 100644 index 0000000..2fd36ad --- /dev/null +++ b/omd/packages/python-modules/patches/0007-psycopg-wrong-ifdef.dif @@ -0,0 +1,19 @@ +diff -Nur dest/psycopg2-2.6.2.orig/psycopg/lobject_type.c dest/psycopg2-2.6.2/psycopg/lobject_type.c > patches/0007-psycopg-wrong-ifdef.dif +--- dest/psycopg2-2.6.2.orig/psycopg/lobject_type.c 2016-07-07 04:16:24.000000000 +0200 ++++ dest/psycopg2-2.6.2/psycopg/lobject_type.c 2017-01-10 10:31:42.291540705 +0100 +@@ -306,7 +306,7 @@ + + Py_RETURN_NONE; + } +- ++#endif + + /** the lobject object **/ + +@@ -475,6 +475,3 @@ + 0, /*tp_alloc*/ + lobject_new, /*tp_new*/ + }; +- +-#endif +- diff --git a/omd/packages/python-modules/patches/0016-make-psycopg2-build-with-ubuntu-bionic.dif b/omd/packages/python-modules/patches/0016-make-psycopg2-build-with-ubuntu-bionic.dif new file mode 100644 index 0000000..a1118e3 --- /dev/null +++ b/omd/packages/python-modules/patches/0016-make-psycopg2-build-with-ubuntu-bionic.dif @@ -0,0 +1,31 @@ +diff -Nur dest.orig/psycopg2-2.6.2/setup.py dest/psycopg2-2.6.2/setup.py +--- dest.orig/psycopg2-2.6.2/setup.py 2016-07-07 02:16:24.000000000 +0000 ++++ dest/psycopg2-2.6.2/setup.py 2018-04-20 16:11:18.575206167 +0000 +@@ -410,19 +410,24 @@ + pgversion = "7.4.0" + + verre = re.compile( +- r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))") ++ r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?") + m = verre.match(pgversion) + if m: + pgmajor, pgminor, pgpatch = m.group(1, 2, 3) ++ # Postgres >= 10 doesn't have pgminor anymore. ++ pgmajor = int(pgmajor) ++ if pgmajor >= 10: ++ pgminor, pgpatch = None, pgminor ++ if pgminor is None or not pgminor.isdigit(): ++ pgminor = 0 + if pgpatch is None or not pgpatch.isdigit(): + pgpatch = 0 +- pgmajor = int(pgmajor) + pgminor = int(pgminor) + pgpatch = int(pgpatch) + else: + sys.stderr.write( + "Error: could not determine PostgreSQL version from '%s'" +- % pgversion) ++ % pgversion) + sys.exit(1) + + define_macros.append(("PG_VERSION_HEX", "0x%02X%02X%02X" %))
5 years, 11 months
1
0
0
0
← Newer
1
...
44
45
46
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