def load(self): self._load_collection_manifest() self._rename_extract_path() self._check_filename_matches_manifest() self._check_metadata_filepaths() self.doc_strings = {} if self.cfg.run_ansible_doc: self.doc_strings = loaders.DocStringLoader( path=self.path, fq_collection_name='{}.{}'.format(self.metadata.namespace, self.metadata.name), logger=self.log, ).load() self.content_objs = list(self._load_contents()) self.contents = self._build_contents_blob() self.docs_blob = self._build_docs_blob() return schema.ImportResult( metadata=self.metadata, docs_blob=self.docs_blob, contents=self.contents, )
def import_collection(filepath, logger=None): logger = logger or default_logger try: return _import_collection(filepath, logger) except Exception as exc: import_result = schema.ImportResult( result=RESULT_FAILED, error=str(exc), ) return attr.asdict(import_result)
def load(self): self._load_collection_manifest() self._check_filename_matches_manifest() self.content_objs = list(self._load_contents()) self.contents = self._build_contents_blob() self.docs_blob = self._build_docs_blob() return schema.ImportResult( metadata=self.metadata, docs_blob=self.docs_blob, contents=self.contents, )
def load(self): self._load_collection_manifest() # TODO(awcrosby): add filename check when worker can pass filename with # collection details instead of filename made of hash string self._load_contents() import_result = schema.ImportResult( metadata=self.metadata, docs_blob=self.docs_blob, contents=self.contents, result=RESULT_COMPLETED, error=None, ) return attr.asdict(import_result)
def load(self): # NOTE: If we knew the chksum for MANIFEST.json, we could check it here first self.manifest = self._load_manifest() self.metadata = self.manifest.collection_info # The default name for 'file_manifest_file' is FILES.json self.file_manifest_file = self.manifest.file_manifest_file # load data from FILES.json self.file_manifest = self._load_file_manifest( path_prefix=self.path, file_manifest_file=self.file_manifest_file) # check chksum for each file in FILES.json # Note: Will raise exceptions on file_manifest / FILES.json errors self._check_file_manifest(self.path, self.file_manifest, self.file_manifest_file.name) self._rename_extract_path() self._check_filename_matches_manifest() self._check_metadata_filepaths() self.doc_strings = {} if self.cfg.run_ansible_doc: self.doc_strings = loaders.DocStringLoader( path=self.path, fq_collection_name="{}.{}".format(self.metadata.namespace, self.metadata.name), logger=self.log, cfg=self.cfg, ).load() self.content_objs = list(self._load_contents()) self.contents = self._build_contents_blob() self.docs_blob = self._build_docs_blob() self.requires_ansible = loaders.RuntimeFileLoader( self.path).get_requires_ansible() self._check_ansible_test_ignore_files() self._check_ee_yml_dep_files() return schema.ImportResult( metadata=self.metadata, docs_blob=self.docs_blob, contents=self.contents, requires_ansible=self.requires_ansible, )