Sandro Bonazzola has uploaded a new change for review. Change subject: sos: aligned sos2 plugins to sos 3.1 ......................................................................
sos: aligned sos2 plugins to sos 3.1 Aligned sos 2 plugins shipped within log-collector with the plugins included in sos 3.1 released in Fedora. The new ovirt plugin also include support for ovirt-scheduler-proxy. Aligned log-collector for using ovirt plugin. Require newest sos ovirt rpm in order to update sos previously shipped within ovirt repo. Bug-Url: https://bugzilla.redhat.com/1073944 Bug-Url: https://bugzilla.redhat.com/1037663 Change-Id: I74b1d24cff897d6cc393ee68edfe0d78030877c5 Signed-off-by: Sandro Bonazzola <[email protected]> --- M ovirt-log-collector.spec.in M po/POTFILES.in M src/__main__.py M src/sos/plugins/Makefile.am D src/sos/plugins/engine.py A src/sos/plugins/ovirt.py D src/sos/plugins/ovirt_engine_dwh.py D src/sos/plugins/ovirt_engine_reports.py M src/sos/plugins/postgresql.py 9 files changed, 258 insertions(+), 346 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector refs/changes/55/30055/1 diff --git a/ovirt-log-collector.spec.in b/ovirt-log-collector.spec.in index 538ea8b..415285a 100644 --- a/ovirt-log-collector.spec.in +++ b/ovirt-log-collector.spec.in @@ -37,7 +37,7 @@ Requires: openssh-clients %if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 -Requires: sos >= 3.1 +Requires: sos >= 3.1-1.1 %else Requires: sos < 3 %endif diff --git a/po/POTFILES.in b/po/POTFILES.in index 60e3427..8499785 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,6 +2,6 @@ ./src/helper/__init__.py ./src/__init__.py ./src/__main__.py -./src/sos/plugins/engine.py +./src/sos/plugins/ovirt.py ./src/sos/plugins/postgresql.py ./src/tests.py diff --git a/src/__main__.py b/src/__main__.py index 81bd405..9dbe161 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -772,9 +772,17 @@ class ENGINEData(CollectorBase): def __init__(self, hostname, configuration=None, **kwargs): super(ENGINEData, self).__init__(hostname, configuration) - self._engine_plugin = 'engine' - if sos.__version__.replace('.', '') >= '30': + self._plugins = self.caller.call('sosreport --list-plugins') + if 'ovirt.sensitive_keys' in self._plugins: + self._engine_plugin = 'ovirt' + elif 'ovirt-engine.sensitive_keys' in self._plugins: self._engine_plugin = 'ovirt-engine' + elif 'engine.sensitive_keys' in self._plugins: + self._engine_plugin = 'engine' + else: + logging.error('ovirt plugin not found, falling back on default') + self._engine_plugin = 'ovirt' + self.dwh_prep() def prep(self): super(ENGINEData, self).prep() @@ -786,13 +794,21 @@ 'SENSITIVE_KEYS' ).replace(',', ':') + def dwh_prep(self): dwh_service_config = configfile.ConfigFile([ config.ENGINE_DWH_SERVICE_DEFAULTS, ]) if dwh_service_config.get('SENSITIVE_KEYS'): - self.configuration['dwh_sensitive_keys'] = dwh_service_config.get( + dwh_sensitive_keys = dwh_service_config.get( 'SENSITIVE_KEYS' ).replace(',', ':') + if 'ovirt_engine_dwh.sensitive_keys' in self._plugins: + self.configuration['dwh_sensitive_keys'] = dwh_sensitive_keys + else: + if self.configuration['sensitive_keys']: + self.configuration['sensitive_keys'] += dwh_sensitive_keys + else: + self.configuration['sensitive_keys'] = dwh_sensitive_keys def build_options(self): """ @@ -807,6 +823,7 @@ self._engine_plugin: 'sensitive_keys', 'ovirt_engine_dwh': 'dwh_sensitive_keys', } + for plugin in sensitive_keys: if self.configuration.get(sensitive_keys[plugin]): opts.append( @@ -848,11 +865,14 @@ "kernel", "apache", "memory", - "ovirt_engine_dwh", - "ovirt_engine_reports", )) - if sos.__version__.replace('.', '') > '30': + if 'logs.all_logs' in self._plugins: self.configuration['reports'] += ',logs' + if 'ovirt_engine_dwh.sensitive_keys' in self._plugins: + self.configuration['reports'] += ',ovirt_engine_dwh' + if 'ovirt_engine_reports' in self._plugins: + self.configuration['reports'] += ',ovirt_engine_reports' + self.configuration["sos_options"] = self.build_options() self.caller.call( "sosreport --batch --build \ diff --git a/src/sos/plugins/Makefile.am b/src/sos/plugins/Makefile.am index 43326f4..17f44d5 100644 --- a/src/sos/plugins/Makefile.am +++ b/src/sos/plugins/Makefile.am @@ -23,16 +23,12 @@ if SOS2 dist_sosplugins_PYTHON = \ - engine.py \ - ovirt_engine_dwh.py \ - ovirt_engine_reports.py \ + ovirt.py \ postgresql.py \ $(NULL) else dist_noinst_PYTHON = \ - engine.py \ - ovirt_engine_dwh.py \ - ovirt_engine_reports.py \ + ovirt.py \ postgresql.py \ $(NULL) endif diff --git a/src/sos/plugins/engine.py b/src/sos/plugins/engine.py deleted file mode 100644 index 9e00595..0000000 --- a/src/sos/plugins/engine.py +++ /dev/null @@ -1,149 +0,0 @@ -import os -import re -import signal -import subprocess - - -import sos.plugintools - - -# Class name must be the same as file name and method names must not change -class engine(sos.plugintools.PluginBase): - """oVirt related information""" - - DB_PASS_FILES = re.compile( - flags=re.VERBOSE, - pattern=r""" - ^ - /etc/ - (rhevm|ovirt-engine)/ - engine.conf - (\.d/.+.conf)? - $ - """ - ) - - DEFAULT_SENSITIVE_KEYS = ( - 'ENGINE_DB_PASSWORD:ENGINE_PKI_TRUST_STORE_PASSWORD:' - 'ENGINE_PKI_ENGINE_STORE_PASSWORD' - ) - - optionList = [ - ( - 'jbosstrace', - 'Enable oVirt Engine JBoss stack trace generation', - '', - True - ), - ( - 'sensitive_keys', - 'Sensitive keys to be masked', - '', - DEFAULT_SENSITIVE_KEYS - ), - ] - - def __init__(self, pluginname, commons): - sos.plugintools.PluginBase.__init__(self, pluginname, commons) - - def setup(self): - if self.getOption('jbosstrace'): - proc = subprocess.Popen( - args=[ - '/usr/bin/pgrep', - '-f', - 'jboss', - ], - stdout=subprocess.PIPE, - ) - output, err = proc.communicate() - returncode = proc.returncode - jboss_pids = set() - if returncode == 0: - jboss_pids = set([int(x) for x in output.splitlines()]) - proc = subprocess.Popen( - args=[ - '/usr/bin/pgrep', - '-f', - 'ovirt-engine', - ], - stdout=subprocess.PIPE, - ) - engine_output, err = proc.communicate() - if returncode == 0: - engine_pids = set( - [int(x) for x in engine_output.splitlines()] - ) - jboss_pids.intersection_update(engine_pids) - else: - self.soslog.error('Unable to get engine pids: %s' % err) - self.addAlert('Unable to get engine pids') - else: - self.soslog.error('Unable to get jboss pid: %s' % err) - self.addAlert('Unable to get jboss pid') - for pid in jboss_pids: - try: - os.kill(pid, signal.SIGQUIT) - except OSError as e: - self.soslog.error('Unable to send signal to %d' % pid, e) - - self.addForbiddenPath('/etc/ovirt-engine/.pgpass') - self.addForbiddenPath('/etc/rhevm/.pgpass') - # Copy engine config files. - self.addCopySpec("/etc/ovirt-engine") - self.addCopySpec("/etc/rhevm") - self.addCopySpec("/var/log/ovirt-engine") - self.addCopySpec("/var/log/rhevm") - self.addCopySpec("/etc/sysconfig/ovirt-engine") - self.addCopySpec("/usr/share/ovirt-engine/conf") - self.addCopySpec("/var/log/ovirt-guest-agent") - self.addCopySpec("/var/lib/ovirt-engine/setup-history.txt") - self.addCopySpec("/var/lib/ovirt-engine/setup/answers") - self.addCopySpec("/var/lib/ovirt-engine/external_truststore") - self.addCopySpec("/var/tmp/ovirt-engine/config") - - def postproc(self): - """ - Obfuscate sensitive keys. - """ - self.doRegexSub( - "/etc/ovirt-engine/engine-config/engine-config.properties", - r"Password.type=(.*)", - r'Password.type=********' - ) - self.doRegexSub( - "/etc/rhevm/rhevm-config/rhevm-config.properties", - r"Password.type=(.*)", - r'Password.type=********' - ) - for filename in ( - 'ovirt-engine.xml', - 'ovirt-engine_history/current/ovirt-engine.v1.xml', - 'ovirt-engine_history/ovirt-engine.boot.xml', - 'ovirt-engine_history/ovirt-engine.initial.xml', - 'ovirt-engine_history/ovirt-engine.last.xml', - ): - self.doRegexSub( - "/var/tmp/ovirt-engine/config/%s" % filename, - r"<password>(.*)</password>", - r'<password>********</password>' - ) - - if self.getOption('sensitive_keys'): - sensitive_keys = self.getOption('sensitive_keys') - if self.getOption('sensitive_keys') is True: - # Handle --alloptions case which set this to True. - sensitive_keys = self.DEFAULT_SENSITIVE_KEYS - key_list = [x for x in sensitive_keys.split(':') if x] - for filename in self.copiedFiles: - if self.DB_PASS_FILES.match(filename['srcpath']): - for key in key_list: - self.doRegexSub( - filename['srcpath'], - r'{key}=(.*)'.format( - key=key, - ), - r'{key}=********'.format( - key=key, - ) - ) diff --git a/src/sos/plugins/ovirt.py b/src/sos/plugins/ovirt.py new file mode 100644 index 0000000..ff0cc25 --- /dev/null +++ b/src/sos/plugins/ovirt.py @@ -0,0 +1,171 @@ +# Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola <[email protected]> +# Copyright (C) 2014 Red Hat, Inc., Bryn M. Reeves <[email protected]> +# Copyright (C) 2010 Red Hat, Inc. + +# This program 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; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +import os +import re +import signal + + +import sos.plugintools + + +# Class name must be the same as file name and method names must not change +class ovirt(sos.plugintools.PluginBase): + """oVirt related information""" + + DB_PASS_FILES = re.compile( + flags=re.VERBOSE, + pattern=r""" + ^ + /etc/ + (rhevm|ovirt-engine|ovirt-engine-dwh)/ + (engine.conf|ovirt-engine-dwhd.conf) + (\.d/.+.conf)? + $ + """ + ) + + DEFAULT_SENSITIVE_KEYS = ( + 'ENGINE_DB_PASSWORD:ENGINE_PKI_TRUST_STORE_PASSWORD:' + 'ENGINE_PKI_ENGINE_STORE_PASSWORD:DWH_DB_PASSWORD' + ) + + optionList = [ + ( + 'jbosstrace', 'Enable oVirt Engine JBoss stack trace collection', + '', True + ), + ( + 'sensitive_keys', 'Sensitive keys to be masked', '', + DEFAULT_SENSITIVE_KEYS + ) + ] + + def __init__(self, pluginname, commons): + sos.plugintools.PluginBase.__init__(self, pluginname, commons) + self.packages = ( + 'ovirt-engine', + 'ovirt-engine-dwh', + 'ovirt-engine-reports' + ) + + def setup(self): + if self.getOption('jbosstrace'): + engine_pattern = "^ovirt-engine\ -server.*jboss-modules.jar" + pgrep = "pgrep -f '%s'" % engine_pattern + lines = self.callExtProg(pgrep)['output'].splitlines() + engine_pids = [int(x) for x in lines] + if not engine_pids: + self.soslog.error('Unable to get ovirt-engine pid') + self.add_alert('Unable to get ovirt-engine pid') + for pid in engine_pids: + try: + # backtrace written to '/var/log/ovirt-engine/console.log + os.kill(pid, signal.SIGQUIT) + except OSError as e: + self.soslog.error('Unable to send signal to %d' % pid, e) + + self.addForbiddenPath('/etc/ovirt-engine/.pgpass') + self.addForbiddenPath('/etc/rhevm/.pgpass') + # Copy engine config files. + self.addCopySpecs([ + "/etc/ovirt-engine", + "/etc/rhevm", + "/etc/ovirt-engine-dwh", + "/var/log/ovirt-engine", + "/var/log/ovirt-engine-dwh", + "/var/log/ovirt-engine-reports", + "/var/log/ovirt-scheduler-proxy", + "/var/log/rhevm", + "/etc/sysconfig/ovirt-engine", + "/usr/share/ovirt-engine/conf", + "/var/log/ovirt-guest-agent", + "/var/lib/ovirt-engine/setup-history.txt", + "/var/lib/ovirt-engine/setup/answers", + "/var/lib/ovirt-engine/external_truststore", + "/var/tmp/ovirt-engine/config" + ]) + + def postproc(self): + """ + Obfuscate sensitive keys. + """ + self.doRegexSub( + "/etc/ovirt-engine/engine-config/engine-config.properties", + r"Password.type=(.*)", + r"Password.type=********" + ) + self.doRegexSub( + "/etc/rhevm/rhevm-config/rhevm-config.properties", + r"Password.type=(.*)", + r"Password.type=********" + ) + + engine_files = ( + 'ovirt-engine.xml', + 'ovirt-engine_history/current/ovirt-engine.v1.xml', + 'ovirt-engine_history/ovirt-engine.boot.xml', + 'ovirt-engine_history/ovirt-engine.initial.xml', + 'ovirt-engine_history/ovirt-engine.last.xml', + ) + for filename in engine_files: + self.doRegexSub( + "/var/tmp/ovirt-engine/config/%s" % filename, + r"<password>(.*)</password>", + r"<password>********</password>" + ) + + self.doRegexSub( + "/etc/ovirt-engine/redhatsupportplugin.conf", + r"proxyPassword=(.*)", + r"proxyPassword=********" + ) + + passwd_files = [ + "logcollector.conf", + "imageuploader.conf", + "isouploader.conf" + ] + for conf_file in passwd_files: + conf_path = os.path.join("/etc/ovirt-engine", conf_file) + self.do_file_sub( + conf_path, + r"passwd=(.*)", + r"passwd=********" + ) + self.do_file_sub( + conf_path, + r"pg-pass=(.*)", + r"pg-pass=********" + ) + + sensitive_keys = self.DEFAULT_SENSITIVE_KEYS + # Handle --alloptions case which set this to True. + keys_opt = self.get_option('sensitive_keys') + if keys_opt and keys_opt is not True: + sensitive_keys = keys_opt + key_list = [x for x in sensitive_keys.split(':') if x] + for key in key_list: + self.do_path_regex_sub( + self.DB_PASS_FILES, + r'{key}=(.*)'.format(key=key), + r'{key}=********'.format(key=key) + ) + + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/sos/plugins/ovirt_engine_dwh.py b/src/sos/plugins/ovirt_engine_dwh.py deleted file mode 100644 index f92fb89..0000000 --- a/src/sos/plugins/ovirt_engine_dwh.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola <[email protected]> - -# This program 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; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -"""oVirt Engine DWH related information""" - - -import re - - -from sos.plugintools import PluginBase - - -class ovirt_engine_dwh(PluginBase): - """oVirt Engine DWH related information""" - - DB_PASS_FILES = re.compile( - flags=re.VERBOSE, - pattern=r""" - ^ - /etc/ - ovirt-engine-dwh/ - .* - """ - ) - - DEFAULT_SENSITIVE_KEYS = ( - 'DWH_DB_PASSWORD:ENGINE_DB_PASSWORD' - ) - - optionList = [ - ( - 'sensitive_keys', - 'Sensitive keys to be masked', - '', - DEFAULT_SENSITIVE_KEYS - ), - ] - - def setup(self): - self.addCopySpec('/etc/ovirt-engine-dwh') - self.addCopySpec('/var/log/ovirt-engine-dwh') - - def postproc(self): - """ - Obfuscate sensitive keys. - """ - if self.getOption('sensitive_keys'): - sensitive_keys = self.getOption('sensitive_keys') - if self.getOption('sensitive_keys') is True: - # Handle --alloptions case which set this to True. - sensitive_keys = self.DEFAULT_SENSITIVE_KEYS - key_list = [x for x in sensitive_keys.split(':') if x] - for filename in self.copiedFiles: - if self.DB_PASS_FILES.match(filename['srcpath']): - for key in key_list: - self.doRegexSub( - filename['srcpath'], - r'{key}=(.*)'.format( - key=key, - ), - r'{key}=********'.format( - key=key, - ) - ) - - -# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/sos/plugins/ovirt_engine_reports.py b/src/sos/plugins/ovirt_engine_reports.py deleted file mode 100644 index adfe280..0000000 --- a/src/sos/plugins/ovirt_engine_reports.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola <[email protected]> - -# This program 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; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - -"""oVirt Engine Reports related information""" - - -from sos.plugintools import PluginBase - - -class ovirt_engine_reports(PluginBase): - """oVirt Engine Reports related information""" - - def setup(self): - self.addCopySpec('/var/log/ovirt-engine-reports') - - -# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/sos/plugins/postgresql.py b/src/sos/plugins/postgresql.py index a20bf55..4eaf126 100644 --- a/src/sos/plugins/postgresql.py +++ b/src/sos/plugins/postgresql.py @@ -1,3 +1,22 @@ +# Copyright (C) 2014 Red Hat, Inc., Sandro Bonazzola <[email protected]> +# Copyright (C) 2013 Chris J Arges <[email protected]> +# Copyright (C) 2012-2013 Red Hat, Inc., Bryn M. Reeves <[email protected]> +# Copyright (C) 2011 Red Hat, Inc., Jesse Jaggars <[email protected]> + +# This program 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; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + import fnmatch import os import sos.plugintools @@ -25,36 +44,16 @@ yield os.path.join(path, name) -# Class name must be the same as file name and method names must not change class postgresql(sos.plugintools.PluginBase): """PostgreSQL related information""" - __pghome = '/var/lib/pgsql' - __username = 'postgres' - __dbport = 5432 optionList = [ - ( - 'pghome', - 'PostgreSQL server home directory (default=/var/lib/pgsql)', - '', - False - ), - ('username', 'username for pg_dump (default=postgres)', '', False), - ('password', 'password for pg_dump (default=None)', '', False), - ( - 'dbname', - 'database name to dump for pg_dump (default=None)', - '', - False - ), - ( - 'dbhost', - 'hostname/IP of the server upon which the DB is running \ -(default=localhost)', - '', - False - ), - ('dbport', 'database server port number (default=5432)', '', False) + ('pghome', 'PostgreSQL server home directory.', '', '/var/lib/pgsql'), + ('username', 'username for pg_dump', '', 'postgres'), + ('password', 'password for pg_dump', '', ''), + ('dbname', 'database name to dump for pg_dump', '', ''), + ('dbhost', 'database hostname/IP (do not use unix socket)', '', ''), + ('dbport', 'database server port number', '', '5432') ] def __init__(self, pluginname, commons): @@ -64,25 +63,21 @@ def pg_dump(self): dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar") old_env_pgpassword = os.environ.get("PGPASSWORD") - os.environ["PGPASSWORD"] = "%s" % (self.getOption("password")) - if ( - self.getOption("dbhost") and - self.getOption("dbhost") is not True - ): + os.environ["PGPASSWORD"] = self.getOption("password") + if self.getOption("dbhost"): cmd = "pg_dump -U %s -h %s -p %s -w -f %s -F t %s" % ( - self.__username, + self.getOption("username"), self.getOption("dbhost"), - self.__dbport, + self.getOption("dbport"), dest_file, self.getOption("dbname") ) else: cmd = "pg_dump -C -U %s -w -f %s -F t %s " % ( - self.__username, + self.getOption("username"), dest_file, self.getOption("dbname") ) - self.soslog.debug("calling %s" % cmd) (status, output, rtime) = self.callExtProg(cmd) if old_env_pgpassword is not None: os.environ["PGPASSWORD"] = str(old_env_pgpassword) @@ -97,31 +92,8 @@ ) def setup(self): - if ( - self.getOption("pghome") and - self.getOption("pghome") is not True - ): - self.__pghome = self.getOption("pghome") - self.soslog.debug("using pghome=%s" % self.__pghome) - - if ( - self.getOption("dbname") and - self.getOption("dbname") is not True - ): - if ( - self.getOption("password") and - self.getOption("password") is not True - ): - if ( - self.getOption("username") and - self.getOption("username") is not True - ): - self.__username = self.getOption("username") - if ( - self.getOption("dbport") and - self.getOption("dbport") is not True - ): - self.__dbport = self.getOption("dbport") + if self.getOption("dbname"): + if self.getOption("password"): self.tmp_dir = tempfile.mkdtemp() self.pg_dump() else: @@ -140,23 +112,37 @@ ) # Copy PostgreSQL log files. - for filename in find("*.log", self.__pghome): + for filename in find("*.log", self.get_option("pghome")): self.addCopySpec(filename) # Copy PostgreSQL config files. - for filename in find("*.conf", self.__pghome): + for filename in find("*.conf", self.get_option("pghome")): self.addCopySpec(filename) - self.addCopySpec(os.path.join(self.__pghome, "data", "PG_VERSION")) self.addCopySpec( - os.path.join(self.__pghome, "data", "postmaster.opts") + os.path.join( + self.getOption("pghome"), + "data", + "PG_VERSION" + ) + ) + self.addCopySpec( + os.path.join( + self.getOption("pghome"), + "data", + "postmaster.opts" + ) ) def postproc(self): import shutil - try: - shutil.rmtree(self.tmp_dir) - except shutil.Error: - self.soslog.exception( - "Unable to remove %s." % (self.tmp_dir) - ) - self.addAlert("ERROR: Unable to remove %s." % (self.tmp_dir)) + if self.tmp_dir: + try: + shutil.rmtree(self.tmp_dir) + except shutil.Error: + self.soslog.exception( + "Unable to remove %s." % (self.tmp_dir) + ) + self.addAlert("ERROR: Unable to remove %s." % (self.tmp_dir)) + + +# vim: et ts=4 sw=4 -- To view, visit http://gerrit.ovirt.org/30055 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I74b1d24cff897d6cc393ee68edfe0d78030877c5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-log-collector Gerrit-Branch: ovirt-log-collector-3.4 Gerrit-Owner: Sandro Bonazzola <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
