[node-patches] Change in ovirt-node[master]: validate that rhn profile name is at least 3 characters

mburns at redhat.com mburns at redhat.com
Thu Nov 15 11:53:08 UTC 2012


Michael Burns has uploaded a new change for review.

Change subject: validate that rhn profile name is at least 3 characters
......................................................................

validate that rhn profile name is at least 3 characters

Also, allow blank profile name

rhbz#876899

Change-Id: I222a7f79ca37f49835174989468783e49f7611ed
Signed-off-by: Mike Burns <mburns at redhat.com>
---
M scripts/rhn.py
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/64/9264/1

diff --git a/scripts/rhn.py b/scripts/rhn.py
index 2dd1932..2ef78e0 100755
--- a/scripts/rhn.py
+++ b/scripts/rhn.py
@@ -450,6 +450,7 @@
         elements.setField(login_grid, 0, 4, anchorLeft=1)
         profile_grid = Grid(2, 2)
         self.profilename = Entry(30, "")
+        self.profilename.setCallback(self.profilename_callback)
         profile_grid.setField(Label("Profile Name (optional): "), 0, 0,
                                     anchorLeft=1)
         profile_grid.setField(self.profilename, 1, 0, anchorLeft=1)
@@ -627,6 +628,21 @@
             self.ncs.reset_screen_colors()
             return False
 
+    def profilename_callback(self):
+        if self.profilename.value() is None:
+            return True
+        length = len(self.profilename.value())
+        if (length > 0 and length < 3):
+            self.ncs._create_warn_screen()
+            self.ncs.screen.setColor("BUTTON", "black", "red")
+            self.ncs.screen.setColor("ACTBUTTON", "blue", "white")
+            ButtonChoiceWindow(self.ncs.screen, "Configuration Check",
+                               "RHN Profile Name must be at least 3 characters",
+                               buttons=['Ok'])
+            self.ncs.reset_screen_colors()
+            self.ncs.gridform.draw()
+            self.ncs._set_title()
+
     def rhn_url_callback(self):
         # TODO URL validation
         if not is_valid_url(self.rhn_url.value()):


--
To view, visit http://gerrit.ovirt.org/9264
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I222a7f79ca37f49835174989468783e49f7611ed
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Michael Burns <mburns at redhat.com>



More information about the node-patches mailing list