Douglas Schilling Landgraf has uploaded a new change for review. Change subject: engine_page: Add validation for engine_data ......................................................................
engine_page: Add validation for engine_data Avoid engine_data getting non valid data. Change-Id: I75b9c20ab4bed89509da569ee6e3de0bf4c8779f Signed-off-by: Douglas Schilling Landgraf <dougsl...@redhat.com> --- M src/engine_page.py 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node-plugin-vdsm refs/changes/31/37331/1 diff --git a/src/engine_page.py b/src/engine_page.py index f9c9fdb..956a6c0 100644 --- a/src/engine_page.py +++ b/src/engine_page.py @@ -107,18 +107,23 @@ else: raise - if cfg["server"] is not None: + if cfg["server"] is not None and cfg["server"] != "None" and \ + cfg["server"] != "": server_url = [unicode(info) for info in [cfg["server"], cfg["port"]] if info] port, sslPort = compatiblePort(cfg["port"]) if sslPort: proto = "https" else: proto = "http" + engine_data = '"%s %s://%s"' % ( config.engine_name, proto, ":".join(server_url) ) + + if cfg['server'] == 'None' or cfg['server'] is None: cfg['server'] = "" + if cfg['port'] == 'None': cfg['port'] = "443" ag = augeas.Augeas() ag.set("/augeas/save/copy_if_rename_fails", "") @@ -128,7 +133,8 @@ cfg["server"]) ag.set("/files/etc/default/ovirt/OVIRT_MANAGEMENT_PORT", "\"%s\"" % cfg["port"]) - if engine_data is not None: + + if engine_data is not None and engine_data != "": ag.set("/files/etc/default/ovirt/MANAGED_BY", engine_data.encode('utf-8')) ag.save() -- To view, visit http://gerrit.ovirt.org/37331 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I75b9c20ab4bed89509da569ee6e3de0bf4c8779f Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node-plugin-vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Douglas Schilling Landgraf <dougsl...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches