backend/satellite_tools/Makefile | 3 - backend/satellite_tools/spacewalk-report | 75 +++++++++++++++++++++++++++++++ backend/spacewalk-backend.spec | 1 3 files changed, 78 insertions(+), 1 deletion(-)
New commits: commit 8549dc3f0006143c60732923fddbee3496630d73 Author: Jan Pazdziora jpazdziora@redhat.com Date: Thu Jul 23 10:51:47 2009 +0200
reporting: add spacewalk-report to the rpm package.
diff --git a/backend/satellite_tools/Makefile b/backend/satellite_tools/Makefile index 9c02dce..b783b27 100644 --- a/backend/satellite_tools/Makefile +++ b/backend/satellite_tools/Makefile @@ -16,7 +16,8 @@ FILES = __init__ connection diskImportLib messages \
SCRIPTS = satellite-sync spacewalk-debug\ rhn-schema-version rhn-satellite-activate rhn-charsets \ - rhn-ssl-dbstore update-packages rhn-db-stats + rhn-ssl-dbstore update-packages rhn-db-stats \ + spacewalk-report
# check if we can build man pages DOCBOOK = $(wildcard /usr/bin/docbook2man) diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec index 4037804..20a389d 100644 --- a/backend/spacewalk-backend.spec +++ b/backend/spacewalk-backend.spec @@ -505,6 +505,7 @@ rm -f %{rhnconf}/rhnSecret.py* %attr(755,root,root) %{_bindir}/rhn-ssl-dbstore %attr(755,root,root) %{_bindir}/satellite-sync %attr(755,root,root) %{_bindir}/spacewalk-debug +%attr(755,root,root) %{_bindir}/spacewalk-report %attr(755,root,root) %{_bindir}/rhn-satellite-exporter %attr(755,root,root) %{_bindir}/update-packages %attr(755,root,root) %{_bindir}/rhn-db-stats
commit 43c47fe0c2e23058f071c5d3ee725f724904c331 Author: Jan Pazdziora jpazdziora@redhat.com Date: Thu Jul 23 10:09:41 2009 +0200
reporting: a stub for new script, spacewalk-report.
diff --git a/backend/satellite_tools/spacewalk-report b/backend/satellite_tools/spacewalk-report new file mode 100755 index 0000000..ca7b63d --- /dev/null +++ b/backend/satellite_tools/spacewalk-report @@ -0,0 +1,75 @@ +#!/usr/bin/python -u +# +# Copyright (c) 2008 Red Hat, Inc. +# +# This software is licensed to you under the GNU General Public License, +# version 2 (GPLv2). There is NO WARRANTY for this software, express or +# implied, including the implied warranties of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 # along with this software; if not, see +# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. +# +# Red Hat trademarks are not licensed under GPLv2. No permission is +# granted to use or replicate Red Hat trademarks that are incorporated +# in this software or its documentation. +# + +import sys +def systemExit(code, msgs=None): + """ exit with message and code """ + if msgs: + if type(msgs) not in [type([]), type(())]: + msgs = (msgs, ) + for msg in msgs: + sys.stderr.write(str(msg)+'\n') + sys.exit(code) + +try: + import os +except KeyboardInterrupt: + systemExit(-1, "\nUser interrupted process.") + + +_LIBPATH = "/usr/share/rhn" +# add to the path if need be +if _LIBPATH not in sys.path: + sys.path.append(_LIBPATH) + +try: + from server import rhnSQL + from common import initCFG +except KeyboardInterrupt: + systemExit(-1, "\nUser interrupted process.") + + +def processCommandline(): + """ process the commandline """ + try: + from optparse import Option, OptionParser + except KeyboardInterrupt: + systemExit(-1, "\nUser interrupted process.") + optionsTable = [ + Option('--db', action='store', type="string", + help='alternative database string (username/password@sid);' \ + + ' default is default_db from /etc/rhn/rhn.conf'), + ] + + optionParser = OptionParser(option_list=optionsTable) + optionParser.disable_interspersed_args() + options, args = optionParser.parse_args() + + return options + + +if __name__ == '__main__': + options = processCommandline() + + try: + initCFG('server') + rhnSQL.initDB(options.db) + except KeyboardInterrupt: + systemExit(-1, "\nUser interrupted process.") + except (rhnSQL.SQLError, rhnSQL.SQLSchemaError, rhnSQL.SQLConnectError), e: + # really a stub for better exception handling in the future. + sys.stderr.write("SQL error occurred, traceback follows...\n") + raise +
spacewalk-commits@lists.fedorahosted.org