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 6ec3569d32d9b187f10cfa47e022d5d980432465) Change-Id: Ic522c278157022b54d449bd4b0d73f9b9a2ce73d Bug-Url: https://bugzilla.redhat.com/975417 Signed-off-by: Sandro Bonazzola <sbona...@redhat.com> --- M src/__main__.py 1 file changed, 19 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-image-uploader refs/changes/40/15840/1 diff --git a/src/__main__.py b/src/__main__.py index 3750346..b4d4354 100644 --- a/src/__main__.py +++ b/src/__main__.py @@ -106,7 +106,6 @@ raise Exception(stderr) - class Configuration(dict): """This class is a dictionary subclass that knows how to read and """ """handle our configuration. Resolution order is defaults -> """ @@ -203,6 +202,25 @@ cp = ConfigParser.ConfigParser() cp.read(filename) + #backward compatibility with existing setup + if cp.has_option('ImageUploader', 'rhevm'): + if not cp.has_option('ImageUploader', 'engine'): + cp.set( + 'ImageUploader', + 'engine', + cp.get('ImageUploader', '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('ImageUploader', 'rhevm') + # we want the items from the ImageUploader section only try: opts = ["--%s=%s" % (k,v) -- To view, visit http://gerrit.ovirt.org/15840 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic522c278157022b54d449bd4b0d73f9b9a2ce73d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-image-uploader Gerrit-Branch: ovirt-image-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