[node-patches] Change in ovirt-node[master]: kdump: Fix transaction
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Wed Feb 6 15:41:49 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: kdump: Fix transaction
......................................................................
kdump: Fix transaction
Previously the transaction failed because of old backup files, this is
now fixed because old backup files are irgnored.
Change-Id: Id9740f124c5fbceedd9ddf97c55c43a1c43462f9
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/config/defaults.py
M scripts/tui/src/ovirt/node/utils/console.py
M scripts/tui/src/ovirt/node/utils/fs.py
3 files changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/12/11812/1
diff --git a/scripts/tui/src/ovirt/node/config/defaults.py b/scripts/tui/src/ovirt/node/config/defaults.py
index a0fbf66..2bcddb3 100644
--- a/scripts/tui/src/ovirt/node/config/defaults.py
+++ b/scripts/tui/src/ovirt/node/config/defaults.py
@@ -718,9 +718,10 @@
def __init__(self):
self.backups = utils.fs.BackupedFiles(["/etc/kdump.conf"])
+ super(BackupKdumpConfig, self).__init__()
def commit(self):
- self.backups.create()
+ self.backups.create(ignore_existing=True)
class RestoreKdumpConfig(utils.Transaction.Element):
title = "Restoring default kdump config"
@@ -767,6 +768,7 @@
def __init__(self, backups):
self.backups = backups
+ super(RemoveKdumpConfig, self).__init__()
def commit(self):
from ovirtnode.ovirtfunctions import remove_config
@@ -782,6 +784,7 @@
def __init__(self, backups):
self.backups = backups
+ super(RestartKdumpService, self).__init__()
def commit(self):
from ovirtnode.ovirtfunctions import unmount_config, \
diff --git a/scripts/tui/src/ovirt/node/utils/console.py b/scripts/tui/src/ovirt/node/utils/console.py
index 6ea57bc..07a68e5 100644
--- a/scripts/tui/src/ovirt/node/utils/console.py
+++ b/scripts/tui/src/ovirt/node/utils/console.py
@@ -71,6 +71,7 @@
self.__print_title()
self.logger.debug("Preparing transaction for console %s" %
self.transaction)
+ self.add_update("Checking pre-conditions ...")
self.transaction.prepare() # Just to display something in dry mode
for idx, e in enumerate(self.transaction):
txt = "(%s/%s) %s" % (idx + 1, len(self.transaction), e.title)
@@ -78,7 +79,7 @@
self.plugin.dry_or(lambda: e.commit())
self.add_update("\nAll changes were applied successfully.")
except Exception as e:
- self.add_update(("\nAn error occurred while applying the changes:")
+ self.add_update(("\nAn error occurred while applying the changes:"))
self.add_update("%s" % e)
self.logger.warning("'%s' on transaction '%s': %s - %s" %
(type(e), self.transaction, e, e.message))
diff --git a/scripts/tui/src/ovirt/node/utils/fs.py b/scripts/tui/src/ovirt/node/utils/fs.py
index 2415fff..8dcbbaf 100644
--- a/scripts/tui/src/ovirt/node/utils/fs.py
+++ b/scripts/tui/src/ovirt/node/utils/fs.py
@@ -120,12 +120,12 @@
"""
self.remove()
- def create(self):
+ def create(self, ignore_existing=False):
"""Create a backup of all files
"""
for fn in self.files:
backup = "%s%s" % (fn, self.suffix)
- if os.path.exists(backup):
+ if not ignore_existing and os.path.exists(backup):
raise RuntimeError(("Backup '%s' for '%s " +
"already exists") % (backup, fn))
if os.path.exists(fn):
--
To view, visit http://gerrit.ovirt.org/11812
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9740f124c5fbceedd9ddf97c55c43a1c43462f9
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