rel-eng/packages spacecmd/spacecmd.spec
by shardy
rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 31 ++++++++++++++++++++++++++++++-
2 files changed, 31 insertions(+), 2 deletions(-)
New commits:
commit 9c057ddfc2c5db015bc86c8187ce86d7551ebac6
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 29 14:37:46 2012 +0100
Automatic commit of package [spacecmd] release [1.8.2-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index b64ce1c..8aee942 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-1.8.1-1 spacecmd/
+1.8.2-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 642dd51..ca8a761 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 1.8.1
+Version: 1.8.2
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -61,6 +61,35 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Thu Mar 29 2012 Steven Hardy <shardy(a)redhat.com> 1.8.2-1
+- spacecmd : softwarechannel_clone avoid ISE on duplicate name
+ (shardy(a)redhat.com)
+- spacecmd bugfix : softwarechannel_adderrata mergeErrata should be
+ cloneErrataAsOriginal (shardy(a)redhat.com)
+- spacecmd enhancement : Add globbing support to distribution_details
+ (shardy(a)redhat.com)
+- spacecmd enhancement : Add globbing support to distribution_delete
+ (shardy(a)redhat.com)
+- spacecmd : Cleanup some typos in comments (shardy(a)redhat.com)
+- spacecmd enhancement : custominfo_details add support for globbing key names
+ (shardy(a)redhat.com)
+- spacecmd enhancement : custominfo_deletekey add support for globbing key
+ names (shardy(a)redhat.com)
+- spacecmd enhancement : Add cryptokey_details globbing support
+ (shardy(a)redhat.com)
+- spacecmd enhancement : cryptokey_delete add support for globbing
+ (shardy(a)redhat.com)
+- spacecmd : Workaround missing date key in recent spacewalk listErrata
+ (shardy(a)redhat.com)
+- spacecmd : Add validation to softwarechannel_adderrata channel args
+ (shardy(a)redhat.com)
+- spacecmd enhancement : softwarechannel_adderrata add --skip mode
+ (shardy(a)redhat.com)
+- spacecmd enhancement : Add --quick mode to softwarechannel_adderrata
+ (shardy(a)redhat.com)
+- spacecmd enhancement : Allow config-channel export of b64 encoded files
+ (shardy(a)redhat.com)
+
* Mon Mar 12 2012 Jan Pazdziora 1.8.1-1
- Update the spacecmd copyright years for Red Hat contributions.
12 years, 1 month
14 commits - spacecmd/src
by shardy
spacecmd/src/lib/configchannel.py | 30 +++++--
spacecmd/src/lib/cryptokey.py | 30 ++++++-
spacecmd/src/lib/custominfo.py | 27 ++++++
spacecmd/src/lib/distribution.py | 48 +++++++++---
spacecmd/src/lib/softwarechannel.py | 140 +++++++++++++++++++++++-------------
spacecmd/src/lib/utils.py | 7 +
6 files changed, 206 insertions(+), 76 deletions(-)
New commits:
commit 10513eaaed48f1d737401965b1d52af111d08233
Author: Steven Hardy <shardy(a)redhat.com>
Date: Fri Mar 23 18:42:42 2012 +0000
spacecmd : softwarechannel_clone avoid ISE on duplicate name
Duplicate name in target channel causes ISE, and duplicate label is only handled
by printing the xmlrpc error, can catch both of these before attempting the
clone, also affects softwarechannel_clonetree so fix both
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index fb6f4b3..48ddc0c 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -533,6 +533,21 @@ def do_softwarechannel_create(self, args):
####################
+def softwarechannel_check_existing(self, name, label):
+ # Catch label or name which already exists, duplicate label throws a
+ # descriptive xmlrpc error, but duplicate name results in ISE
+ for c in self.list_base_channels() + self.list_child_channels():
+ cd = self.client.channel.software.getDetails(self.session, c)
+ if cd['name'] == name:
+ logging.error("Name %s already in use by channel %s" %\
+ (name, cd['label']))
+ return True
+ if cd['label'] == label:
+ logging.error("Label %s already in use by channel %s" %\
+ (label, cd['label']))
+ return True
+ return False
+
def help_softwarechannel_clone(self):
print 'softwarechannel_clone: Clone a software channel'
print '''usage: softwarechannel_clone [options]
@@ -630,6 +645,9 @@ def do_softwarechannel_clone(self, args):
logging.debug("regex mode : %s %s %s" % (options.source_channel,\
options.name, options.label))
+ # Catch label or name which already exists
+ if self.softwarechannel_check_existing(options.name, options.label):
+ return
details = { 'name' : options.name,
'label' : options.label,
@@ -785,6 +803,10 @@ def do_softwarechannel_clonetree(self, args):
logging.error("called without prefix or regex option!")
return
+ # Catch label or name which already exists
+ if self.softwarechannel_check_existing(name, label):
+ return
+
details = { 'name' : name,
'label' : label,
'summary' : name }
commit 328582fe40a4bb8b526dc449ceb63216e7354f21
Author: Steven Hardy <shardy(a)redhat.com>
Date: Fri Mar 23 18:20:13 2012 +0000
spacecmd bugfix : softwarechannel_adderrata mergeErrata should be cloneErrataAsOriginal
Remove the logic which uses mergeErrata, since testing indicates mergeErrata
simply adds the errata (not the packages), so a better plan is to use
cloneAsOriginal regardless of the API version.
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 48f7831..fb6f4b3 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1262,35 +1262,21 @@ def do_softwarechannel_adderrata(self, args):
if not self.user_confirm('Add these errata [y/N]:'): return
- if self.check_api_version('10.12'):
- merged = self.client.channel.software.mergeErrata(self.session,
- source_channel,
- dest_channel,
- errata)
-
- # show the user which errata were actually merged
- if self.options.debug:
- print
- print "Errata Merged"
- print "-------------"
- print
- print_errata_list(merged)
- else:
- # clone each erratum individually because the process is slow and it can
- # lead to timeouts on the server
- for erratum in errata:
- logging.debug('Cloning %s' % erratum)
- if self.check_api_version('10.11'):
- # This call is poorly documented, but it stops errata.clone
- # pushing EL6 packages into EL5 channels when the errata
- # package list contains both versions, ref bz678721
- self.client.errata.cloneAsOriginal(self.session, dest_channel,\
- [erratum])
- else:
- logging.warning("Using the old errata.clone function")
- logging.warning("If you have base channels for multiple OS" +\
- " versions, check no unexpected packages have been added")
- self.client.errata.clone(self.session, dest_channel, [erratum])
+ # clone each erratum individually because the process is slow and it can
+ # lead to timeouts on the server
+ for erratum in errata:
+ logging.debug('Cloning %s' % erratum)
+ if self.check_api_version('10.11'):
+ # This call is poorly documented, but it stops errata.clone
+ # pushing EL6 packages into EL5 channels when the errata
+ # package list contains both versions, ref bz678721
+ self.client.errata.cloneAsOriginal(self.session, dest_channel,\
+ [erratum])
+ else:
+ logging.warning("Using the old errata.clone function")
+ logging.warning("If you have base channels for multiple OS" +\
+ " versions, check no unexpected packages have been added")
+ self.client.errata.clone(self.session, dest_channel, [erratum])
# regenerate the errata cache since we just cloned errata
self.generate_errata_cache(True)
commit 39a49adae8f6cef413acd0f4aedd4e950136a7de
Author: Steven Hardy <shardy(a)redhat.com>
Date: Fri Mar 23 08:14:03 2012 +0000
spacecmd enhancement : Add globbing support to distribution_details
Adds support for globbing distribution names similar to many other spacecmd functions
diff --git a/spacecmd/src/lib/distribution.py b/spacecmd/src/lib/distribution.py
index 5a5d78b..14b66ed 100644
--- a/spacecmd/src/lib/distribution.py
+++ b/spacecmd/src/lib/distribution.py
@@ -188,21 +188,34 @@ def complete_distribution_details(self, text, line, beg, end):
def do_distribution_details(self, args):
(args, options) = parse_arguments(args)
- if len(args) != 1:
+ if not len(args):
self.help_distribution_details()
return
- label = args[0]
+ # allow globbing of distribution names
+ dists = filter_results(self.do_distribution_list('', True), args)
+ logging.debug("distribution_details called with args %s, dists=%s" % \
+ (args, dists))
+
+ if not len(dists):
+ logging.error("No distributions matched argument %s" % args)
+ return
+
+ add_separator = False
- details = self.client.kickstart.tree.getDetails(self.session, label)
+ for label in dists:
+ details = self.client.kickstart.tree.getDetails(self.session, label)
- channel = \
- self.client.channel.software.getDetails(self.session,
+ channel = \
+ self.client.channel.software.getDetails(self.session,
details.get('channel_id'))
- print 'Name: %s' % details.get('label')
- print 'Path: %s' % details.get('abs_path')
- print 'Channel: %s' % channel.get('label')
+ if add_separator: print self.SEPARATOR
+ add_separator = True
+
+ print 'Name: %s' % details.get('label')
+ print 'Path: %s' % details.get('abs_path')
+ print 'Channel: %s' % channel.get('label')
####################
commit e099c52deb0864a4147a6643edf642b40bc103a9
Author: Steven Hardy <shardy(a)redhat.com>
Date: Fri Mar 23 08:06:34 2012 +0000
spacecmd enhancement : Add globbing support to distribution_delete
Adds support for globbing distribution names similar to other spacecmd functions
diff --git a/spacecmd/src/lib/distribution.py b/spacecmd/src/lib/distribution.py
index 035b1e2..5a5d78b 100644
--- a/spacecmd/src/lib/distribution.py
+++ b/spacecmd/src/lib/distribution.py
@@ -156,14 +156,25 @@ def complete_distribution_delete(self, text, line, beg, end):
def do_distribution_delete(self, args):
(args, options) = parse_arguments(args)
- if len(args) != 1:
+ if not len(args):
self.help_distribution_delete()
return
- label = args[0]
+ # allow globbing of distribution names
+ dists = filter_results(self.do_distribution_list('', True), args)
+ logging.debug("distribution_delete called with args %s, dists=%s" % \
+ (args, dists))
+
+ if not len(dists):
+ logging.error("No distributions matched argument %s" % args)
+ return
+
+ # Print the distributions prior to the confirmation
+ print '\n'.join(sorted(dists))
- if self.user_confirm('Delete this tree [y/N]:'):
- self.client.kickstart.tree.delete(self.session, label)
+ if self.user_confirm('Delete distribution tree(s) [y/N]:'):
+ for d in dists:
+ self.client.kickstart.tree.delete(self.session, d)
####################
commit affcdbe5b518927653401091b59641270b27ba0d
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 19:19:25 2012 +0000
spacecmd : Cleanup some typos in comments
Trival cleanups to some cut/paste comment errors
diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py
index 2ec5d20..5b4701b 100644
--- a/spacecmd/src/lib/configchannel.py
+++ b/spacecmd/src/lib/configchannel.py
@@ -359,7 +359,7 @@ def do_configchannel_delete(self, args):
self.help_configchannel_delete()
return
- # allow globbing of configchannel channel names
+ # allow globbing of configchannel names
channels = filter_results(self.do_configchannel_list('', True), args)
logging.debug("configchannel_delete called with args %s, channels=%s" % \
(args, channels))
@@ -368,7 +368,7 @@ def do_configchannel_delete(self, args):
logging.error("No channels matched argument %s" % args)
return
- # Print the channels prior to the confimation
+ # Print the channels prior to the confirmation
print '\n'.join(sorted(channels))
if self.user_confirm('Delete these channels [y/N]:'):
@@ -872,7 +872,7 @@ def do_configchannel_export(self, args):
logging.info("Exporting ALL config channels to %s" % filename)
ccs = self.do_configchannel_list('', True)
else:
- # allow globbing of configchannel channel names
+ # allow globbing of configchannel names
ccs = filter_results(self.do_configchannel_list('', True), args)
logging.debug("configchannel_export called with args %s, ccs=%s" % \
(args, ccs))
@@ -1060,7 +1060,7 @@ def do_configchannel_clone(self, args):
self.help_configchannel_clone()
return
logging.debug("Got args=%s %d" % (args, len(args)))
- # allow globbing of configchannel channel names
+ # allow globbing of configchannel names
ccs = filter_results(self.do_configchannel_list('', True), args)
logging.debug("Filtered ccs %s" % ccs)
for cc in ccs:
commit 57e5f5e19d6e4b2b8f2057fd491810109e1398f3
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 19:16:53 2012 +0000
spacecmd enhancement : custominfo_details add support for globbing key names
Adds support for globbing key names similar to many other spacecmd functions
diff --git a/spacecmd/src/lib/custominfo.py b/spacecmd/src/lib/custominfo.py
index 4dd799a..c505e51 100644
--- a/spacecmd/src/lib/custominfo.py
+++ b/spacecmd/src/lib/custominfo.py
@@ -113,11 +113,20 @@ def do_custominfo_details(self, args):
self.help_custominfo_details()
return
+ # allow globbing of custominfo key names
+ keys = filter_results(self.do_custominfo_listkeys('', True), args)
+ logging.debug("customkey_details called with args %s, keys=%s" % \
+ (args, keys))
+
+ if not len(keys):
+ logging.error("No keys matched argument %s" % args)
+ return
+
add_separator = False
all_keys = self.client.system.custominfo.listAllKeys(self.session)
- for key in args:
+ for key in keys:
for k in all_keys:
if k.get('label') == key:
details = k
commit 9f62ce365427533756a0876ba0831c2e1ac58469
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 19:12:26 2012 +0000
spacecmd enhancement : custominfo_deletekey add support for globbing key names
Adds support for globbing key names similar to many other spacecmd functions
diff --git a/spacecmd/src/lib/custominfo.py b/spacecmd/src/lib/custominfo.py
index c5a068d..4dd799a 100644
--- a/spacecmd/src/lib/custominfo.py
+++ b/spacecmd/src/lib/custominfo.py
@@ -63,10 +63,22 @@ def do_custominfo_deletekey(self, args):
if not len(args):
self.help_custominfo_deletekey()
return
-
+
+ # allow globbing of custominfo key names
+ keys = filter_results(self.do_custominfo_listkeys('', True), args)
+ logging.debug("customkey_deletekey called with args %s, keys=%s" % \
+ (args, keys))
+
+ if not len(keys):
+ logging.error("No keys matched argument %s" % args)
+ return
+
+ # Print the keys prior to the confirmation
+ print '\n'.join(sorted(keys))
+
if not self.user_confirm('Delete these keys [y/N]:'): return
- for key in args:
+ for key in keys:
self.client.system.custominfo.deleteKey(self.session, key)
####################
commit 2e182eea13b9bfcda9bb748c2f826af32911bf8b
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 18:59:41 2012 +0000
spacecmd enhancement : Add cryptokey_details globbing support
Adds support for globbing key names similar to several other spacecmd functions
diff --git a/spacecmd/src/lib/cryptokey.py b/spacecmd/src/lib/cryptokey.py
index 9870e3d..c59d718 100644
--- a/spacecmd/src/lib/cryptokey.py
+++ b/spacecmd/src/lib/cryptokey.py
@@ -148,9 +148,18 @@ def do_cryptokey_details(self, args):
self.help_cryptokey_details()
return
+ # allow globbing of cryptokey names
+ keys = filter_results(self.do_cryptokey_list('', True), args)
+ logging.debug("cryptokey_details called with args %s, keys=%s" % \
+ (args, keys))
+
+ if not len(keys):
+ logging.error("No keys matched argument %s" % args)
+ return
+
add_separator = False
- for key in args:
+ for key in keys:
try:
details = self.client.kickstart.keys.getDetails(self.session,
key)
commit 3c2dfb0fd0521609a1da71190261ea9e363160a0
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 18:55:59 2012 +0000
spacecmd enhancement : cryptokey_delete add support for globbing
Adds support for globbing key names similar to many other spacecmd functions
diff --git a/spacecmd/src/lib/cryptokey.py b/spacecmd/src/lib/cryptokey.py
index 55392aa..9870e3d 100644
--- a/spacecmd/src/lib/cryptokey.py
+++ b/spacecmd/src/lib/cryptokey.py
@@ -96,14 +96,25 @@ def complete_cryptokey_delete(self, text, line, beg, end):
def do_cryptokey_delete(self, args):
(args, options) = parse_arguments(args)
- if len(args) != 1:
+ if not len(args):
self.help_cryptokey_delete()
return
- name = args[0]
+ # allow globbing of cryptokey names
+ keys = filter_results(self.do_cryptokey_list('', True), args)
+ logging.debug("cryptokey_delete called with args %s, keys=%s" % \
+ (args, keys))
+
+ if not len(keys):
+ logging.error("No keys matched argument %s" % args)
+ return
+
+ # Print the keys prior to the confirmation
+ print '\n'.join(sorted(keys))
- if self.user_confirm('Delete this key [y/N]:'):
- self.client.kickstart.keys.delete(self.session, name)
+ if self.user_confirm('Delete key(s) [y/N]:'):
+ for key in keys:
+ self.client.kickstart.keys.delete(self.session, key)
####################
commit b922ab450930c1c7df3f9e2d4849bf478622e089
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 18:39:38 2012 +0000
spacecmd : Workaround missing date key in recent spacewalk listErrata
Workaround - recent spacewalk lacks the "date" key on some listErrata calls
so use "issue_date" if we don't find "date"
diff --git a/spacecmd/src/lib/utils.py b/spacecmd/src/lib/utils.py
index b4a12bc..66ec32c 100644
--- a/spacecmd/src/lib/utils.py
+++ b/spacecmd/src/lib/utils.py
@@ -347,7 +347,12 @@ def build_package_names(packages):
def print_errata_summary(erratum):
- date_parts = erratum.get('date').split()
+ # Workaround - recent spacewalk lacks the "date" key
+ # on some listErrata calls
+ if erratum.has_key('date'):
+ date_parts = erratum.get('date').split()
+ else:
+ date_parts = erratum.get('issue_date').split()
if len(date_parts) > 1:
erratum['date'] = date_parts[0]
commit 2a01e02d3d1389931449d4df230e31f148391489
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 08:36:17 2012 +0000
spacecmd : Add validation to softwarechannel_adderrata channel args
Avoid stack-trace and xmlrpc error when incorrect channel args passed
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index cb6c8d5..48f7831 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1181,8 +1181,17 @@ def do_softwarechannel_adderrata(self, args):
self.help_softwarechannel_adderrata()
return
+ allchannels = self.do_softwarechannel_list('', True)
source_channel = args[0]
+ if not source_channel in allchannels:
+ logging.error("source channel %s does not exist!" % source_channel)
+ self.help_softwarechannel_adderrata()
+ return
dest_channel = args[1]
+ if not dest_channel in allchannels:
+ logging.error("dest channel %s does not exist!" % dest_channel)
+ self.help_softwarechannel_adderrata()
+ return
errata_wanted = self.expand_errata(args[2:])
logging.debug('Retrieving the list of errata from source channel')
commit 60a5f09299ec865e8f612a896df6189ab5a65c72
Author: Steven Hardy <shardy(a)redhat.com>
Date: Thu Mar 22 08:27:01 2012 +0000
spacecmd enhancement : softwarechannel_adderrata add --skip mode
Adds -s/--skip mode to softwarechannel_adderrata, which skips any errata which
appear to already exist in the destination channel
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 8613fdc..cb6c8d5 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1161,6 +1161,7 @@ def help_softwarechannel_adderrata(self):
print 'usage: softwarechannel_adderrata SOURCE DEST <ERRATA|search:XXX ...>'
print 'Options:'
print ' -q/--quick : Don\'t display list of packages (slightly faster)'
+ print ' -s/--skip : Skip errata which appear to exist already in DEST'
def complete_softwarechannel_adderrata(self, text, line, beg, end):
parts = line.split(' ')
@@ -1171,7 +1172,8 @@ def complete_softwarechannel_adderrata(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_softwarechannel_adderrata(self, args):
- options = [ Option('-q', '--quick', action='store_true') ]
+ options = [ Option('-q', '--quick', action='store_true'),
+ Option('-s', '--skip', action='store_true') ]
(args, options) = parse_arguments(args, options)
@@ -1186,9 +1188,28 @@ def do_softwarechannel_adderrata(self, args):
logging.debug('Retrieving the list of errata from source channel')
source_errata = self.client.channel.software.listErrata(self.session,
source_channel)
+ dest_errata = self.client.channel.software.listErrata(self.session,
+ dest_channel)
errata = filter_results([ e.get('advisory_name') for e in source_errata ],
errata_wanted)
+ logging.debug("errata = %s" % errata)
+ if options.skip:
+ # We just match the NNNN:MMMM of the XXXX-NNNN:MMMM as the
+ # source errata will be RH[BES]A and the DEST errata will be CLA
+ dest_errata_suffix = [ x.get('advisory_name').split("-")[1] \
+ for x in dest_errata]
+ logging.debug("dest_errata_suffix = %s" % dest_errata_suffix)
+ toremove = []
+ for e in errata:
+ if e.split("-")[1] in dest_errata_suffix:
+ logging.debug("Skipping errata %s as it seems to be in %s" %\
+ (e, dest_channel))
+ toremove.append(e)
+ for e in toremove:
+ logging.debug("Removing %s from errata to be added" % e)
+ errata.remove(e)
+ logging.debug("skip-mode : reduced errata = %s" % errata)
# keep the details for our matching errata so we can use them later
errata_details = []
commit 60a298ca05cdb969d9d577da0aabc0c67411fc9a
Author: Steven Hardy <shardy(a)redhat.com>
Date: Wed Mar 21 18:27:49 2012 +0000
spacecmd enhancement : Add --quick mode to softwarechannel_adderrata
For non-interactive use calculating the package list is not necessary and takes
quite a long time, -q/--quick allows a quiet/quick mode which bypasses the
package-list calculation and display
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 1fda6cf..8613fdc 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -1159,6 +1159,8 @@ def help_softwarechannel_adderrata(self):
print 'softwarechannel_adderrata: Add errata from one channel ' + \
'into another channel'
print 'usage: softwarechannel_adderrata SOURCE DEST <ERRATA|search:XXX ...>'
+ print 'Options:'
+ print ' -q/--quick : Don\'t display list of packages (slightly faster)'
def complete_softwarechannel_adderrata(self, text, line, beg, end):
parts = line.split(' ')
@@ -1169,7 +1171,9 @@ def complete_softwarechannel_adderrata(self, text, line, beg, end):
return self.tab_complete_errata(text)
def do_softwarechannel_adderrata(self, args):
- (args, options) = parse_arguments(args)
+ options = [ Option('-q', '--quick', action='store_true') ]
+
+ (args, options) = parse_arguments(args, options)
if len(args) < 3:
self.help_softwarechannel_adderrata()
@@ -1192,19 +1196,20 @@ def do_softwarechannel_adderrata(self, args):
if erratum.get('advisory_name') in errata:
errata_details.append(erratum)
- # get the packages that resolve these errata so we can add them
- # to the channel afterwards
- package_ids = []
- for erratum in errata:
- logging.debug('Retrieving packages for errata %s' % erratum)
+ if not options.quick:
+ # get the packages that resolve these errata so we can add them
+ # to the channel afterwards
+ package_ids = []
+ for erratum in errata:
+ logging.debug('Retrieving packages for errata %s' % erratum)
- # get the packages affected by this errata
- packages = self.client.errata.listPackages(self.session, erratum)
+ # get the packages affected by this errata
+ packages = self.client.errata.listPackages(self.session, erratum)
- # only add packages that exist in the source channel
- for package in packages:
- if source_channel in package.get('providing_channels'):
- package_ids.append(package.get('id'))
+ # only add packages that exist in the source channel
+ for package in packages:
+ if source_channel in package.get('providing_channels'):
+ package_ids.append(package.get('id'))
if not len(errata):
logging.warning('No errata to add')
@@ -1213,16 +1218,19 @@ def do_softwarechannel_adderrata(self, args):
# show the user which errata will be added
print_errata_list(errata_details)
- print
- print 'Packages'
- print '--------'
- print '\n'.join(sorted([ self.get_package_name(p) for p in package_ids ]))
+ if not options.quick:
+ print
+ print 'Packages'
+ print '--------'
+ print '\n'.join(sorted([ self.get_package_name(p) for p in package_ids ]))
- print
+ print
print 'Total Errata: %s' % str(len(errata)).rjust(3)
- print 'Total Packages: %s' % str(len(package_ids)).rjust(3)
- if not self.user_confirm('Add these errata and packages [y/N]:'): return
+ if not options.quick:
+ print 'Total Packages: %s' % str(len(package_ids)).rjust(3)
+
+ if not self.user_confirm('Add these errata [y/N]:'): return
if self.check_api_version('10.12'):
merged = self.client.channel.software.mergeErrata(self.session,
commit ebf582b8861c1771400fdd25b7d04493069012c9
Author: Steven Hardy <shardy(a)redhat.com>
Date: Tue Mar 20 18:59:49 2012 +0000
spacecmd enhancement : Allow config-channel export of b64 encoded files
Recent spacewalk API versions have configchannel.getEncodedFileRevision
this can be used to export binary of problematic ascii files
diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py
index 285c2d8..2ec5d20 100644
--- a/spacecmd/src/lib/configchannel.py
+++ b/spacecmd/src/lib/configchannel.py
@@ -822,6 +822,21 @@ def export_configchannel_getdetails(self, channel):
# string "macro-start-delimiter" Y N
# string "macro-end-delimiter" Y N
for f in fileinfo:
+ # If we're using a recent API version files exported with no contents
+ # i.e binary or non-xml encodable ascii files can be exported as
+ # base64 encoded
+ if not f.has_key('contents'):
+ if not self.check_api_version('11.1'):
+ logging.warning("File %s could not be exported " % f['path'] +\
+ "with this API version(needs base64 encoding)")
+ else:
+ logging.info("File %s could not be exported as" % f['path'] +\
+ " text...getting base64 encoded version")
+ b64f = self.client.configchannel.getEncodedFileRevision(\
+ self.session, channel, f['path'], f['revision'])
+ f['contents'] = b64f['contents']
+ f['contents_enc64'] = b64f['contents_enc64']
+
for k in [ 'channel', 'revision', 'creation', 'modified', \
'permissions_mode', 'binary', 'md5' ]:
if f.has_key(k):
@@ -954,7 +969,8 @@ def import_configchannel_fromdetails(self, ccdetails):
isdir = False
# If binary files (or those containing characters which are
# invalid in XML, e.g the ascii escape character) are
- # exported, you end up with a file with no "contents" key
+ # exported, on older API versions, you end up with a file
+ # with no "contents" key (
# I guess the best thing to do here flag an error and
# import everything else
if not filedetails.has_key('contents'):
@@ -965,9 +981,7 @@ def import_configchannel_fromdetails(self, ccdetails):
continue
# Now we check if the file needs base64 encoding
# This will be because of trailing newlines (which get
- # eaten by the API), since as mentioned above, binary
- # and other problematic files can't be exported (there's
- # no option to export in base64 encoded format AFAICS)
+ # eaten by the API)
elif self.file_needs_b64_enc(filedetails['contents']):
logging.debug("Detected file needs base64 encoding")
filedetails['contents'] =\
12 years, 1 month
Changes to 'refs/tags/spacewalk-oscap-0.0.6-1'
by Šimon Lukašík
Tag 'spacewalk-oscap-0.0.6-1' created by Simon Lukasik <slukasik(a)redhat.com> at 2012-03-29 14:37 +0000
Tagging package [spacewalk-oscap] version [0.0.6-1] in directory [client/rhel/spacewalk-oscap/].
Changes since spacewalk-schema-1.8.12-1:
Simon Lukasik (3):
Truncate data which are longer than db allows
When errors occur submit them back to the server.
Automatic commit of package [spacewalk-oscap] release [0.0.6-1].
---
backend/server/action_extra_data/scap.py | 40 ++++++++++++++++++-----
client/rhel/spacewalk-oscap/scap.py | 2 -
client/rhel/spacewalk-oscap/spacewalk-oscap.spec | 5 ++
rel-eng/packages/spacewalk-oscap | 2 -
4 files changed, 38 insertions(+), 11 deletions(-)
---
12 years, 1 month
client/rhel rel-eng/packages
by Šimon Lukašík
client/rhel/spacewalk-oscap/spacewalk-oscap.spec | 5 ++++-
rel-eng/packages/spacewalk-oscap | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 68744749d556da053b24e747db46189cedb78e1e
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Mar 29 16:37:39 2012 +0200
Automatic commit of package [spacewalk-oscap] release [0.0.6-1].
diff --git a/client/rhel/spacewalk-oscap/spacewalk-oscap.spec b/client/rhel/spacewalk-oscap/spacewalk-oscap.spec
index a30bafa..b861b0c 100644
--- a/client/rhel/spacewalk-oscap/spacewalk-oscap.spec
+++ b/client/rhel/spacewalk-oscap/spacewalk-oscap.spec
@@ -1,5 +1,5 @@
Name: spacewalk-oscap
-Version: 0.0.5
+Version: 0.0.6
Release: 1%{?dist}
Summary: OpenSCAP plug-in for rhn-check
@@ -43,6 +43,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Mar 29 2012 Simon Lukasik <slukasik(a)redhat.com> 0.0.6-1
+- When errors occur submit them back to the server. (slukasik(a)redhat.com)
+
* Thu Mar 29 2012 Simon Lukasik <slukasik(a)redhat.com> 0.0.5-1
- Store also @idref of xccdf:rule-result element (slukasik(a)redhat.com)
- We want to store all idents per rule-result (slukasik(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-oscap b/rel-eng/packages/spacewalk-oscap
index 6bf08d1..6d7249e 100644
--- a/rel-eng/packages/spacewalk-oscap
+++ b/rel-eng/packages/spacewalk-oscap
@@ -1 +1 @@
-0.0.5-1 client/rhel/spacewalk-oscap/
+0.0.6-1 client/rhel/spacewalk-oscap/
12 years, 1 month
client/rhel
by Šimon Lukašík
client/rhel/spacewalk-oscap/scap.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 2ba74f1eefa093a1b6a78cc3f7d9bf95b9395657
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Mar 29 15:50:42 2012 +0200
When errors occur submit them back to the server.
On the web user interface user will see the following:
Client execution returned "oscap tool did not produce valid xml.
Profile "server" was not found. xccdf_eval: oscap tool returned 1" (code 1)
diff --git a/client/rhel/spacewalk-oscap/scap.py b/client/rhel/spacewalk-oscap/scap.py
index ec93248..cfcf46d 100644
--- a/client/rhel/spacewalk-oscap/scap.py
+++ b/client/rhel/spacewalk-oscap/scap.py
@@ -19,7 +19,7 @@ def xccdf_eval(args, cache_only=None):
oscap_err = _run_oscap(['xccdf', 'eval', '--results', results_file.name]
+ args['params'].split(' ') + [args['path']])
if not _assert_xml(results_file.name):
- return (1, 'oscap tool did not produce valid xml.', {})
+ return (1, 'oscap tool did not produce valid xml.\n' + oscap_err, {})
ret, resume, xslt_err = _xccdf_resume(results_file.name)
del(results_file)
12 years, 1 month
backend/server
by Šimon Lukašík
backend/server/action_extra_data/scap.py | 40 ++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 8 deletions(-)
New commits:
commit 551d93c71d1b037b4711c1a9e51ca79b7f222df4
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Mar 29 15:25:23 2012 +0200
Truncate data which are longer than db allows
While this kind of problems should be rare enough
given the limits, it should definitelly not end up
as ISE.
Addressing:
SQLError: (12899, 'ORA-12899: value too large for column "SPACEWALK"."RHNXCCDFIDENT"."IDENTIFIER" (actual: 83, maximum: 80)\n
ORA-06512: at "SPACEWALK.INSERT_XCCDF_IDENT", line 7\nORA-06512: at "SPACEWALK.LOOKUP_XCCDF_IDENT", line 32\n
ORA-01403: no data found\n', 'insert into rhnXccdfRuleIdentMap (rresult_id, ident_id) values ( :rr_id, lookup_xccdf_ident(:system, :ident) )')
diff --git a/backend/server/action_extra_data/scap.py b/backend/server/action_extra_data/scap.py
index e21cc10..b4329b6 100644
--- a/backend/server/action_extra_data/scap.py
+++ b/backend/server/action_extra_data/scap.py
@@ -54,20 +54,29 @@ def _process_testresult(tr, server_id, action_id, benchmark, profile, errors):
h = rhnSQL.prepare(_query_insert_tresult, blob_map={'errors': 'errors'})
h.execute(server_id=server_id,
action_id=action_id,
- bench_id=benchmark.getAttribute('id'),
- bench_version=benchmark.getAttribute('version'),
+ bench_id=_truncate(benchmark.getAttribute('id'), 120),
+ bench_version=_truncate(benchmark.getAttribute('version'), 80),
profile_id=profile.getAttribute('id'),
- profile_title=profile.getAttribute('title'),
- identifier=tr.getAttribute('id'),
+ profile_title=_truncate(profile.getAttribute('title'), 120),
+ identifier=_truncate(tr.getAttribute('id'), 120),
start_time=start_time.replace('T',' '),
end_time=tr.getAttribute('end-time').replace('T', ' '),
errors=errors
)
h = rhnSQL.prepare(_query_get_tresult)
h.execute(server_id=server_id, action_id=action_id)
- _process_ruleresults(h.fetchone()[0], tr)
+ testresult_id = h.fetchone()[0]
+ if not _process_ruleresults(testresult_id, tr):
+ h = rhnSQL.prepare(_query_update_errors, blob_map={'errors': 'errors'})
+ h.execute(testresult_id=testresult_id,
+ errors=errors +
+ '\nSome text strings were truncated when saving to the database.')
+
+truncated = False
def _process_ruleresults(testresult_id, tr):
+ global truncated
+ truncated = False
inserts = {'rr_id': [], 'system': [], 'ident': []}
for result in tr.childNodes:
for rr in result.childNodes:
@@ -75,12 +84,20 @@ def _process_ruleresults(testresult_id, tr):
inserts['rr_id'].append(rr_id)
inserts['system'].append('#IDREF#')
- inserts['ident'].append(rr.getAttribute('id'))
+ inserts['ident'].append(_truncate(rr.getAttribute('id'), 100))
for ident in rr.childNodes:
inserts['rr_id'].append(rr_id)
- inserts['system'].append(ident.getAttribute('system'))
- inserts['ident'].append(_get_text(ident))
+ inserts['system'].append(_truncate(ident.getAttribute('system'), 80))
+ inserts['ident'].append(_truncate(_get_text(ident), 100))
_store_idents(inserts)
+ return not truncated
+
+def _truncate(string, max_len):
+ global truncated
+ if len(string) > max_len:
+ truncated = True
+ return string[:max_len-3] + "..."
+ return string
def _create_rresult(testresult_id, result_label):
rr_id = rhnSQL.Sequence("rhn_xccdf_rresult_id_seq")()
@@ -163,3 +180,10 @@ values (
lookup_xccdf_ident(:system, :ident)
)
""")
+
+_query_update_errors = rhnSQL.Statement("""
+update rhnXccdfTestresult
+set errors = :errors
+where id = :testresult_id
+""")
+
12 years, 1 month
Changes to 'refs/tags/spacewalk-schema-1.8.12-1'
by Šimon Lukašík
Tag 'spacewalk-schema-1.8.12-1' created by Simon Lukasik <slukasik(a)redhat.com> at 2012-03-29 12:51 +0000
Tagging package [spacewalk-schema] version [1.8.12-1] in directory [schema/spacewalk/].
Changes since spacewalk-java-1.8.30-1:
Simon Lukasik (2):
Fix SHA1 of oracle sources.
Automatic commit of package [spacewalk-schema] release [1.8.12-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql | 2 +-
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql | 2 +-
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql | 2 +-
5 files changed, 8 insertions(+), 5 deletions(-)
---
12 years, 1 month
rel-eng/packages schema/spacewalk
by Šimon Lukašík
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit f7e4f29447c1e838c1d1dbb30a1c764df63f22df
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Mar 29 14:51:10 2012 +0200
Automatic commit of package [spacewalk-schema] release [1.8.12-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 19a8672..3541ba2 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.8.11-1 schema/spacewalk/
+1.8.12-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 765b0a37..8608b5f 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: 1.8.11
+Version: 1.8.12
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -69,6 +69,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Thu Mar 29 2012 Simon Lukasik <slukasik(a)redhat.com> 1.8.12-1
+- Fix SHA1 of oracle sources. (slukasik(a)redhat.com)
+
* Thu Mar 29 2012 Simon Lukasik <slukasik(a)redhat.com> 1.8.11-1
- Schema upgrade for the new rule/ident mapping. (slukasik(a)redhat.com)
- We want to store all idents per rule-result (slukasik(a)redhat.com)
12 years, 1 month
schema/spacewalk
by Šimon Lukašík
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql | 2 +-
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql | 2 +-
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 3d4cdcf66535536fb76ac895022add84fda81d68
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Mar 29 14:49:53 2012 +0200
Fix SHA1 of oracle sources.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql
index e9958cc..07058f0 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/016-rhnXccdfIdent.sql.postgresql
@@ -1,3 +1,3 @@
--- oracle equivalent source sha1 cc5737c136de9cb3648c3ab699622a119ea64062
+-- oracle equivalent source sha1 5c4448dbe75297d0c870484f33ab179f1f2f8280
ALTER TABLE rhnXccdfIdent ALTER COLUMN identifier TYPE VARCHAR(100);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql
index 837224a..bc3f915 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/017-rhnXccdfRuleresult.sql.postgresql
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 67a0e927a201e784309501fcfd29f633d6d50bea
+-- oracle equivalent source sha1 08bbc1262e0794cb1714eb2c55d674c4b0e613b0
ALTER TABLE rhnXccdfRuleresult ADD id NUMERIC;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql
index 6cd3367..04ecfe4 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/018-rhnXccdfRuleIdentMap.sql.postgresql
@@ -1,4 +1,4 @@
--- oracle equivalent source sha1 086e3135accd03bd79f2656d7e657af6d6b1b81f
+-- oracle equivalent source sha1 fb7dcca51b20b0109694ce8fefa8d51a25aaaaa2
CREATE TABLE rhnXccdfRuleIdentMap
(
12 years, 1 month
Changes to 'refs/tags/spacewalk-java-1.8.30-1'
by Šimon Lukašík
Tag 'spacewalk-java-1.8.30-1' created by Simon Lukasik <slukasik(a)redhat.com> at 2012-03-29 11:53 +0000
Tagging package [spacewalk-java] version [1.8.30-1] in directory [java/].
Changes since spacewalk-backend-1.8.8-1:
Simon Lukasik (1):
Automatic commit of package [spacewalk-java] release [1.8.30-1].
---
java/spacewalk-java.spec | 6 +++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
12 years, 1 month