[node-patches] Change in ovirt-node[master]: Prevent rsyslog and netconsole configuration before networki...
rbarry at redhat.com
rbarry at redhat.com
Fri Feb 22 21:38:40 UTC 2013
Ryan Barry has uploaded a new change for review.
Change subject: Prevent rsyslog and netconsole configuration before networking. Add a Notice UI widget that prints red messages for above.
......................................................................
Prevent rsyslog and netconsole configuration before networking.
Add a Notice UI widget that prints red messages for above.
rhbz#846640
Change-Id: I53a264972a40e3f3ab80bb4c90c506622bb89444
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M scripts/tui/src/ovirt/node/setup/logging_page.py
M scripts/tui/src/ovirt/node/ui/__init__.py
M scripts/tui/src/ovirt/node/ui/urwid_builder.py
M scripts/tui/src/ovirt/node/ui/widgets.py
4 files changed, 43 insertions(+), 10 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/38/12338/1
diff --git a/scripts/tui/src/ovirt/node/setup/logging_page.py b/scripts/tui/src/ovirt/node/setup/logging_page.py
index 329a81d..df73668 100644
--- a/scripts/tui/src/ovirt/node/setup/logging_page.py
+++ b/scripts/tui/src/ovirt/node/setup/logging_page.py
@@ -64,21 +64,27 @@
}
def ui_content(self):
+
ws = [ui.Header("header[0]", "Logging"),
ui.Entry("logrotate.max_size", "Logrotate Max Log " +
"Size (KB):"),
- ui.Divider("divider[0]"),
- ui.Label("rsyslog.header", "RSyslog is an enhanced multi-" +
+ ui.Divider("divider[0]")
+ ]
+ if not self._network_configured():
+ ws.extend([ui.Notice("network.notice","Networking is not configured, " +
+ "please configure it before rsyslog and/or netconsole"),
+ ui.Divider("notice.divider")])
+ ws.extend([ui.Label("rsyslog.header", "RSyslog is an enhanced multi-" +
"threaded syslogd"),
- ui.Entry("rsyslog.address", "Server Address:"),
- ui.Entry("rsyslog.port", "Server Port:"),
- ui.Divider("divider[1]"),
- ui.Label("netconsole.label",
+ ui.Entry("rsyslog.address", "Server Address:",enabled=self._network_configured()),
+ ui.Entry("rsyslog.port", "Server Port:",enabled=self._network_configured()),
+ ui.Divider("divider[1]"),
+ ui.Label("netconsole.label",
"Netconsole service allows a remote sys" +
"log daemon to record printk() messages"),
- ui.Entry("netconsole.address", "Server Address:"),
- ui.Entry("netconsole.port", "Server Port:"),
- ]
+ ui.Entry("netconsole.address", "Server Address:",enabled=self._network_configured()),
+ ui.Entry("netconsole.port", "Server Port:",enabled=self._network_configured())
+ ])
page = ui.Page("page", ws)
self.widgets.add(page)
@@ -121,3 +127,7 @@
progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs, self)
progress_dialog.run()
+
+ def _network_configured(self):
+ return False
+ #return any(key["bootproto"] is not None for key in utils.network.node_nics().values())
diff --git a/scripts/tui/src/ovirt/node/ui/__init__.py b/scripts/tui/src/ovirt/node/ui/__init__.py
index be8dda6..37ab713 100644
--- a/scripts/tui/src/ovirt/node/ui/__init__.py
+++ b/scripts/tui/src/ovirt/node/ui/__init__.py
@@ -216,6 +216,10 @@
def value(self, txt=None):
return self.text(txt)
+
+class Notice(Label):
+ def __init__(self,path,text):
+ super(Notice, self).__init__(path, text)
class Header(Label):
@@ -677,6 +681,7 @@
PasswordEntry: self._build_passwordentry,
Header: self._build_header,
+ Notice: self._build_notice,
Button: self._build_button,
@@ -731,6 +736,9 @@
def _build_header(self, ui_header):
raise NotImplementedError
+
+ def _build_notice(self, ui_notice):
+ raise NotImplementedError
def _build_button(self, ui_button):
raise NotImplementedError
diff --git a/scripts/tui/src/ovirt/node/ui/urwid_builder.py b/scripts/tui/src/ovirt/node/ui/urwid_builder.py
index 7645409..c5f897f 100644
--- a/scripts/tui/src/ovirt/node/ui/urwid_builder.py
+++ b/scripts/tui/src/ovirt/node/ui/urwid_builder.py
@@ -64,6 +64,9 @@
elif type(ui_label) is ui.Header:
widget = uw.Header(ui_label.text(),
ui_label.template)
+ elif type(ui_label) is ui.Notice:
+ widget = uw.Notice(ui_label.text())
+
else:
widget = uw.Label(ui_label.text())
@@ -81,6 +84,9 @@
def _build_header(self, ui_header):
return self._build_label(ui_header)
+
+ def _build_notice(self, ui_notice):
+ return self._build_label(ui_notice)
def _build_button(self, ui_button):
widget = uw.Button(ui_button.text())
diff --git a/scripts/tui/src/ovirt/node/ui/widgets.py b/scripts/tui/src/ovirt/node/ui/widgets.py
index 82825f0..7a31e92 100644
--- a/scripts/tui/src/ovirt/node/ui/widgets.py
+++ b/scripts/tui/src/ovirt/node/ui/widgets.py
@@ -232,7 +232,15 @@
def set_text(self, txt):
self.text(txt)
-
+
+class Notice(Label):
+ """A read only widget for notices
+ """
+ _notice_attr = "plugin.widget.notice"
+
+ def __init__(self,text):
+ super(Notice, self).__init__(text)
+ self._label_attrmap.set_attr_map({None: self._notice_attr})
class Header(Label):
"""A read only widget representing a header
@@ -324,6 +332,7 @@
if not is_enabled:
edit_attr_map = {None: "plugin.widget.entry.disabled"}
linebox_attr_map = {None: "plugin.widget.entry.frame.disabled"}
+ self._label_attrmap.set_attr_map(edit_attr_map)
self._edit_attrmap.set_attr_map(edit_attr_map)
self._linebox_attrmap.set_attr_map(linebox_attr_map)
--
To view, visit http://gerrit.ovirt.org/12338
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I53a264972a40e3f3ab80bb4c90c506622bb89444
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list