Hi,

Just a small patch to spacecmd to add "-l/--label" option to 
configchannel_create command.

The current behavior of the command is to ask a "name" and set label and name 
to this value, but "label" is more restrictive than "name" (for labels, only 
alphanumeric characters, '-', '_', and '.' are allowed).
With this patch, the label must be provided, and name is set to label value if 
name is not provided.


Have a nice day.

Regards.

---
Baptiste AGASSE
Lyra Network, Service Systèmes et Réseaux
Rue Carmin, BP 87350, 31673 Labège Cedex - France
Tél: (+33)5.67.22.31.87
Fax: (+33)5.67.22.31.61
Mail: baptiste.aga...@lyra-network.com
Site: http://www.lyra-network.com

From 0dc42df495c1745ce5c0d7a73e280a17d6a765b9 Mon Sep 17 00:00:00 2001
From: Baptiste <baptiste.aga...@lyra-network.com>
Date: Tue, 16 Apr 2013 17:29:31 +0200
Subject: [PATCH] Change spacecmd configchannel_create behavior to reflect
 webui.

---
 spacecmd/src/lib/configchannel.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/spacecmd/src/lib/configchannel.py b/spacecmd/src/lib/configchannel.py
index 3aeefff..5a0cb3d 100644
--- a/spacecmd/src/lib/configchannel.py
+++ b/spacecmd/src/lib/configchannel.py
@@ -322,29 +322,36 @@ def help_configchannel_create(self):
 
 options:
   -n NAME
+  -l LABEL
   -d DESCRIPTION'''
 
 def do_configchannel_create(self, args):
     options = [ Option('-n', '--name', action='store'),
+                Option('-l', '--label', action='store'),
                 Option('-d', '--description', action='store') ]
 
     (args, options) = parse_arguments(args, options)
 
     if is_interactive(options):
-        options.name = prompt_user('Name:', noblank = True)
+        options.name = prompt_user('Name:')
+        options.label = prompt_user('Label:', noblank = True)
         options.description = prompt_user('Description:')
 
+        if options.name == '': options.name = options.label
         if options.description == '': options.description = options.name
     else:
-        if not options.name:
-            logging.error('A name is required')
+        if not options.label:
+            logging.error('A label is required')
             return
 
+        if not options.name:
+            options.name = options.label
+
         if not options.description:
             options.description = options.name
 
     self.client.configchannel.create(self.session,
-                                     options.name,
+                                     options.label,
                                      options.name,
                                      options.description)
 
-- 
1.8.1.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to