+class PackageConstructValidator(object):
+
+ def __init__(self, log):
+ self._log = log
+
+ def validate(self, package):
+ """ Validate presence of descriptor file (.yaml) at the top level in the
+ package folder structure.
+
+ Arguments:
+ package - The Descriptor Package being validated.
+ Returns:
+ None
+ Raises:
+ PackageValidationError - The package validation failed for some
+ generic reason.
+ """
+ pass
+ desc_file = package.descriptor_file
+ prefix, desc_file = package.prefix.rstrip('/'), desc_file.rstrip('/')
+
+ if os.path.dirname(desc_file) != prefix:
+ msg = "Descriptor file {} not found in expcted location {}".format(desc_file, prefix)
+ self._log.error(msg)
+ raise PackageValidationError(msg)
+