Skip to content

Commit

Permalink
Hacked up fix.
Browse files Browse the repository at this point in the history
No-Issue

Signed-off-by: James Tanner <[email protected]>
  • Loading branch information
jctanner committed Feb 1, 2024
1 parent d839396 commit 75727ab
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
51 changes: 47 additions & 4 deletions galaxy_importer/loaders/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,19 @@ def load(self):
logger=self.log,
cfg=self.cfg,
).load()
assert self.doc_strings['filter']['community.filters.to_years']
for key in self.doc_strings['filter']:
assert self.doc_strings['filter'][key], f"1. {key} missing doc strings"

self.content_objs = list(self._load_contents())

self.contents = self._build_contents_blob()

self.docs_blob = self._build_docs_blob()
# the res.docs_blob should have doc strings for all the filters ...
for bcontent in self.docs_blob.contents:
assert bcontent.doc_strings, f"2. {bcontent} missing doc strings"
# import epdb; epdb.st()

self.requires_ansible = file_parser.RuntimeFileParser(self.path).get_requires_ansible()
self._check_ee_yml_dep_files()
self._check_collection_changelog()
Expand All @@ -109,6 +117,18 @@ def load(self):
self._lint_collection()
self._check_ansible_test_ignore_files()

res = schema.ImportResult(
metadata=self.metadata,
docs_blob=self.docs_blob,
contents=self.contents,
requires_ansible=self.requires_ansible,
)

# the res.docs_blob should have doc strings for all the filters ...
for bcontent in res.docs_blob.contents:
assert bcontent.doc_strings, f"3. {bcontent} missing doc strings"
# import epdb; epdb.st()

return schema.ImportResult(
metadata=self.metadata,
docs_blob=self.docs_blob,
Expand Down Expand Up @@ -372,9 +392,6 @@ def _load_contents(self):
logger=self.log,
)
content_obj = loader.load()
#if content_name == 'to_years':
# import epdb; epdb.st()

yield content_obj

def _build_contents_blob(self):
Expand Down Expand Up @@ -402,6 +419,20 @@ def _build_docs_blob(self):
if not self.cfg.run_ansible_doc:
return docs_blob

'''
for _c in self.content_objs:
print(_c)
citem = schema.DocsBlobContentItem(
content_name=_c.name,
content_type=_c.content_type.value,
doc_strings=_c.doc_strings,
readme_file=_c.readme_file,
readme_html=_c.readme_html,
)
if not citem.doc_strings:
import epdb; epdb.st()
'''

contents = [
schema.DocsBlobContentItem(
content_name=c.name,
Expand All @@ -413,6 +444,18 @@ def _build_docs_blob(self):
for c in self.content_objs
]

'''
for _content in contents:
if not _content.doc_strings:
matches = [x for x in self.content_objs if x.content_name==_content.content_name]
import epdb; epdb.st()
assert _content.doc_strings, f'{_content} missing doc strings'
import epdb; epdb.st()
'''

readme = markup_utils.get_readme_doc_file(self.path)
if not readme:
raise exc.ImporterError("No collection readme found")
Expand Down
11 changes: 9 additions & 2 deletions galaxy_importer/loaders/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def _validate_name(self):
)

def _log_loading(self):
self.log.info(f"Loading {self.content_type.value} {self.path_name}")
if self.path_name == self.content_name:
self.log.info(f"Loading {self.content_type.value} {self.path_name}")
return
self.log.info(f"Loading {self.content_type.value} {self.path_name}:{self.content_name}")


class PluginLoader(ContentLoader):
Expand All @@ -132,10 +135,14 @@ def load(self):

def _get_plugin_doc_strings(self):
"""Return plugin doc_strings, if exists, from collection doc_strings."""
fq_name = self._get_fq_name(self.root, self.path_name)
if self.content_name == self.path_name:
fq_name = self._get_fq_name(self.root, self.path_name)
else:
fq_name = self._get_fq_name(self.root, self.content_name)
try:
return self.doc_strings[self.content_type.value][fq_name]
except KeyError:
import epdb; epdb.st()
return None

def _run_flake8(self, path):
Expand Down

0 comments on commit 75727ab

Please sign in to comment.