rel-eng/packages/spacecmd | 2 -
spacecmd/spacecmd.spec | 14 +++++++-
spacecmd/src/lib/errata.py | 17 +++++++++-
spacecmd/src/lib/misc.py | 61 ++++++++++++++++++++----------------
spacecmd/src/lib/softwarechannel.py | 15 ++++++++
5 files changed, 79 insertions(+), 30 deletions(-)
New commits:
commit 2f36316501da376e91406e6fa749d0bc43ae78ab
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 17:47:20 2011 -0500
Automatic commit of package [spacecmd] release [1.4.1-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 894cb6d..cf34e5b 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.3.8-1 spacecmd/
+1.4.1-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 6c23e18..b1d5bcc 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.4.0
+Version: 1.4.1
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -61,6 +61,18 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Thu Mar 03 2011 Aron Parsons <aparsons(a)redhat.com> 1.4.1-1
+- spacecmd: log channel access issues in debug mode only (aparsons(a)redhat.com)
+- spacecmd: ignore channel failures introduced by organizations when caching
+ packages (aparsons(a)redhat.com)
+- spacecmd: print a summary list of all errata (name, synopsis, date)
+ (aparsons(a)redhat.com)
+- spacecmd: ignore channel failures introduced by organizations when caching
+ errata (aparsons(a)redhat.com)
+- spacecmd: delete child channels first in softwarechannel_delete
+ (aparsons(a)redhat.com)
+- Bumping package versions for 1.4 (tlestach(a)redhat.com)
+
* Thu Jan 27 2011 Aron Parsons <aparsons(a)redhat.com> 1.3.8-1
- added configchannel_backup function (john(a)vanzantvoort.org)
commit d84f5974bc070a670df6e2bb0014dbab61fbfdfb
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 16:37:10 2011 -0500
spacecmd: log channel access issues in debug mode only
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 7fb48d5..6be4d59 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -459,7 +459,7 @@ def generate_errata_cache(self, force=False):
errata = \
self.client.channel.software.listErrata(self.session, c)
except:
- logging.warning('No access to %s' % c)
+ logging.debug('No access to %s' % c)
continue
for erratum in errata:
@@ -511,7 +511,7 @@ def generate_package_cache(self, force=False):
packages = \
self.client.channel.software.listAllPackages(self.session, c)
except:
- logging.warning('No access to %s' % c)
+ logging.debug('No access to %s' % c)
continue
for p in packages:
commit 736ec00f3d5e8242e11139997b84f01f784ae7d1
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 16:32:55 2011 -0500
spacecmd: ignore channel failures introduced by organizations when caching packages
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 5072a4d..7fb48d5 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -459,6 +459,7 @@ def generate_errata_cache(self, force=False):
errata = \
self.client.channel.software.listErrata(self.session, c)
except:
+ logging.warning('No access to %s' % c)
continue
for erratum in errata:
@@ -506,8 +507,12 @@ def generate_package_cache(self, force=False):
channels = [c.get('label') for c in channels]
for c in channels:
- packages = \
- self.client.channel.software.listAllPackages(self.session, c)
+ try:
+ packages = \
+ self.client.channel.software.listAllPackages(self.session, c)
+ except:
+ logging.warning('No access to %s' % c)
+ continue
for p in packages:
if not p.get('name') in self.all_packages_short:
commit 8cd1189ec1b098b49500c414dc95fdd3920b13a0
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 16:23:00 2011 -0500
spacecmd: print a summary list of all errata (name, synopsis, date)
diff --git a/spacecmd/src/lib/errata.py b/spacecmd/src/lib/errata.py
index 76ff30b..7fa77b1 100644
--- a/spacecmd/src/lib/errata.py
+++ b/spacecmd/src/lib/errata.py
@@ -20,7 +20,9 @@
# NOTE: the 'self' variable is an instance of SpacewalkShell
+from operator import itemgetter
import xmlrpclib
+
from spacecmd.utils import *
def help_errata_list(self):
@@ -38,6 +40,18 @@ def do_errata_list(self, args, doreturn=False):
####################
+def help_errata_summary(self):
+ print 'errata_summary: Print a summary of all errata'
+ print 'usage: errata_summary'
+
+def do_errata_summary(self, args):
+ self.generate_errata_cache()
+
+ map(print_errata_summary, sorted(self.all_errata.values(),
+ key = itemgetter('advisory_name')))
+
+####################
+
def help_errata_apply(self):
print 'errata_apply: Apply an erratum to all affected systems'
print 'usage: errata_apply ERRATA|search:XXX ...'
@@ -417,7 +431,8 @@ def do_errata_search(self, args, doreturn=False):
for name in self.all_errata.keys():
if re.search(query, name, re.I) or \
- re.search(query, self.all_errata[name]['synopsis'], re.I):
+ re.search(query, self.all_errata[name]['advisory_synopsis'],
+ re.I):
match = self.all_errata[name]
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index dda91eb..5072a4d 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -464,10 +464,11 @@ def generate_errata_cache(self, force=False):
for erratum in errata:
if erratum.get('advisory_name') not in self.all_errata:
self.all_errata[erratum.get('advisory_name')] = \
- { 'id' : erratum.get('id'),
- 'type' : erratum.get('advisory_type'),
- 'date' : erratum.get('date'),
- 'synopsis' : erratum.get('advisory_synopsis') }
+ { 'id' : erratum.get('id'),
+ 'advisory_name' :
erratum.get('advisory_name'),
+ 'advisory_type' :
erratum.get('advisory_type'),
+ 'date' : erratum.get('date'),
+ 'advisory_synopsis' :
erratum.get('advisory_synopsis') }
self.errata_cache_expire = \
datetime.now() + timedelta(self.ERRATA_CACHE_TTL)
commit 6b9ca5669c628082e563e00a2fad6401ccc620eb
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 16:02:25 2011 -0500
spacecmd: ignore channel failures introduced by organizations when caching errata
diff --git a/spacecmd/src/lib/misc.py b/spacecmd/src/lib/misc.py
index 1bf5f5f..dda91eb 100644
--- a/spacecmd/src/lib/misc.py
+++ b/spacecmd/src/lib/misc.py
@@ -256,7 +256,7 @@ def do_login(self, args):
and not self.options.password:
try:
sessionfile = open(session_file, 'r')
-
+
# read the session (format = username:session)
for line in sessionfile:
parts = line.split(':')
@@ -455,11 +455,14 @@ def generate_errata_cache(self, force=False):
channels = [c.get('label') for c in channels]
for c in channels:
- errata = \
- self.client.channel.software.listErrata(self.session, c)
+ try:
+ errata = \
+ self.client.channel.software.listErrata(self.session, c)
+ except:
+ continue
for erratum in errata:
- if erratum.get('advisory_name') not in self.all_errata:
+ if erratum.get('advisory_name') not in self.all_errata:
self.all_errata[erratum.get('advisory_name')] = \
{ 'id' : erratum.get('id'),
'type' : erratum.get('advisory_type'),
@@ -477,8 +480,8 @@ def generate_errata_cache(self, force=False):
def save_errata_cache(self):
- save_cache(self.errata_cache_file,
- self.all_errata,
+ save_cache(self.errata_cache_file,
+ self.all_errata,
self.errata_cache_expire)
@@ -513,8 +516,8 @@ def generate_package_cache(self, force=False):
if not longname in self.all_packages:
self.all_packages[longname] = p.get('id')
-
- # keep a reverse dictionary so we can lookup package names by ID
+
+ # keep a reverse dictionary so we can lookup package names by ID
self.all_packages_by_id = \
dict( (v, k) for k, v in self.all_packages.iteritems() )
@@ -531,15 +534,15 @@ def generate_package_cache(self, force=False):
def save_package_caches(self):
# store the cache to disk to speed things up
save_cache(self.packages_short_cache_file,
- self.all_packages_short,
+ self.all_packages_short,
self.package_cache_expire)
-
- save_cache(self.packages_long_cache_file,
- self.all_packages,
+
+ save_cache(self.packages_long_cache_file,
+ self.all_packages,
self.package_cache_expire)
- save_cache(self.packages_by_id_cache_file,
- self.all_packages_by_id,
+ save_cache(self.packages_by_id_cache_file,
+ self.all_packages_by_id,
self.package_cache_expire)
@@ -602,8 +605,8 @@ def generate_system_cache(self, force=False):
def save_system_cache(self):
- save_cache(self.system_cache_file,
- self.all_systems,
+ save_cache(self.system_cache_file,
+ self.all_systems,
self.system_cache_expire)
@@ -640,15 +643,15 @@ def load_caches(self, server):
(self.all_errata, self.errata_cache_expire) = \
load_cache(self.errata_cache_file)
- # load self.all_packages_short from disk
+ # load self.all_packages_short from disk
(self.all_packages_short, self.package_cache_expire) = \
load_cache(self.packages_short_cache_file)
- # load self.all_packages from disk
+ # load self.all_packages from disk
(self.all_packages, self.package_cache_expire) = \
load_cache(self.packages_long_cache_file)
- # load self.all_packages_by_id from disk
+ # load self.all_packages_by_id from disk
(self.all_packages_by_id, self.package_cache_expire) = \
load_cache(self.packages_by_id_cache_file)
@@ -767,7 +770,7 @@ def expand_systems(self, args):
except ValueError:
# just a system name
systems.append(item)
-
+
matches = filter_results(self.get_system_names(), systems)
return matches + system_ids
commit d1052d7f94f9f1a3055ef5bbaf3ff627cc133048
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Thu Mar 3 14:44:46 2011 -0500
spacecmd: delete child channels first in softwarechannel_delete
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index b475366..af4994b 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -340,7 +340,20 @@ def do_softwarechannel_delete(self, args):
if not self.user_confirm('Delete these channels [y/N]:'): return
- for channel in to_delete:
+ # delete child channels first to avoid errors
+ parents = []
+ children = []
+
+ all_channels = self.client.channel.listSoftwareChannels(self.session)
+
+ for channel in all_channels:
+ if channel.get('label') in to_delete:
+ if channel.get('parent_label'):
+ children.append(channel.get('label'))
+ else:
+ parents.append(channel.get('label'))
+
+ for channel in children + parents:
self.client.channel.software.delete(self.session, channel)
####################