Sandro Bonazzola has uploaded a new change for review. Change subject: tools: fixed --version output ......................................................................
tools: fixed --version output --version previously showed 1.0.0. Now it shows the package name and version as set in configure.ac. Moved some other constants to config.py, maybe we can decide to set them using configure.ac values in the future. Change-Id: I88f53765028284221a0506efbc595b146a2bca8a Bug-Url: https://bugzilla.redhat.com/886052 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- M configure.ac M src/Makefile.am M src/__main__.py A src/config.py.in 4 files changed, 40 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector refs/changes/35/12735/1 diff --git a/configure.ac b/configure.ac index 2df4bfd..50d515d 100644 --- a/configure.ac +++ b/configure.ac @@ -76,6 +76,7 @@ AC_CONFIG_FILES([ Makefile ovirt-log-collector.spec + src/config.py src/Makefile src/sos/Makefile src/sos/plugins/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index b574545..3dec962 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,8 +21,20 @@ $(srcdir)/Makefile.in \ $(NULL) +CLEANFILES = \ + config.py \ + $(NULL) + +config.py: \ + $(top_srcdir)/configure.ac \ + $(NULL) + SUBDIRS = sos helper +ovirtlogcollectorlib_PYTHON = \ + config.py\ + $(NULL) + dist_ovirtlogcollectorlib_PYTHON = \ __init__.py \ __main__.py \ diff --git a/src/__main__.py b/src/__main__.py index 634e61d..ec37e90 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -33,17 +33,13 @@ import dateutil.tz as tz from helper import hypervisors -versionNum="1.0.0" +from ovirt_log_collector.config import * + STREAM_LOG_FORMAT = '%(levelname)s: %(message)s' FILE_LOG_FORMAT = '%(asctime)s::%(levelname)s::%(module)s::%(lineno)d::%(name)s:: %(message)s' FILE_LOG_DSTMP = '%Y-%m-%d %H:%M:%S' -DEFAULT_SSH_KEY = "/etc/pki/ovirt-engine/keys/engine_id_rsa" DEFAULT_SSH_USER = 'root' -DEFAULT_CONFIGURATION_FILE = "/etc/ovirt-engine/logcollector.conf" -DEFAULT_SCRATCH_DIR='/tmp/logcollector' -DEFAULT_LOG_FILE='/var/log/ovirt-engine/engine-log-collector.log' DEFAULT_TIME_SHIFT_FILE='time_diff.txt' -FILE_PG_PASS="/etc/ovirt-engine/.pgpass" PGPASS_FILE_ADMIN_LINE = "DB ADMIN credentials" # Default DB connection params @@ -903,9 +899,14 @@ 2: The program encountered a problem gathering data but was able to continue. """ OptionParser.format_epilog = lambda self, formatter: self.epilog - parser = OptionParser(usage_string, - version="Version " + versionNum, - epilog=epilog_string) + parser = OptionParser( + usage_string, + version="{pkg_name}-{pkg_version}".format( + pkg_name=PACKAGE_NAME, + pkg_version=PACKAGE_VERSION + ), + epilog=epilog_string + ) parser.add_option("", "--conf-file", dest="conf_file", @@ -935,9 +936,9 @@ default=DEFAULT_LOG_FILE) parser.add_option("", "--cert-file", dest="cert_file", - help="The CA certificate used to validate the engine. (default=/etc/pki/ovirt-engine/ca.pem)", - metavar="/etc/pki/ovirt-engine/ca.pem", - default="/etc/pki/ovirt-engine/ca.pem") + help="The CA certificate used to validate the engine. (default=%s)" % DEFAULT_CA_PEM, + metavar=DEFAULT_CA_PEM, + default=DEFAULT_CA_PEM) parser.add_option("", "--insecure", dest="insecure", help="Do not make an attempt to verify the engine.", diff --git a/src/config.py.in b/src/config.py.in new file mode 100644 index 0000000..56ace53 --- /dev/null +++ b/src/config.py.in @@ -0,0 +1,14 @@ +""" +Paths and version constants for @PACKAGE_NAME@ +""" + +PACKAGE_NAME = "@PACKAGE_NAME@" +PACKAGE_VERSION = "@PACKAGE_VERSION@" + +FILE_PG_PASS = "/etc/ovirt-engine/.pgpass" + +DEFAULT_CA_PEM = "/etc/pki/ovirt-engine/ca.pem" +DEFAULT_SSH_KEY = "/etc/pki/ovirt-engine/keys/engine_id_rsa" +DEFAULT_CONFIGURATION_FILE = "/etc/logcollector.conf" +DEFAULT_LOG_FILE = "/var/log/ovirt-engine/engine-log-collector.log" +DEFAULT_SCRATCH_DIR = "/tmp/logcollector" -- To view, visit http://gerrit.ovirt.org/12735 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I88f53765028284221a0506efbc595b146a2bca8a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-log-collector Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches