Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
aireilly committed May 1, 2024
1 parent 55e7e4b commit d9bf418
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions build_for_portal.py
Expand Up @@ -23,7 +23,7 @@

cli.init_logging(False, True)

has_errors = False
list_of_errors = []
CLONE_DIR = "."
BASE_PORTAL_URL = "https://access.redhat.com/documentation/en-us/"
# ID_RE = re.compile("^\[(?:\[|id=\'|#)(.*?)(\'?,.*?)?(?:\]|\')?\]", re.M | re.DOTALL)
Expand Down Expand Up @@ -442,6 +442,7 @@ def reformat_for_drupal(info):

# Reformat the data
for book in books:

log.info("Processing %s", book["Dir"])
book_src_dir = os.path.join(src_dir, book["Dir"])

Expand All @@ -460,6 +461,7 @@ def reformat_for_drupal(info):
copy_images(book, src_dir, images_dir, distro)



def copy_images(node, src_path, dest_dir, distro):
"""
Copy images over to the destination directory and flatten all image directories into the one top level dir.
Expand Down Expand Up @@ -630,7 +632,7 @@ def scrub_file(info, book_src_dir, src_file, tag=None, cwd=None):
raise ConnectionError("Malformed URL")
except Exception as exception:
log.error("An include file wasn't found: %s", base_src_file)
has_errors = True
list_of_errors.append(f"An include file wasn't found: {base_src_file}")
sys.exit(-1)

# Get a list of predefined custom title ids for the file
Expand Down Expand Up @@ -732,7 +734,6 @@ def fix_links(content, info, book_src_dir, src_file, tag=None, cwd=None):
content = _fix_links(
content, book_src_dir, src_file, info, tag=tag, cwd=cwd
)

return content

def dir_to_book_name(dir,src_file,info):
Expand All @@ -742,11 +743,11 @@ def dir_to_book_name(dir,src_file,info):
return(book["Name"])
break

has_errors = True
log.error(
'ERROR (%s): book not found for the directory %s',
src_file,
dir)
list_of_errors.append(f"ERROR ({src_file}): book not found for the directory {dir}")
return(dir)


Expand Down Expand Up @@ -791,6 +792,7 @@ def _fix_links(content, book_dir, src_file, info, tag=None, cwd=None):
'ERROR (%s): link pointing outside source directory? %s',
src_file,
link_file)
list_of_errors.append(f'ERROR ({src_file}): link pointing outside source directory? {link_file}')
continue
split_relative_path = full_relative_path.split("/")
book_dir_name = split_relative_path[0]
Expand Down Expand Up @@ -823,13 +825,14 @@ def _fix_links(content, book_dir, src_file, info, tag=None, cwd=None):
fixed_link = link_text
if EXTERNAL_LINK_RE.search(link_file) is not None:
rel_src_file = src_file.replace(os.path.dirname(book_dir) + "/", "")
has_errors = True
link_text_message = link_text.replace("\n", "")
log.error(
'ERROR (%s): "%s" appears to try to reference a file not included in the "%s" distro',
rel_src_file,
link_text.replace("\n", ""),
link_text_message,
info["distro"],
)
list_of_errors.append(f'ERROR ({rel_src_file})): {link_text_message} appears to try to reference a file not included in the {info["distro"]} distro')
else:
fixed_link = "xref:" + link_anchor.replace("#", "") + link_title

Expand Down Expand Up @@ -1177,7 +1180,7 @@ def main():
# Copy the original data and reformat for drupal
reformat_for_drupal(info)

if has_errors:
if list_of_errors:
sys.exit(1)

if args.push:
Expand Down Expand Up @@ -1211,4 +1214,4 @@ def main():


if __name__ == "__main__":
main()
main()
Expand Up @@ -6,7 +6,7 @@
[id="cluster-logging-collector-log-forward-sts-cloudwatch_{context}"]
= Forwarding logs to Amazon CloudWatch from STS enabled clusters

For clusters with AWS Security Token Service (STS) enabled, you can create an AWS service account manually or create a credentials request by using the Cloud Credential Operator (CCO) utility `ccoctl`.
For clusters with AWS Security Token Service (STS) enabled, you can create an AWS service account manually or create a credentials request by using the xref:../../authentication/managing_cloud_provider_credentials/about-cloud-credential-operator.adoc[Cloud Credential Operator (CCO)] utility `ccoctl`.

.Prerequisites

Expand Down

0 comments on commit d9bf418

Please sign in to comment.