client/tools/rhncustominfo/rhn-custom-info.py | 25 +++++++++++++++++++----- client/tools/rhncustominfo/rhn-custom-info.spec | 5 +++- rel-eng/packages/rhn-custom-info | 2 - 3 files changed, 25 insertions(+), 7 deletions(-)
New commits: commit c111c4e94c642ec4dc14609497cf991674b6c0fb Author: Michael Mraka michael.mraka@redhat.com Date: Fri Nov 29 12:19:53 2013 +0100
Automatic commit of package [rhn-custom-info] release [5.4.21-1].
diff --git a/client/tools/rhncustominfo/rhn-custom-info.spec b/client/tools/rhncustominfo/rhn-custom-info.spec index 4891bb9..c991fa0 100644 --- a/client/tools/rhncustominfo/rhn-custom-info.spec +++ b/client/tools/rhncustominfo/rhn-custom-info.spec @@ -4,7 +4,7 @@ Group: Applications/System License: GPLv2 Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... URL: https://fedorahosted.org/spacewalk -Version: 5.4.20 +Version: 5.4.21 Release: 1%{?dist} BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildArch: noarch @@ -52,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man8/rhn-custom-info.*
%changelog +* Fri Nov 29 2013 Michael Mraka michael.mraka@redhat.com 5.4.21-1 +- add the option -d to delete custom values + * Thu Oct 10 2013 Michael Mraka michael.mraka@redhat.com 5.4.20-1 - cleaning up old svn Ids
diff --git a/rel-eng/packages/rhn-custom-info b/rel-eng/packages/rhn-custom-info index 2dbedb5..7f56877 100644 --- a/rel-eng/packages/rhn-custom-info +++ b/rel-eng/packages/rhn-custom-info @@ -1 +1 @@ -5.4.20-1 client/tools/rhncustominfo/ +5.4.21-1 client/tools/rhncustominfo/
commit 4defa067792adca015dd6470d3b7e33ec0d31195 Author: Michael Mraka michael.mraka@redhat.com Date: Fri Nov 29 12:17:43 2013 +0100
add the option -d to delete custom values
contributed by Ulf mopp@gmx.net
diff --git a/client/tools/rhncustominfo/rhn-custom-info.py b/client/tools/rhncustominfo/rhn-custom-info.py index 6beb084..2f49c4d 100755 --- a/client/tools/rhncustominfo/rhn-custom-info.py +++ b/client/tools/rhncustominfo/rhn-custom-info.py @@ -121,6 +121,10 @@ def parse_args(): action="store", type="string", dest="url", help="use the rhn api at URL", metavar="URL")
+ parser.add_option("-d", "--delete-values", + action="store_true", dest="delete_values", default=0, + help="delete one or multiple custom keys from the system") + parser.add_option("-l", "--list-values", action="store_true", dest="list_values", default=0, help="list the custom keys and values for the system", @@ -141,12 +145,15 @@ def verify_command_line(): if not options.password: options.password = getpass.getpass()
- if not (num_args % 2 == 0) and not options.list_values: + if not (num_args % 2 == 0) and not options.list_values and not options.delete_values: system_exit(1, "Odd number of arguments; you must provide key/value pairs")
- if not args and not options.list_values: + if not args and not options.list_values and not options.delete_values: system_exit(1, "You must provide key/value pairs to store")
+ if not args and options.delete_values: + system_exit(1, "You must provide a key to delete") + return (options, args, num_args)
@@ -174,11 +181,17 @@ def main(): (options, args, num_args) = verify_command_line()
values = {} + valuesdel = []
i = 0 - while (i < num_args): - values[args[i]] = args[i+1] - i = i + 2 + if not options.delete_values: + while (i < num_args): + values[args[i]] = args[i+1] + i = i + 2 + else: + while (i < num_args): + valuesdel.insert(i, args[i]) + i = i + 1
url = None if options.url: @@ -198,6 +211,8 @@ def main():
if options.list_values: ret = s.system.get_custom_values(session, int(sid)) + elif options.delete_values: + ret = s.system.delete_custom_values(session, int(sid), valuesdel) else: ret = s.system.set_custom_values(session, int(sid), values)
spacewalk-commits@lists.fedorahosted.org