]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Fixing error output in lib/cr_tf/handler.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 5 Nov 2019 16:01:44 +0000 (17:01 +0100)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 5 Nov 2019 16:01:44 +0000 (17:01 +0100)
lib/cr_tf/handler.py

index 8e3fbb23db9d36c20999592e3eb1f82d83af6f2c..1989f01d4bf6b2a22e0ef4037405efbc006dc5d0 100644 (file)
@@ -61,7 +61,7 @@ from .terraform.disk import TerraformDisk
 
 from .xlate import XLATOR
 
-__version__ = '3.0.3'
+__version__ = '3.0.4'
 LOG = logging.getLogger(__name__)
 
 _ = XLATOR.gettext
@@ -619,12 +619,17 @@ class CreateTerraformHandler(BaseHandler):
             if vname not in found_vspheres:
                 found_vspheres.append(vname)
         if len(found_vspheres) > 1:
+            yaml_file_rel = os.path.relpath(str(yaml_file), os.getcwd())
             msg = _(
                 "There is only one, unique VSPhere definition allowed in a project file. "
                 "In {f!r} were found {nr} different VSPhere definitions:").format(
-                f=yaml_file, nr=len(found_vspheres))
+                f=yaml_file_rel, nr=len(found_vspheres))
             msg += '\n'
+            first_one = True
             for vname in sorted(found_vspheres, key=str.lower):
+                if not first_one:
+                    msg += '\n'
+                first_one = False
                 msg += ' * {!r}'.format(vname)
             raise ExpectedHandlerError(msg)