[node-patches] Change in ovirt-node[master]: Give a warning when invalid characters are used in ping test

jboggs at redhat.com jboggs at redhat.com
Thu Oct 25 02:07:26 UTC 2012


Joey Boggs has uploaded a new change for review.

Change subject: Give a warning when invalid characters are used in ping test
......................................................................

Give a warning when invalid characters are used in ping test

rhbz#869516

Signed-off-by: Joey Boggs <jboggs at redhat.com>
Change-Id: Iec70af5b1e8d22d4e920d04fc1f7874fe3f77e34
---
M scripts/ovirt-config-setup.py
1 file changed, 14 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/99/8799/1

diff --git a/scripts/ovirt-config-setup.py b/scripts/ovirt-config-setup.py
index 4c3858e..c3943a2 100755
--- a/scripts/ovirt-config-setup.py
+++ b/scripts/ovirt-config-setup.py
@@ -2024,15 +2024,20 @@
                     ping_window = EntryWindow(self.screen, 'Network Ping Test', 'Enter Host to Ping', ['Host:'])
                     res = ping_window[1]
                     host = res[0]
-                    if len(host) > 0 and ping_window[0] == "ok":
-                        cmd = "ping -c 3 %s" % host
-                        gridform = GridForm(self.screen, "", 1, 1)
-                        gridform.add(Label("Performing Ping Test"), 0, 0)
-                        gridform.draw()
-                        self.screen.refresh()
-                        proc = passthrough(cmd, log_func=logger.debug)
-                        ButtonChoiceWindow(self.screen, "Ping Test Results",
-                               proc.stdout, buttons=["OK"], width = 60)
+                    if ping_window[0] == "ok":
+                        # scrub host variable
+                        if len(host) > 0 and " " not in host and ";" not in host:
+                            cmd = "ping -c 3 %s" % host
+                            gridform = GridForm(self.screen, "", 1, 1)
+                            gridform.add(Label("Performing Ping Test"), 0, 0)
+                            gridform.draw()
+                            self.screen.refresh()
+                            proc = passthrough(cmd, log_func=logger.debug)
+                            ButtonChoiceWindow(self.screen, "Ping Test Results",
+                                   proc.stdout, buttons=["OK"], width = 60)
+                        else:
+                            ButtonChoiceWindow(self.screen, "Ping Test Results",
+                                   "Invalid Hostname: %s" % host, buttons=["OK"], width = 60)
                 elif pressed == APPLY_BUTTON or pressed == UNLOCK_BUTTON:
                     errors = []
                     self.process_config()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec70af5b1e8d22d4e920d04fc1f7874fe3f77e34
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list