[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Spacewalk-devel] spacecmd - new function custominfo_updateykey patch



Hi Devel-List,

I've updated the spacecmd "custominfo.py" script, to add a new function "update the custominfo keys".
Can you review and add the attached patch, if it looks fine.

Cheers,
Gregor Gruener
>From e94c6c7db95cb180d22b52ce13bf03af3116b0b5 Mon Sep 17 00:00:00 2001
From: Gregor Gruener <ggruner redhat com>
Date: Mon, 22 Jul 2013 17:17:28 +0200
Subject: [PATCH] add new function custominfo_updatekey

---
 spacecmd/spacecmd.spec         |  5 ++++-
 spacecmd/src/lib/custominfo.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 2ec0c3a..f27dd06 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
 %endif
 
 Name:        spacecmd
-Version:     2.1.0
+Version:     2.0.3
 Release:     1%{?dist}
 Summary:     Command-line interface to Spacewalk and Satellite servers
 
@@ -64,6 +64,9 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
 %doc %{_mandir}/man1/spacecmd.1.gz
 
 %changelog
+* Mon Jul 22 2013 Gregor Gruener <ggruner redhat com> 2.0.3-1
+- add new function custominfo_updatekey
+
 * Thu Jul 18 2013 Miroslav Suchý <msuchy redhat com> 2.0.2-1
 - 985530 - require python and python-simplejson
 
diff --git a/spacecmd/src/lib/custominfo.py b/spacecmd/src/lib/custominfo.py
index 4db33b3..3a6ea31 100644
--- a/spacecmd/src/lib/custominfo.py
+++ b/spacecmd/src/lib/custominfo.py
@@ -139,4 +139,32 @@ def do_custominfo_details(self, args):
         print 'Modified:     %s' % details.get('last_modified')
         print 'System Count: %i' % details.get('system_count')
 
+####################
+
+def help_custominfo_updatekey(self):
+    print 'custominfo_updatekey: Update a custom key'
+    print 'usage: custominfo_updatekey [NAME] [DESCRIPTION]'
+
+def do_custominfo_updatekey(self, args):
+    (args, options) = parse_arguments(args)
+
+    if len(args) > 0:
+        key = args[0]
+    else:
+        key = ''
+
+    while key == '':
+        key = prompt_user('Name:')
+
+    if len(args) > 1:
+        description = ' '.join(args[1:])
+    else:
+        description = prompt_user('Description:')
+        if description == '':
+            description = key
+
+    self.client.system.custominfo.updateKey(self.session,
+                                            key,
+                                            description)
+
 # vim:ts=4:expandtab:
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]