Sandro Bonazzola has uploaded a new change for review.

Change subject: config: added backward compatibilty
......................................................................

config: added backward compatibilty

Added backward compatibility supporting upgrade from
3.1 version which used the keyword rhevm instead of engine.
When reading configurarion files, the user will be warned
that there is a deprecated key that needs to be updated.

(cherry-picked with modifications from commit
7a0f6902576b1f71aa844f592c03d0514976f841)

Change-Id: I6755c1ad020ee3220aa5f5335c6d66ead5139e57
Bug-Url: https://bugzilla.redhat.com/975416
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M src/__main__.py
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-iso-uploader 
refs/changes/39/15839/1

diff --git a/src/__main__.py b/src/__main__.py
index cc35457..a27af14 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -243,6 +243,25 @@
         cp = ConfigParser.ConfigParser()
         cp.read(filename)
 
+        #backward compatibility with existing setup
+        if cp.has_option('ISOUploader', 'rhevm'):
+            if not cp.has_option('ISOUploader', 'engine'):
+                cp.set(
+                    'ISOUploader',
+                    'engine',
+                    cp.get('ISOUploader', 'rhevm')
+                )
+                logging.warning(
+                    _(
+                        'A deprecated configuration key has been found. '
+                        'Please replace the deprecated key, \'rhevm\', '
+                        'with the new one \'engine\' in {configFiles}'
+                    ).format(
+                        configFiles=filename
+                    )
+                )
+            cp.remove_option('ISOUploader', 'rhevm')
+
         # we want the items from the ISOUploader section only
         try:
             opts = [


-- 
To view, visit http://gerrit.ovirt.org/15839
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6755c1ad020ee3220aa5f5335c6d66ead5139e57
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-iso-uploader
Gerrit-Branch: ovirt-iso-uploader-3.2
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to