backend/spacewalk-backend.spec | 2
branding/spacewalk-branding.spec | 2
client/rhel/rhn-client-tools/rhn-client-tools.spec | 2
client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec | 2
java/spacewalk-java.spec | 2
monitoring/spacewalk-monitoring/spacewalk-monitoring.spec | 2
monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec | 2
proxy/installer/spacewalk-proxy-installer.spec | 2
proxy/proxy-docs/spacewalk-proxy-docs.spec | 2
proxy/proxy-html/spacewalk-proxy-html.spec | 2
proxy/proxy/spacewalk-proxy.spec | 2
schema/spacewalk/spacewalk-schema.spec | 2
search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec | 2
search-server/spacewalk-search.spec | 2
selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec | 2
selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec | 2
selinux/spacewalk-selinux/spacewalk-selinux.spec | 2
spacewalk/admin/spacewalk-admin.spec | 2
spacewalk/certs-tools/spacewalk-certs-tools.spec | 2
spacewalk/config/spacewalk-config.spec | 2
spacewalk/package/spacewalk.spec | 2
spacewalk/setup/spacewalk-setup.spec | 2
utils/Makefile | 2
utils/apply_errata | 287 ++++++++++
utils/spacewalk-utils.spec | 2
web/spacewalk-web.spec | 2
26 files changed, 312 insertions(+), 25 deletions(-)
New commits:
commit d131ea665c012c79c9bee9efa0205f4b4693a457
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 10:57:43 2009 +0100
bumping Version to 0.8.0
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 3ec93e9..2b04045 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -7,7 +7,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.7.18
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/branding/spacewalk-branding.spec b/branding/spacewalk-branding.spec
index 1e5fa4b..c4ebf47 100644
--- a/branding/spacewalk-branding.spec
+++ b/branding/spacewalk-branding.spec
@@ -1,5 +1,5 @@
Name: spacewalk-branding
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Spacewalk branding data
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec
b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index b39ab44..f94d6e8 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -4,7 +4,7 @@ Group: System Environment/Base
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
URL:
https://fedorahosted.org/spacewalk
Name: rhn-client-tools
-Version: 0.7.11
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?suse_version: %{suse_version} > 1000}
diff --git a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
index 467e028..51accb4 100644
--- a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
+++ b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
@@ -1,6 +1,6 @@
Summary: RHN support for yum
Name: yum-rhn-plugin
-Version: 0.7.8
+Version: 0.8.0
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Base
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index ac719d1..4f73b5c 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -12,7 +12,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.7.24
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
b/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
index 9fda14f..acfb919 100644
--- a/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
+++ b/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
@@ -8,7 +8,7 @@
Summary: Spacewalk monitoring
Name: spacewalk-monitoring
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
License: GPLv2
diff --git a/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
b/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
index 8217b21..a573811 100644
--- a/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
+++ b/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
@@ -2,7 +2,7 @@
Summary: Meta-package that pulls in all of the Spacewalk monitoring packages
Name: spacewalk-proxy-monitoring
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
License: GPLv2
diff --git a/proxy/installer/spacewalk-proxy-installer.spec
b/proxy/installer/spacewalk-proxy-installer.spec
index ddd87b2..113fd9a 100644
--- a/proxy/installer/spacewalk-proxy-installer.spec
+++ b/proxy/installer/spacewalk-proxy-installer.spec
@@ -2,7 +2,7 @@ Name: spacewalk-proxy-installer
Summary: Spacewalk Proxy Server Installer
Group: Applications/Internet
License: GPLv2
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/proxy/proxy-docs/spacewalk-proxy-docs.spec
b/proxy/proxy-docs/spacewalk-proxy-docs.spec
index 2c715df..ea32f21 100644
--- a/proxy/proxy-docs/spacewalk-proxy-docs.spec
+++ b/proxy/proxy-docs/spacewalk-proxy-docs.spec
@@ -4,7 +4,7 @@ Group: Applications/Internet
License: Open Publication
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
diff --git a/proxy/proxy-html/spacewalk-proxy-html.spec
b/proxy/proxy-html/spacewalk-proxy-html.spec
index 4125b46..65a81b8 100644
--- a/proxy/proxy-html/spacewalk-proxy-html.spec
+++ b/proxy/proxy-html/spacewalk-proxy-html.spec
@@ -6,7 +6,7 @@ Group: Applications/Internet
License: GPLv2
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
BuildArch: noarch
diff --git a/proxy/proxy/spacewalk-proxy.spec b/proxy/proxy/spacewalk-proxy.spec
index 32a1b97..9f3daf7 100644
--- a/proxy/proxy/spacewalk-proxy.spec
+++ b/proxy/proxy/spacewalk-proxy.spec
@@ -4,7 +4,7 @@ Group: Applications/Internet
License: GPLv2
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python
diff --git a/schema/spacewalk/spacewalk-schema.spec
b/schema/spacewalk/spacewalk-schema.spec
index 749ce86..2c3268f 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 0.7.7
+Version: 0.8.0
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
diff --git a/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
b/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
index ea1668c..dfb848f 100644
--- a/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
+++ b/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
@@ -1,5 +1,5 @@
Name: spacewalk-doc-indexes
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Lucene indexes of help documentation for spacewalk
diff --git a/search-server/spacewalk-search.spec b/search-server/spacewalk-search.spec
index 832197f..289215e 100644
--- a/search-server/spacewalk-search.spec
+++ b/search-server/spacewalk-search.spec
@@ -4,7 +4,7 @@ Name: spacewalk-search
Summary: Spacewalk Full Text Search Server
Group: Applications/Internet
License: GPLv2
-Version: 0.7.3
+Version: 0.8.0
Release: 1%{?dist}
# This src.rpm is cannonical upstream
# You can obtain it using this set of commands
diff --git a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
index 90eeb44..293b6f2 100644
--- a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
+++ b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk-monitoring
Name: spacewalk-monitoring-selinux
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk monitoring
diff --git a/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
b/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
index 535a8dd..21f7fa2 100644
--- a/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
+++ b/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk-proxy
Name: spacewalk-proxy-selinux
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk Proxy
diff --git a/selinux/spacewalk-selinux/spacewalk-selinux.spec
b/selinux/spacewalk-selinux/spacewalk-selinux.spec
index f2d6d1b..0fc16cf 100644
--- a/selinux/spacewalk-selinux/spacewalk-selinux.spec
+++ b/selinux/spacewalk-selinux/spacewalk-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk
Name: spacewalk-selinux
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk Server
diff --git a/spacewalk/admin/spacewalk-admin.spec b/spacewalk/admin/spacewalk-admin.spec
index c287019..983e3b3 100644
--- a/spacewalk/admin/spacewalk-admin.spec
+++ b/spacewalk/admin/spacewalk-admin.spec
@@ -2,7 +2,7 @@
Summary: Various utility scripts and data files for RHN Satellite installations
Name: spacewalk-admin
URL:
https://fedorahosted.org/spacewalk
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
License: GPLv2
diff --git a/spacewalk/certs-tools/spacewalk-certs-tools.spec
b/spacewalk/certs-tools/spacewalk-certs-tools.spec
index 16c8396..594e9a7 100644
--- a/spacewalk/certs-tools/spacewalk-certs-tools.spec
+++ b/spacewalk/certs-tools/spacewalk-certs-tools.spec
@@ -2,7 +2,7 @@ Name: spacewalk-certs-tools
Summary: Spacewalk SSL Key/Cert Tool
Group: Applications/Internet
License: GPLv2 and Python
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/spacewalk/config/spacewalk-config.spec
b/spacewalk/config/spacewalk-config.spec
index ed2eda7..3077a1c 100644
--- a/spacewalk/config/spacewalk-config.spec
+++ b/spacewalk/config/spacewalk-config.spec
@@ -2,7 +2,7 @@
Name: spacewalk-config
Summary: Spacewalk Configuration
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL:
http://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/spacewalk/package/spacewalk.spec b/spacewalk/package/spacewalk.spec
index 0294138..d04fd2d 100644
--- a/spacewalk/package/spacewalk.spec
+++ b/spacewalk/package/spacewalk.spec
@@ -1,7 +1,7 @@
%define release_name Gemini
Name: spacewalk
-Version: 0.7.4
+Version: 0.8.0
Release: 1%{?dist}
Summary: Spacewalk Systems Management Application
URL:
https://fedorahosted.org/spacewalk
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 0b8da2b..3e898e1 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 0.7.7
+Version: 0.8.0
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
diff --git a/utils/spacewalk-utils.spec b/utils/spacewalk-utils.spec
index f498c27..424992e 100644
--- a/utils/spacewalk-utils.spec
+++ b/utils/spacewalk-utils.spec
@@ -1,7 +1,7 @@
%define rhnroot %{_prefix}/share/rhn
Name: spacewalk-utils
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Utilities that may be run against a Spacewalk server.
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 6ee6ac4..89becbf 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -2,7 +2,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.7.8
+Version: 0.8.0
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
commit 5a787bbfcdca363df858fbcfe10762e59fb4a175
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 10:47:45 2009 +0100
add contributed script apply_errata
This script works against RHN Hosted (the client probably needs a
provisioning entitlement though, haven't checked) and
Satellite/Spacewalk.
The point of the script is to make it easy to apply only particular
errata (i.e. just security errata) but only up to a specific date.
This is useful for people who have to draw a line in the sand
regarding the errata they are allowed to install.
diff --git a/utils/Makefile b/utils/Makefile
index 834eee7..00d54e7 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -7,7 +7,7 @@ NAME := spacewalk-utils
SUBDIR = utils
FILES = __init__ systemSnapshot migrateSystemProfile rhnLockfile rhn_fcntl
-SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api
+SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api apply_errata
DOCBOOK = $(wildcard /usr/bin/docbook2man)
diff --git a/utils/apply_errata b/utils/apply_errata
new file mode 100755
index 0000000..f741141
--- /dev/null
+++ b/utils/apply_errata
@@ -0,0 +1,287 @@
+#!/usr/bin/python
+
+"""
+
+ 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; version 2 of the License.
+
+ 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.
+
+ Copyright 2009 Colin Coe <colin.coe(a)gmail.com>
+
+ Portions of code reused from the Satellite/Spacewalk documentation and
+ 'Mastering Regular Expressions (2nd Edition)' and various sources on
+ the Internet
+
+"""
+
+import getopt, sys, time, os, re
+import xmlrpclib, httplib
+from time import localtime
+from sys import argv
+import getpass
+
+prog = sys.argv[0]
+today = "%d-%d-%d" % (localtime()[2], localtime()[1], localtime()[0])
+erratum = []
+opt = dict()
+opt['test'] = True
+opt['user'] = ""
+opt['passwd'] = ""
+opt['sat_host'] = ""
+opt['date'] = time.localtime(time.time())
+opt['proxy'] = ""
+
+def usage(code):
+ offset = time.time() - (45 * 86400)
+ today = "%d-%d-%d" % (localtime(offset)[2], localtime(offset)[1],
localtime(offset)[0])
+ if code is not None:
+ try:
+ code = int(code)
+ except:
+ code = 0
+ else:
+ code = 0
+ print "-a - all errata - implies -b -e -s"
+ print "-b - bug fix errata"
+ print "-d <date> - date (in m-d-yy format) - defaults to today's
date"
+ print "-e - enhancement errata"
+ print "-s - security errata"
+ print "-r - do it for real - required to make the script actually
do"
+ print " updates"
+ print "-v - be verbose, implied if -r is not supplied"
+ print "-n - call /usr/sbin/rhn_check rather than waiting for the
next"
+ print " scheduled checkin"
+ print "-u <username> - username for connecting to RHN hosted or the
Satellite server"
+ print "-p <password> - password for connecting to RHN hosted or the
Satellite server"
+ print "-P <proxy> - the proxy server to use"
+ print "-z <search> - only apply errata matching this regular
expression"
+ print "-h - this help message"
+ print "Notes:"
+ print "1) Errata are scheduled only if they have a date of <date> or
older"
+ print "2) -u and -p can be ommitted if the environment variables RHN_USER and
RHN_PASS"
+ print " are defined. If -u/-p are provided and RHN_USER and RHN_PASS are
also"
+ print " defined, the -u/-p switches have preference."
+ print " If the password is '-' then the user is asked to enter the
password via stdin"
+ print "3) the search is case insensitive and looks in the errata synopsis.
An"
+ print " example use is:"
+ print " '%s -u admin -p - -P squid:3128 -s -d %s -z
\"critical|important\"'" % (prog, today)
+ print "-P <proxy> is needed to define the proxy server (and port) to use
and overrides"
+ print " the environment variable RHN_PROXY"
+ sys.exit(code)
+
+
+def testEnvVar(ev):
+ try:
+ var = os.environ[ev]
+ except:
+ return False
+ return True
+
+
+def getSysId():
+ infile = open("/etc/sysconfig/rhn/systemid","r")
+ text = infile.read()
+ pattern = re.compile("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]")
+ result = pattern.search(text)
+ infile.close()
+ if result is None:
+ print "No system ID found, please register the node with RHN or your local
Satellite/"
+ print "Spacewalk server using rhn_register or another appropriate tool"
+ sys.exit(3)
+ return int(result.group(0))
+
+
+def getServer():
+ infile = open("/etc/sysconfig/rhn/up2date","r")
+ text = infile.read()
+ pattern = re.compile("(serverURL=).*")
+ result = pattern.search(text)
+ infile.close()
+ if result is None:
+ print "No server details found. This should not happen as RHN hosted
is"
+ print "present by default. Resolve and re-run."
+ sys.exit(3)
+ return result.group(0).split("/")[2]
+
+
+class ProxiedTransport(xmlrpclib.Transport):
+ def set_proxy(self, proxy):
+ self.proxy = opt['proxy']
+ def make_connection(self, host):
+ self.realhost = host
+ h = httplib.HTTP(self.proxy)
+ return h
+ def send_request(self, connection, handler, request_body):
+ connection.putrequest("POST", 'http://%s%s' % (self.realhost,
handler))
+ def send_host(self, connection, host):
+ connection.putheader('Host', self.realhost)
+
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "abd:esrvhu:p:P:z:n")
+ except getopt.GetoptError:
+ # print help information and exit:
+ usage(2)
+
+ type = dict()
+ EI = dict()
+ EN = dict()
+ ED = dict()
+
+ type['b'] = False
+ type['e'] = False
+ type['s'] = False
+
+ if len(argv) == 1:
+ usage(1)
+
+ if testEnvVar('RHN_USER'):
+ opt['user'] = os.environ['RHN_USER']
+
+ if testEnvVar('RHN_PASS'):
+ opt['passwd'] = os.environ['RHN_PASS']
+
+ if testEnvVar('RHN_PROXY'):
+ opt['proxy'] = os.environ['RHN_PROXY']
+
+ opt['verbose'] = False
+ for o, a in opts:
+ if o == "-v":
+ opt['verbose'] = True
+ if o in ("-h"):
+ usage(0)
+ if o in ("-p"):
+ if opt['passwd'] == "":
+ opt['passwd'] = a
+ if o in ("-u"):
+ if opt['user'] == "":
+ opt['user'] = a
+ if o in ("-P"):
+ if opt['proxy'] == "":
+ opt['proxy'] = a
+ if o in ("-d"):
+ opt['date'] = a
+ if o in ("-b") or o in ("-a"):
+ type['b'] = True
+ if o in ("-e") or o in ("-a"):
+ type['e'] = True
+ if o in ("-s") or o in ("-a"):
+ type['s'] = True
+ if o in ("-r"):
+ opt['test'] = False
+ if o in ("-z"):
+ opt['search'] = a
+
+ if opt['passwd'] == '-':
+ opt['passwd'] = getpass.getpass()
+
+ try:
+ if opt['search'] == "":
+ opt['search'] = ".*"
+ except:
+ opt['search'] = ".*"
+
+ if not type['b'] and not type['e'] and not type['s']:
+ # Nothing selected, assuming all
+ type['b'] = True
+ type['e'] = True
+ type['s'] = True
+
+ if opt['test'] == True:
+ opt['verbose'] = True
+
+ if opt['user'] == "":
+ print "-u <username> not supplied and environment variable RHN_USER not
set"
+ sys.exit(4)
+
+ if opt['passwd'] == "":
+ print "-p <password> not supplied and environment variable RHN_PASS not
set"
+ sys.exit(5)
+
+ if opt['sat_host'] == "":
+ opt['sat_host'] = getServer()
+ sid = getSysId()
+
+ SATELLITE_URL = "http://%s/rpc/api" % opt['sat_host']
+
+ # If no proxy is defined, assume no proxy needed
+ if opt['proxy'] != "":
+ p = ProxiedTransport()
+ p.set_proxy(opt['proxy']);
+ client = xmlrpclib.Server(SATELLITE_URL, verbose=0, transport=p)
+ else:
+ client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
+ session = client.auth.login(opt['user'], opt['passwd'])
+
+ ue = client.system.getUnscheduledErrata(session, sid)
+
+ for e in ue:
+ year = int(e['date'].split("/")[2]) + 2000
+ month = int(e['date'].split("/")[0])
+ day = int(e['date'].split("/")[1])
+ e_epoch = int(time.mktime(time.strptime('%d-%d-%d 00:00:00' % (year, month,
day), '%Y-%m-%d %H:%M:%S')))
+
+ try:
+ year = int(opt['date'].split('-')[2])
+ month = int(opt['date'].split('-')[0])
+ day = int(opt['date'].split('-')[1])
+ except:
+ year = int(opt['date'][0])
+ month = int(opt['date'][1])
+ day = int(opt['date'][2])
+
+ d_epoch = int(time.mktime(time.strptime('%d-%d-%d 00:00:00' % (year, month,
day), '%Y-%m-%d %H:%M:%S')))
+ ED[e['id']] = time.strftime("%a, %d %b %Y %H:%M:%S +0000",
time.localtime(e_epoch))
+
+ if e_epoch < d_epoch:
+ EI[e['id']] = e['advisory_synopsis']
+ EN[e['id']] = e['advisory_name']
+
+ pattern = re.compile(opt['search'], re.I)
+ result = pattern.search(e['advisory_synopsis'])
+
+ if result is not None:
+ if type['b'] and e['advisory_name'].find("RHBA") ==
0:
+ erratum.append(e['id'])
+
+ if type['e'] and e['advisory_name'].find("RHEA") ==
0:
+ erratum.append(e['id'])
+
+ if type['s'] and e['advisory_name'].find("RHSA") ==
0:
+ erratum.append(e['id'])
+
+ if opt['verbose']:
+ print "Notes:"
+ print "\tUsing: %s" % opt['sat_host']
+ if opt['test']:
+ print "\tRunning in test mode, updates will not be scheduled"
+ else:
+ print "\tUpdates *will* be scheduled"
+ if type['b']:
+ print "\tBug fix errata selected"
+ if type['e']:
+ print "\tEnhancement errata selected"
+ if type['s']:
+ print "\tSecurity errata selected"
+ print "\t%d errata selected" % len(erratum)
+ print ""
+
+ if opt['verbose']:
+ for errata in erratum:
+ print "(Errata ID: %04d, Errata Name: %s, Released: %s) %s" % (errata,
EN[errata], ED[errata], EI[errata])
+
+ if not opt['test']:
+ client.system.applyErrata(session, sid, erratum)
+
+ client.auth.logout(session)
+
+
+if __name__ == "__main__":
+ main()
+