[node-patches] Change in ovirt-node[master]: plugins: Add NodePlugin.dry_or()
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Tue Dec 11 20:09:41 UTC 2012
Fabian Deutsch has uploaded a new change for review.
Change subject: plugins: Add NodePlugin.dry_or()
......................................................................
plugins: Add NodePlugin.dry_or()
Change-Id: I1dc4ea3c0ed2e86b7bb442bfc27ff523d800824b
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/plugins.py
M scripts/tui/src/ovirt/node/setup/logging_page.py
M scripts/tui/src/ovirt/node/setup/network_page.py
3 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/50/9950/1
diff --git a/scripts/tui/src/ovirt/node/plugins.py b/scripts/tui/src/ovirt/node/plugins.py
index 66e949e..fdaed68 100644
--- a/scripts/tui/src/ovirt/node/plugins.py
+++ b/scripts/tui/src/ovirt/node/plugins.py
@@ -286,6 +286,12 @@
self.logger.debug("No effective changes detected.")
return effective_changes if len(effective_changes) > 0 else None
+ def dry_or(self, func):
+ if self.application.args.dry:
+ self.logger.info("Running dry, otherwise: %s" % func)
+ else:
+ func()
+
class ChangesHelper(base.Base):
def __init__(self, changes):
diff --git a/scripts/tui/src/ovirt/node/setup/logging_page.py b/scripts/tui/src/ovirt/node/setup/logging_page.py
index 4711862..f9478d8 100644
--- a/scripts/tui/src/ovirt/node/setup/logging_page.py
+++ b/scripts/tui/src/ovirt/node/setup/logging_page.py
@@ -132,5 +132,5 @@
model.update(*effective_model.get_key_values(netconsole_keys))
txs += model.transaction()
- txs.prepare()
- # txs()
+ txs.prepare() # Just to display something in dry mode
+ self.dry_or(lambda: txs())
diff --git a/scripts/tui/src/ovirt/node/setup/network_page.py b/scripts/tui/src/ovirt/node/setup/network_page.py
index 967950b..4bfe888 100644
--- a/scripts/tui/src/ovirt/node/setup/network_page.py
+++ b/scripts/tui/src/ovirt/node/setup/network_page.py
@@ -306,14 +306,11 @@
txs += self._configure_nic(*args)
# Commit all outstanding transactions
- txs.prepare()
+ txs.prepare() # Just to display something in dry mode
for idx, e in enumerate(txs):
n = "(%s/%s) " % (idx + 1, len(txs))
set_progress(n + e.title)
- if self.application.args.dry:
- self.logger.info("Not committing changes, dry-mode")
- else:
- e.commit()
+ self.dry_or(lambda: e.commit())
set_progress("All changes were applied.")
time.sleep(3)
--
To view, visit http://gerrit.ovirt.org/9950
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1dc4ea3c0ed2e86b7bb442bfc27ff523d800824b
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