Simone Tiraboschi has uploaded a new change for review.

Change subject: packaging: setup: handling exception from uuid validation
......................................................................

packaging: setup: handling exception from uuid validation

Better handling of exception from UUID validation
to provide an easier to read and more consistent error.

Change-Id: I505a4f01d41c218a572f6e42682b57875712f1c0
Bug-Url: https://bugzilla.redhat.com/1125834
Signed-off-by: Simone Tiraboschi <[email protected]>
(cherry picked from commit 459baeb373206cb8b04458993ed18792a9d44488)
---
M packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/iso_domain.py
1 file changed, 19 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/60/31660/1

diff --git 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/iso_domain.py 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/iso_domain.py
index 397d921..2d688a8 100644
--- 
a/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/iso_domain.py
+++ 
b/packaging/setup/plugins/ovirt-engine-setup/ovirt-engine/config/iso_domain.py
@@ -102,18 +102,30 @@
             if directory_content:
                 if len(directory_content) == 1:
                     entry = directory_content[0]
-                    if(
-                        os.path.isdir(os.path.join(path, entry)) and
-                        uuid.UUID(entry).version == 4
-                    ):
-                        self.logger.debug('Using existing uuid for ISO domain')
-                        sd_uuid = entry
-                    else:
+                    try:
+                        if(
+                            os.path.isdir(os.path.join(path, entry)) and
+                            uuid.UUID(entry).version == 4
+                        ):
+                            self.logger.debug(
+                                'Using existing uuid for ISO domain'
+                            )
+                            sd_uuid = entry
+                        else:
+                            raise RuntimeError(
+                                _(
+                                    'Error: directory {path} is not empty'
+                                ).format(
+                                    path=path,
+                                )
+                            )
+                    except ValueError:
                         raise RuntimeError(
                             _('Error: directory {path} is not empty').format(
                                 path=path,
                             )
                         )
+
                 else:
                     raise RuntimeError(
                         _('Error: directory {path} is not empty').format(


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I505a4f01d41c218a572f6e42682b57875712f1c0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Simone Tiraboschi <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to