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.

Change-Id: I6755c1ad020ee3220aa5f5335c6d66ead5139e57
Bug-Url: https://bugzilla.redhat.com/975209
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/15/15815/1

diff --git a/src/__main__.py b/src/__main__.py
index 8c683ea..0179219 100644
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -258,6 +258,25 @@
         cp = ConfigParser.ConfigParser()
         cp.read(configs)
 
+        #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=', '.join(configs)
+                    )
+                )
+            cp.remove_option('ISOUploader', 'rhevm')
+
         # we want the items from the ISOUploader section only
         try:
             opts = [


-- 
To view, visit http://gerrit.ovirt.org/15815
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: master
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