Validation will fail by default if not using SOL006 format
[osm/osmclient.git] / osmclient / common / package_tool.py
index 7229565..1457e79 100644 (file)
@@ -86,7 +86,7 @@ class PackageTool(object):
             self.create_files(structure["files"], output, package_type)
         return "Created"
 
-    def validate(self, base_directory, recursive=True):
+    def validate(self, base_directory, recursive=True, old_format=False):
         """
             **Validate OSM Descriptors given a path**
 
@@ -109,6 +109,12 @@ class PackageTool(object):
             desc_type = "-"
             try:
                 desc_type, descriptor_data = validation_im.yaml_validation(self, descriptor_data)
+                if not old_format:
+                    if ( desc_type=="vnfd" or desc_type=="nsd" ):
+                        print("OSM descriptor '{}' written in an unsupported format. Please update to ETSI SOL006 format".format(desc_path))
+                        print("Package validation skipped. It can still be done with 'osm package-validate --old'")
+                        print("Package build can still be done with 'osm package-build --skip-validation'")
+                        raise Exception("Not SOL006 format")
                 validation_im.pyangbind_validation(self, desc_type, descriptor_data)
                 table.append({"type": desc_type, "path": desc_path, "valid": "OK", "error": "-"})
             except Exception as e:
@@ -217,6 +223,7 @@ class PackageTool(object):
 
             :returns: cloud-init content
         """
+        self._logger.debug("")
         return "---\n#cloud-config"
 
     def create_files(self, files, file_content, package_type):