[node-patches] Change in ovirt-node[master]: ui: Fix kdump page type initialization
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue Jul 9 15:04:47 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: ui: Fix kdump page type initialization
......................................................................
ui: Fix kdump page type initialization
Previously the available kdump target types were initialized during
class creation, this broke doctests and it wouldn't work at runtime,
because the network status can change between page views, and the class
is only instantiated once at application start.
Now the network status is checked on each page view.
Change-Id: I331e27b03e4df5817a318e571a80ad504a0dff4a
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M src/ovirt/node/setup/core/kdump_page.py
1 file changed, 21 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/33/16633/1
diff --git a/src/ovirt/node/setup/core/kdump_page.py b/src/ovirt/node/setup/core/kdump_page.py
index eb02743..ccba816 100644
--- a/src/ovirt/node/setup/core/kdump_page.py
+++ b/src/ovirt/node/setup/core/kdump_page.py
@@ -18,27 +18,25 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
-"""
-Configure KDump
-"""
-
from ovirt.node import utils, plugins, ui, valid
from ovirt.node.config import defaults
from ovirt.node.plugins import Changeset
from ovirt.node.utils import console
+from ovirt.node.utils.network import NodeNetwork
+"""
+Configure KDump
+"""
+
class Plugin(plugins.NodePlugin):
_model = None
- _types = [("disabled", "Disable"),
- ("local", "Local")]
-
- net_is_configured = utils.network.NodeNetwork().is_configured()
-
- if net_is_configured:
- _types.extend([("ssh", "SSH"),
- ("nfs", "NFS")])
+ _types_local = [("disabled", "Disable"),
+ ("local", "Local")]
+ _types_remote = [("ssh", "SSH"),
+ ("nfs", "NFS")]
+ _types = []
def name(self):
return "Kdump"
@@ -80,9 +78,18 @@
"""Describes the UI this plugin requires
This is an ordered list of (path, widget) tuples.
"""
+ # _types needs to be rebuild on every page view, as the network
+ # state can change between page views
+ # NodeNetwork relies on runtime information which is N/A in dev mode
+ if self.application.args.dry:
+ net_is_configured = True
+ else:
+ net_is_configured = NodeNetwork().is_configured()
+
ws = [ui.Header("kdump._header", "Configure Kdump")]
- if not self.net_is_configured:
+ if not net_is_configured:
+ self._types = self._types_local
ws.extend([ui.Notice("network.notice",
"Networking is not configured, " +
"please configure it before NFS " +
@@ -90,6 +97,7 @@
ui.Divider("notice.divider")])
else:
+ self._types = self._types_local + self._types_remote
ws.extend([ui.Options("kdump.type", "Type", self._types),
ui.Divider("divider[0]"),
ui.Entry("kdump.nfs_location", "NFS Location " +
--
To view, visit http://gerrit.ovirt.org/16633
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I331e27b03e4df5817a318e571a80ad504a0dff4a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list