From cd6ebca6be889fc1a7192a266a1189632aac9e54 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 13 Jun 2024 09:09:36 +0200 Subject: [PATCH 1/5] refactor: replace logger by structlog --- ansibledoctor/cli.py | 38 ++++++++++++++++++++------------- ansibledoctor/doc_generator.py | 10 ++++----- ansibledoctor/utils/__init__.py | 17 +++++++++------ poetry.lock | 19 ++++++++++++++++- pyproject.toml | 1 + 5 files changed, 57 insertions(+), 28 deletions(-) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index b6c6bf71..d08d3c98 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -2,32 +2,35 @@ """Entrypoint and CLI handler.""" import argparse +import logging import os +import sys + +import structlog import ansibledoctor.exception from ansibledoctor import __version__ from ansibledoctor.config import SingleConfig from ansibledoctor.doc_generator import Generator from ansibledoctor.doc_parser import Parser -from ansibledoctor.utils import SingleLog class AnsibleDoctor: """Create main object.""" - def __init__(self): - self.log = SingleLog() - self.logger = self.log.logger + log = structlog.get_logger() + def __init__(self): try: self.config = SingleConfig() self.config.load(args=self._parse_args()) - self.log.register_hanlers(json=self.config.config.logging.json) self._execute() except ansibledoctor.exception.DoctorError as e: - self.log.sysexit_with_message(e) + self.log.fatal(e) + sys.exit(1) except KeyboardInterrupt: - self.log.sysexit_with_message("Aborted...") + self.log.fatal("Aborted...") + sys.exit(1) def _parse_args(self): """ @@ -125,23 +128,28 @@ def _execute(self): os.chdir(item) self.config.load(root_path=os.getcwd()) - self.log.register_hanlers(json=self.config.config.logging.json) try: - self.log.set_level(self.config.config.logging.level) + structlog.configure( + wrapper_class=structlog.make_filtering_bound_logger( + logging.getLevelName(self.config.config.logging.level) + ), + ) except ValueError as e: - self.log.sysexit_with_message(f"Can not set log level.\n{e!s}") - self.logger.info(f"Using config file: {self.config.config_files}") + self.log.fatal(f"Can not set log level.\n{e!s}") + sys.exit(1) - self.logger.debug(f"Using working directory: {os.path.relpath(item, self.log.ctx)}") + self.log.debug(f"Switch working directory: {item}") + self.log.info(f"Lookup config file: {self.config.config_files}") if self.config.config.role.autodetect: if self.config.is_role(): - self.logger.info(f"Ansible role detected: {self.config.config.role_name}") + self.log.info(f"Ansible role detected: {self.config.config.role_name}") else: - self.log.sysexit_with_message("No Ansible role detected") + self.log.fatal("No Ansible role detected") + sys.exit(1) else: - self.logger.info("Ansible role detection disabled") + self.lof.info("Ansible role detection disabled") doc_parser = Parser() doc_generator = Generator(doc_parser) diff --git a/ansibledoctor/doc_generator.py b/ansibledoctor/doc_generator.py index 0041bfaa..752edf18 100644 --- a/ansibledoctor/doc_generator.py +++ b/ansibledoctor/doc_generator.py @@ -7,20 +7,20 @@ import jinja2.exceptions import ruamel.yaml +import structlog from jinja2 import Environment, FileSystemLoader from jinja2.filters import pass_eval_context from ansibledoctor.config import SingleConfig from ansibledoctor.template import Template -from ansibledoctor.utils import FileUtils, SingleLog +from ansibledoctor.utils import FileUtils, sysexit_with_message class Generator: """Generate documentation from jinja2 templates.""" def __init__(self, doc_parser): - self.log = SingleLog() - self.logger = self.log.logger + self.log = structlog.get_logger() self.config = SingleConfig() self.template = Template( self.config.config.get("template.name"), @@ -34,7 +34,7 @@ def _create_dir(self, directory): os.makedirs(directory, exist_ok=True) self.logger.info(f"Creating dir: {directory}") except FileExistsError as e: - self.log.sysexit_with_message(e) + sysexit_with_message(e) def _write_doc(self): files_to_overwite = [] @@ -55,7 +55,7 @@ def _write_doc(self): with open(header_file) as a: header_content = a.read() except FileNotFoundError as e: - self.log.sysexit_with_message(f"Can not open custom header file\n{e!s}") + sysexit_with_message(f"Can not open custom header file\n{e!s}") if ( len(files_to_overwite) > 0 diff --git a/ansibledoctor/utils/__init__.py b/ansibledoctor/utils/__init__.py index d30c00f6..139bd8b7 100644 --- a/ansibledoctor/utils/__init__.py +++ b/ansibledoctor/utils/__init__.py @@ -7,6 +7,7 @@ from collections.abc import Iterable import colorama +import structlog from pythonjsonlogger import jsonlogger CONSOLE_FORMAT = "{}{}[%(levelname)s]{} %(message)s" @@ -91,6 +92,15 @@ def _split_string(string, delimiter, escape, maxsplit=None): return result +def sysexit(code=1): + sys.exit(code) + + +def sysexit_with_message(msg, code=1): + structlog.get_logger().critical(str(msg).strip()) + sysexit(code) + + colorama.init(autoreset=True, strip=not _should_do_markup()) @@ -294,13 +304,6 @@ def _color_text(self, color, msg): """ return f"{color}{msg}{colorama.Style.RESET_ALL}" - def sysexit(self, code=1): - sys.exit(code) - - def sysexit_with_message(self, msg, code=1): - self.logger.critical(str(msg).strip()) - self.sysexit(code) - class SingleLog(Log, metaclass=Singleton): """Singleton logging class.""" diff --git a/poetry.lock b/poetry.lock index 296dee71..fa3fb1de 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1041,6 +1041,23 @@ files = [ {file = "smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62"}, ] +[[package]] +name = "structlog" +version = "24.2.0" +description = "Structured Logging for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "structlog-24.2.0-py3-none-any.whl", hash = "sha256:983bd49f70725c5e1e3867096c0c09665918936b3db27341b41d294283d7a48a"}, + {file = "structlog-24.2.0.tar.gz", hash = "sha256:0e3fe74924a6d8857d3f612739efb94c72a7417d7c7c008d12276bca3b5bf13b"}, +] + +[package.extras] +dev = ["freezegun (>=0.2.8)", "mypy (>=1.4)", "pretend", "pytest (>=6.0)", "pytest-asyncio (>=0.17)", "rich", "simplejson", "twisted"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-mermaid", "sphinxext-opengraph", "twisted"] +tests = ["freezegun (>=0.2.8)", "pretend", "pytest (>=6.0)", "pytest-asyncio (>=0.17)", "simplejson"] +typing = ["mypy (>=1.4)", "rich", "twisted"] + [[package]] name = "toml" version = "0.10.2" @@ -1080,4 +1097,4 @@ ansible-core = ["ansible-core"] [metadata] lock-version = "2.0" python-versions = "^3.9.0" -content-hash = "f67e617787566ebf3e3bab85ddf75d97fe65a030d2ecec6d6877332d104d9cd0" +content-hash = "959078252b56e4c17249a0d6ba1d4afaeebcddc63e9e5affd2a5feae7f22d588" diff --git a/pyproject.toml b/pyproject.toml index 4ed4589b..3a0b7029 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ python-json-logger = { git = "https://github.com/nhairs/python-json-logger.git", dynaconf = "3.2.5" gitpython = "3.1.43" ansible-core = { version = "2.14.17", optional = true } +structlog = "^24.2.0" [tool.poetry.extras] ansible-core = ["ansible-core"] From 02a3b7b56571587b8121f487c27ed00f9be0f442 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 13 Jun 2024 16:07:25 +0200 Subject: [PATCH 2/5] replace custom logger --- ansibledoctor/annotation.py | 12 +- ansibledoctor/cli.py | 26 +--- ansibledoctor/config.py | 33 +++++ ansibledoctor/doc_generator.py | 25 ++-- ansibledoctor/doc_parser.py | 16 +-- ansibledoctor/file_registry.py | 7 +- ansibledoctor/template.py | 20 +-- ansibledoctor/utils/__init__.py | 213 ----------------------------- poetry.lock | 229 +------------------------------- pyproject.toml | 5 +- 10 files changed, 78 insertions(+), 508 deletions(-) diff --git a/ansibledoctor/annotation.py b/ansibledoctor/annotation.py index 5d5c8bec..97d23c22 100644 --- a/ansibledoctor/annotation.py +++ b/ansibledoctor/annotation.py @@ -6,9 +6,10 @@ from collections import defaultdict import anyconfig +import structlog from ansibledoctor.config import SingleConfig -from ansibledoctor.utils import SingleLog, _split_string +from ansibledoctor.utils import _split_string, sysexit_with_message class AnnotationItem: @@ -37,8 +38,7 @@ def __init__(self, name, files_registry): self._all_items = defaultdict(dict) self._file_handler = None self.config = SingleConfig() - self.log = SingleLog() - self.logger = self.log.logger + self.log = structlog.get_logger() self._files_registry = files_registry self._all_annotations = self.config.get_annotations_definition() @@ -67,7 +67,7 @@ def _find_annotation(self): num, line, self._annotation_definition["name"], rfile ) if item: - self.logger.info(str(item)) + self.log.info(str(item)) self._populate_item( item.get_obj().items(), self._annotation_definition["name"] ) @@ -85,7 +85,7 @@ def _populate_item(self, item, name): try: anyconfig.merge(self._all_items[key], value, ac_merge=anyconfig.MS_DICTS) except ValueError as e: - self.log.sysexit_with_message(f"Unable to merge annotation values:\n{e}") + sysexit_with_message(f"Unable to merge annotation values:\n{e}") def _get_annotation_data(self, num, line, name, rfile): """ @@ -180,6 +180,6 @@ def _str_to_json(self, key, string, rfile, num, line): try: return {key: json.loads(string)} except ValueError: - self.log.sysexit_with_message( + sysexit_with_message( f"Json value error: Can't parse json in {rfile}:{num!s}:\n{line.strip()}" ) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index d08d3c98..500e55fd 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -2,9 +2,7 @@ """Entrypoint and CLI handler.""" import argparse -import logging import os -import sys import structlog @@ -13,6 +11,7 @@ from ansibledoctor.config import SingleConfig from ansibledoctor.doc_generator import Generator from ansibledoctor.doc_parser import Parser +from ansibledoctor.utils import sysexit_with_message class AnsibleDoctor: @@ -26,11 +25,9 @@ def __init__(self): self.config.load(args=self._parse_args()) self._execute() except ansibledoctor.exception.DoctorError as e: - self.log.fatal(e) - sys.exit(1) + sysexit_with_message(e) except KeyboardInterrupt: - self.log.fatal("Aborted...") - sys.exit(1) + sysexit_with_message("Aborted...") def _parse_args(self): """ @@ -126,30 +123,19 @@ def _execute(self): for item in walkdirs: os.chdir(item) - self.config.load(root_path=os.getcwd()) - try: - structlog.configure( - wrapper_class=structlog.make_filtering_bound_logger( - logging.getLevelName(self.config.config.logging.level) - ), - ) - except ValueError as e: - self.log.fatal(f"Can not set log level.\n{e!s}") - sys.exit(1) - self.log.debug(f"Switch working directory: {item}") self.log.info(f"Lookup config file: {self.config.config_files}") if self.config.config.role.autodetect: if self.config.is_role(): self.log.info(f"Ansible role detected: {self.config.config.role_name}") + structlog.contextvars.bind_contextvars(role=self.config.config.role_name) else: - self.log.fatal("No Ansible role detected") - sys.exit(1) + sysexit_with_message("No Ansible role detected") else: - self.lof.info("Ansible role detection disabled") + self.log.info("Ansible role detection disabled") doc_parser = Parser() doc_generator = Generator(doc_parser) diff --git a/ansibledoctor/config.py b/ansibledoctor/config.py index 4910b846..25f9681b 100644 --- a/ansibledoctor/config.py +++ b/ansibledoctor/config.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 """Global settings definition.""" +import logging import os import re +import colorama +import structlog from appdirs import AppDirs from dynaconf import Dynaconf, ValidationError, Validator @@ -198,6 +201,8 @@ def load(self, root_path=None, args=None): self.config.update(self.args) self.validate() + self._init_logger() + def validate(self): try: self.config.validators.validate_all() @@ -226,6 +231,34 @@ def get_annotations_names(self, automatic=True): annotations.append(k) return annotations + def _init_logger(self): + styles = structlog.dev.ConsoleRenderer.get_default_level_styles() + styles["debug"] = colorama.Fore.BLUE + + processors = [ + structlog.contextvars.merge_contextvars, + structlog.processors.add_log_level, + structlog.processors.StackInfoRenderer(), + structlog.dev.set_exc_info, + structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S", utc=False), + ] + + if self.config.logging.json: + processors.append(structlog.processors.JSONRenderer()) + else: + processors.append(structlog.dev.ConsoleRenderer(level_styles=styles)) + + try: + structlog.configure( + processors=processors, + wrapper_class=structlog.make_filtering_bound_logger( + logging.getLevelName(self.config.get("logging.level")), + ), + ) + structlog.contextvars.unbind_contextvars() + except KeyError as e: + raise ansibledoctor.exception.ConfigError(f"Can not set log level: {e!s}") from e + class SingleConfig(Config, metaclass=Singleton): """Singleton config class.""" diff --git a/ansibledoctor/doc_generator.py b/ansibledoctor/doc_generator.py index 752edf18..534eadf9 100644 --- a/ansibledoctor/doc_generator.py +++ b/ansibledoctor/doc_generator.py @@ -32,7 +32,7 @@ def _create_dir(self, directory): if not self.config.config["dry_run"] and not os.path.isdir(directory): try: os.makedirs(directory, exist_ok=True) - self.logger.info(f"Creating dir: {directory}") + self.log.info(f"Creating dir: {directory}") except FileExistsError as e: sysexit_with_message(e) @@ -69,9 +69,9 @@ def _write_doc(self): try: if not FileUtils.query_yes_no(f"{prompt}\nDo you want to continue?"): - self.log.sysexit_with_message("Aborted...") + sysexit_with_message("Aborted...") except KeyboardInterrupt: - self.log.sysexit_with_message("Aborted...") + sysexit_with_message("Aborted...") for tf in self.template.files: doc_file = os.path.join( @@ -79,10 +79,7 @@ def _write_doc(self): ) template = os.path.join(self.template.path, tf) - self.logger.debug( - f"Writing renderer output to: {os.path.relpath(doc_file, self.log.ctx)} " - f"from: {os.path.dirname(template)}" - ) + self.log.debug(f"Writing renderer output: {doc_file} src: {os.path.dirname(template)}") # make sure the directory exists self._create_dir(os.path.dirname(doc_file)) @@ -111,21 +108,19 @@ def _write_doc(self): with open(doc_file, "wb") as outfile: outfile.write(header_content.encode("utf-8")) outfile.write(data.encode("utf-8")) - self.logger.info(f"Writing to: {doc_file}") + self.log.info(f"Writing to: {doc_file}") else: - self.logger.info(f"Writing to: {doc_file}") + self.log.info(f"Writing to: {doc_file}") except ( jinja2.exceptions.UndefinedError, jinja2.exceptions.TemplateSyntaxError, jinja2.exceptions.TemplateRuntimeError, ) as e: - self.log.sysexit_with_message( - f"Jinja2 templating error while loading file: {tf}\n{e!s}" + sysexit_with_message( + f"Jinja2 template error while loading file: {tf}\n{e!s}" ) except UnicodeEncodeError as e: - self.log.sysexit_with_message( - f"Unable to print special characters\n{e!s}" - ) + sysexit_with_message(f"Unable to print special characters\n{e!s}") def _to_nice_yaml(self, a, indent=4, **kw): """Make verbose, human readable yaml.""" @@ -157,5 +152,5 @@ def _safe_join(self, eval_ctx, value, d=""): return jinja2.filters.do_mark_safe(normalized) def render(self): - self.logger.info(f"Using renderer destination: {self.config.config.get('renderer.dest')}") + self.log.info(f"Using renderer destination: {self.config.config.get('renderer.dest')}") self._write_doc() diff --git a/ansibledoctor/doc_parser.py b/ansibledoctor/doc_parser.py index 02e2ebda..5e32dfd3 100644 --- a/ansibledoctor/doc_parser.py +++ b/ansibledoctor/doc_parser.py @@ -5,13 +5,14 @@ from collections import defaultdict import anyconfig +import structlog from ansibledoctor.annotation import Annotation from ansibledoctor.config import SingleConfig from ansibledoctor.contstants import YAML_EXTENSIONS from ansibledoctor.exception import YAMLError from ansibledoctor.file_registry import Registry -from ansibledoctor.utils import SingleLog, flatten +from ansibledoctor.utils import flatten, sysexit_with_message from ansibledoctor.utils.yamlhelper import parse_yaml, parse_yaml_ansible @@ -22,8 +23,7 @@ def __init__(self): self._annotation_objs = {} self._data = defaultdict(dict) self.config = SingleConfig() - self.log = SingleLog() - self.logger = SingleLog().logger + self.log = structlog.get_logger() self._files_registry = Registry() self._parse_meta_file() self._parse_var_files() @@ -37,7 +37,7 @@ def _parse_var_files(self): try: raw = parse_yaml(yamlfile) except YAMLError as e: - self.log.sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") data = defaultdict(dict, raw or {}) @@ -53,7 +53,7 @@ def _parse_meta_file(self): try: raw = parse_yaml(yamlfile) except YAMLError as e: - self.log.sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") data = defaultdict(dict, raw) if data.get("galaxy_info"): @@ -70,7 +70,7 @@ def _parse_task_tags(self): try: raw = parse_yaml_ansible(yamlfile) except YAMLError as e: - self.log.sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") tags = [] for task in raw: @@ -89,7 +89,7 @@ def _populate_doc_data(self): """Generate the documentation data object.""" tags = defaultdict(dict) for annotation in self.config.get_annotations_names(automatic=True): - self.logger.info(f"Finding annotations for: @{annotation}") + self.log.info(f"Finding annotations for: @{annotation}") self._annotation_objs[annotation] = Annotation( name=annotation, files_registry=self._files_registry ) @@ -98,7 +98,7 @@ def _populate_doc_data(self): try: anyconfig.merge(self._data, tags, ac_merge=anyconfig.MS_DICTS) except ValueError as e: - self.log.sysexit_with_message(f"Unable to merge annotation values:\n{e}") + sysexit_with_message(f"Unable to merge annotation values:\n{e}") def get_data(self): return self._data diff --git a/ansibledoctor/file_registry.py b/ansibledoctor/file_registry.py index f53c77b2..548f2d69 100644 --- a/ansibledoctor/file_registry.py +++ b/ansibledoctor/file_registry.py @@ -5,10 +5,10 @@ import os import pathspec +import structlog from ansibledoctor.config import SingleConfig from ansibledoctor.contstants import YAML_EXTENSIONS -from ansibledoctor.utils import SingleLog class Registry: @@ -21,8 +21,7 @@ class Registry: def __init__(self): self._doc = [] self.config = SingleConfig() - self.log = SingleLog() - self.logger = self.log.logger + self.log = structlog.get_logger() self._scan_for_yamls() def get_files(self): @@ -41,7 +40,7 @@ def _scan_for_yamls(self): excludes = self.config.config.get("exclude_files") excludespec = pathspec.PathSpec.from_lines("gitwildmatch", excludes) - self.logger.debug(f"Scan for files: {os.path.relpath(base_dir,self.log.ctx)}") + self.log.debug(f"Scan for files: {base_dir}") for extension in extensions: pattern = os.path.join(base_dir, "**/*." + extension) diff --git a/ansibledoctor/template.py b/ansibledoctor/template.py index cc9a834e..efe38ef3 100644 --- a/ansibledoctor/template.py +++ b/ansibledoctor/template.py @@ -7,17 +7,18 @@ import shutil import tempfile +import structlog from git import GitCommandError, Repo import ansibledoctor.exception -from ansibledoctor.utils import SingleLog +from ansibledoctor.utils import sysexit_with_message class Template: """ Represents a template that can be used to generate content. - Templates can besourced from a local file or a Git repository. The `Template` class handles + Templates can be sourced from a local file or a Git repository. The `Template` class handles the initialization and setup of a template, including cloning a Git repository if necessary. Args: @@ -33,8 +34,7 @@ class Template: """ def __init__(self, name, src): - self.log = SingleLog() - self.logger = self.log.logger + self.log = structlog.get_logger() self.name = name self.src = src @@ -68,10 +68,10 @@ def _clone_repo(self, repo_url, branch_or_tag=None): atexit.register(self._cleanup_temp_dir, temp_dir) try: - self.logger.debug(f"Cloning template repo: {repo_url}") + self.log.debug(f"Cloning template repo: {repo_url}") repo = Repo.clone_from(repo_url, temp_dir) if branch_or_tag: - self.logger.debug(f"Checking out branch or tag: {branch_or_tag}") + self.log.debug(f"Checking out branch or tag: {branch_or_tag}") try: repo.git.checkout(branch_or_tag) except GitCommandError as e: @@ -93,17 +93,17 @@ def _scan_files(self): template_files = [] if os.path.isdir(self.path): - self.logger.info(f"Using template src: {self.src} name: {self.name}") + self.log.info(f"Using template src: {self.src} name: {self.name}") else: - self.log.sysexit_with_message(f"Can not open template directory {self.path}") + sysexit_with_message(f"Can not open template directory {self.path}") for file in glob.iglob(self.path + "/**/*.j2", recursive=True): relative_file = file[len(self.path) + 1 :] if ntpath.basename(file)[:1] != "_": - self.logger.debug(f"Found template file: {relative_file}") + self.log.debug(f"Found template file: {relative_file}") template_files.append(relative_file) else: - self.logger.debug(f"Ignoring template file: {relative_file}") + self.log.debug(f"Ignoring template file: {relative_file}") return template_files diff --git a/ansibledoctor/utils/__init__.py b/ansibledoctor/utils/__init__.py index 139bd8b7..76434a48 100644 --- a/ansibledoctor/utils/__init__.py +++ b/ansibledoctor/utils/__init__.py @@ -1,17 +1,11 @@ #!/usr/bin/env python3 """Global utility methods and classes.""" -import logging import os import sys from collections.abc import Iterable -import colorama import structlog -from pythonjsonlogger import jsonlogger - -CONSOLE_FORMAT = "{}{}[%(levelname)s]{} %(message)s" -JSON_FORMAT = "%(asctime)s %(levelname)s %(message)s" def strtobool(value): @@ -50,14 +44,6 @@ def flatten(items): yield x -def _should_do_markup(): - py_colors = os.environ.get("PY_COLORS", None) - if py_colors is not None: - return to_bool(py_colors) - - return sys.stdout.isatty() and os.environ.get("TERM") != "dumb" - - def _split_string(string, delimiter, escape, maxsplit=None): result = [] current_element = [] @@ -101,9 +87,6 @@ def sysexit_with_message(msg, code=1): sysexit(code) -colorama.init(autoreset=True, strip=not _should_do_markup()) - - class Singleton(type): """Meta singleton class.""" @@ -115,202 +98,6 @@ def __call__(cls, *args, **kwargs): return cls._instances[cls] -class LogFilter: - """Exclude log messages above the logged level.""" - - def __init__(self, level): - """ - Initialize a new custom log filter. - - :param level: Log level limit - :returns: None - - """ - self.__level = level - - def filter(self, logRecord): # noqa - # https://docs.python.org/3/library/logging.html#logrecord-attributes - return logRecord.levelno <= self.__level - - -class MultilineFormatter(logging.Formatter): - """Reset color after newline characters.""" - - def format(self, record): - record.msg = record.msg.strip().replace("\n", f"\n{colorama.Style.RESET_ALL}... ") - return logging.Formatter.format(self, record) - - -class MultilineJsonFormatter(jsonlogger.JsonFormatter): - """Remove newline characters.""" - - def format(self, record): - record.msg = record.msg.replace("\n", " ") - return jsonlogger.JsonFormatter.format(self, record) - - -class Log: - """Handle logging.""" - - def __init__(self, level=logging.WARNING, name="ansibledoctor", json=False): - self.ctx = os.getcwd() - self.logger = logging.getLogger(name) - self.logger.setLevel(level) - self.register_hanlers(json=json) - self.logger.propagate = False - - def _get_error_handler(self, json=False): - handler = logging.StreamHandler(sys.stderr) - handler.setLevel(logging.ERROR) - handler.addFilter(LogFilter(logging.ERROR)) - handler.setFormatter( - MultilineFormatter( - self.error( - CONSOLE_FORMAT.format( - colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL - ) - ) - ) - ) - - if json: - handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT)) - - return handler - - def _get_warning_handler(self, json=False): - handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.WARNING) - handler.addFilter(LogFilter(logging.WARNING)) - handler.setFormatter( - MultilineFormatter( - self.warning( - CONSOLE_FORMAT.format( - colorama.Fore.YELLOW, colorama.Style.BRIGHT, colorama.Style.RESET_ALL - ) - ) - ) - ) - - if json: - handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT)) - - return handler - - def _get_info_handler(self, json=False): - handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.INFO) - handler.addFilter(LogFilter(logging.INFO)) - handler.setFormatter( - MultilineFormatter( - self.info( - CONSOLE_FORMAT.format( - colorama.Fore.CYAN, colorama.Style.BRIGHT, colorama.Style.RESET_ALL - ) - ) - ) - ) - - if json: - handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT)) - - return handler - - def _get_critical_handler(self, json=False): - handler = logging.StreamHandler(sys.stderr) - handler.setLevel(logging.CRITICAL) - handler.addFilter(LogFilter(logging.CRITICAL)) - handler.setFormatter( - MultilineFormatter( - self.critical( - CONSOLE_FORMAT.format( - colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL - ) - ) - ) - ) - - if json: - handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT)) - - return handler - - def _get_debug_handler(self, json=False): - handler = logging.StreamHandler(sys.stderr) - handler.setLevel(logging.DEBUG) - handler.addFilter(LogFilter(logging.DEBUG)) - handler.setFormatter( - MultilineFormatter( - self.debug( - CONSOLE_FORMAT.format( - colorama.Fore.BLUE, colorama.Style.BRIGHT, colorama.Style.RESET_ALL - ) - ) - ) - ) - - if json: - handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT)) - - return handler - - def register_hanlers(self, json=False): - """ - Enable or disable JSON logging. - - :param enable: True to enable JSON logging, False to disable - """ - # Remove all existing handlers - for handler in self.logger.handlers[:]: - self.logger.removeHandler(handler) - - self.logger.addHandler(self._get_error_handler(json=json)) - self.logger.addHandler(self._get_warning_handler(json=json)) - self.logger.addHandler(self._get_info_handler(json=json)) - self.logger.addHandler(self._get_critical_handler(json=json)) - self.logger.addHandler(self._get_debug_handler(json=json)) - - def set_level(self, s): - self.logger.setLevel(s.upper()) - - def debug(self, msg): - """Format info messages and return string.""" - return msg - - def critical(self, msg): - """Format critical messages and return string.""" - return msg - - def error(self, msg): - """Format error messages and return string.""" - return msg - - def warning(self, msg): - """Format warning messages and return string.""" - return msg - - def info(self, msg): - """Format info messages and return string.""" - return msg - - def _color_text(self, color, msg): - """ - Colorize strings. - - :param color: colorama color settings - :param msg: string to colorize - :returns: string - - """ - return f"{color}{msg}{colorama.Style.RESET_ALL}" - - -class SingleLog(Log, metaclass=Singleton): - """Singleton logging class.""" - - pass - - class FileUtils: """Mics static methods for file handling.""" diff --git a/poetry.lock b/poetry.lock index fa3fb1de..fce2ecc7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -46,25 +46,6 @@ files = [ {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, ] -[[package]] -name = "attrs" -version = "23.2.0" -description = "Classes Without Boilerplate" -optional = false -python-versions = ">=3.7" -files = [ - {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"}, - {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"}, -] - -[package.extras] -cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] -dev = ["attrs[tests]", "pre-commit"] -docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] -tests = ["attrs[tests-no-zope]", "zope-interface"] -tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"] -tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"] - [[package]] name = "cffi" version = "1.16.0" @@ -282,26 +263,6 @@ toml = ["toml"] vault = ["hvac"] yaml = ["ruamel.yaml"] -[[package]] -name = "environs" -version = "11.0.0" -description = "simplified environment variable parsing" -optional = false -python-versions = ">=3.8" -files = [ - {file = "environs-11.0.0-py3-none-any.whl", hash = "sha256:e0bcfd41c718c07a7db422f9109e490746450da38793fe4ee197f397b9343435"}, - {file = "environs-11.0.0.tar.gz", hash = "sha256:069727a8f73d8ba8d033d3cd95c0da231d44f38f1da773bf076cef168d312ee8"}, -] - -[package.dependencies] -marshmallow = ">=3.13.0" -python-dotenv = "*" - -[package.extras] -dev = ["environs[tests]", "pre-commit (>=3.5,<4.0)", "tox"] -django = ["dj-database-url", "dj-email-url", "django-cache-url"] -tests = ["environs[django]", "pytest"] - [[package]] name = "exceptiongroup" version = "1.2.1" @@ -397,41 +358,6 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] -[[package]] -name = "jsonschema" -version = "4.22.0" -description = "An implementation of JSON Schema validation for Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "jsonschema-4.22.0-py3-none-any.whl", hash = "sha256:ff4cfd6b1367a40e7bc6411caec72effadd3db0bbe5017de188f2d6108335802"}, - {file = "jsonschema-4.22.0.tar.gz", hash = "sha256:5b22d434a45935119af990552c862e5d6d564e8f6601206b305a61fdf661a2b7"}, -] - -[package.dependencies] -attrs = ">=22.2.0" -jsonschema-specifications = ">=2023.03.6" -referencing = ">=0.28.4" -rpds-py = ">=0.7.1" - -[package.extras] -format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"] -format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "uri-template", "webcolors (>=1.11)"] - -[[package]] -name = "jsonschema-specifications" -version = "2023.12.1" -description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -optional = false -python-versions = ">=3.8" -files = [ - {file = "jsonschema_specifications-2023.12.1-py3-none-any.whl", hash = "sha256:87e4fdf3a94858b8a2ba2778d9ba57d8a9cafca7c7489c46ba0d30a8bc6a9c3c"}, - {file = "jsonschema_specifications-2023.12.1.tar.gz", hash = "sha256:48a76787b3e70f5ed53f1160d2b81f586e4ca6d1548c5de7085d1682674764cc"}, -] - -[package.dependencies] -referencing = ">=0.31.0" - [[package]] name = "markdown-it-py" version = "3.0.0" @@ -525,25 +451,6 @@ files = [ {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"}, ] -[[package]] -name = "marshmallow" -version = "3.21.3" -description = "A lightweight library for converting complex datatypes to and from native Python datatypes." -optional = false -python-versions = ">=3.8" -files = [ - {file = "marshmallow-3.21.3-py3-none-any.whl", hash = "sha256:86ce7fb914aa865001a4b2092c4c2872d13bc347f3d42673272cabfdbad386f1"}, - {file = "marshmallow-3.21.3.tar.gz", hash = "sha256:4f57c5e050a54d66361e826f94fba213eb10b67b2fdb02c3e0343ce207ba1662"}, -] - -[package.dependencies] -packaging = ">=17.0" - -[package.extras] -dev = ["marshmallow[tests]", "pre-commit (>=3.5,<4.0)", "tox"] -docs = ["alabaster (==0.7.16)", "autodocsumm (==0.2.12)", "sphinx (==7.3.7)", "sphinx-issues (==4.1.0)", "sphinx-version-warning (==1.1.2)"] -tests = ["pytest", "pytz", "simplejson"] - [[package]] name = "mdurl" version = "0.1.2" @@ -769,21 +676,6 @@ files = [ {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, ] -[[package]] -name = "referencing" -version = "0.35.1" -description = "JSON Referencing + Python" -optional = false -python-versions = ">=3.8" -files = [ - {file = "referencing-0.35.1-py3-none-any.whl", hash = "sha256:eda6d3234d62814d1c64e305c1331c9a3a6132da475ab6382eaa997b21ee75de"}, - {file = "referencing-0.35.1.tar.gz", hash = "sha256:25b42124a6c8b632a425174f24087783efb348a6f1e0008e63cd4466fedf703c"}, -] - -[package.dependencies] -attrs = ">=22.2.0" -rpds-py = ">=0.7.0" - [[package]] name = "resolvelib" version = "0.8.1" @@ -819,114 +711,6 @@ pygments = ">=2.13.0,<3.0.0" [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] -[[package]] -name = "rpds-py" -version = "0.18.1" -description = "Python bindings to Rust's persistent data structures (rpds)" -optional = false -python-versions = ">=3.8" -files = [ - {file = "rpds_py-0.18.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:d31dea506d718693b6b2cffc0648a8929bdc51c70a311b2770f09611caa10d53"}, - {file = "rpds_py-0.18.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:732672fbc449bab754e0b15356c077cc31566df874964d4801ab14f71951ea80"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4a98a1f0552b5f227a3d6422dbd61bc6f30db170939bd87ed14f3c339aa6c7c9"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7f1944ce16401aad1e3f7d312247b3d5de7981f634dc9dfe90da72b87d37887d"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:38e14fb4e370885c4ecd734f093a2225ee52dc384b86fa55fe3f74638b2cfb09"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:08d74b184f9ab6289b87b19fe6a6d1a97fbfea84b8a3e745e87a5de3029bf944"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d70129cef4a8d979caa37e7fe957202e7eee8ea02c5e16455bc9808a59c6b2f0"}, - {file = "rpds_py-0.18.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ce0bb20e3a11bd04461324a6a798af34d503f8d6f1aa3d2aa8901ceaf039176d"}, - {file = "rpds_py-0.18.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:81c5196a790032e0fc2464c0b4ab95f8610f96f1f2fa3d4deacce6a79852da60"}, - {file = "rpds_py-0.18.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:f3027be483868c99b4985fda802a57a67fdf30c5d9a50338d9db646d590198da"}, - {file = "rpds_py-0.18.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:d44607f98caa2961bab4fa3c4309724b185b464cdc3ba6f3d7340bac3ec97cc1"}, - {file = "rpds_py-0.18.1-cp310-none-win32.whl", hash = "sha256:c273e795e7a0f1fddd46e1e3cb8be15634c29ae8ff31c196debb620e1edb9333"}, - {file = "rpds_py-0.18.1-cp310-none-win_amd64.whl", hash = "sha256:8352f48d511de5f973e4f2f9412736d7dea76c69faa6d36bcf885b50c758ab9a"}, - {file = "rpds_py-0.18.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:6b5ff7e1d63a8281654b5e2896d7f08799378e594f09cf3674e832ecaf396ce8"}, - {file = "rpds_py-0.18.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8927638a4d4137a289e41d0fd631551e89fa346d6dbcfc31ad627557d03ceb6d"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:154bf5c93d79558b44e5b50cc354aa0459e518e83677791e6adb0b039b7aa6a7"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:07f2139741e5deb2c5154a7b9629bc5aa48c766b643c1a6750d16f865a82c5fc"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8c7672e9fba7425f79019db9945b16e308ed8bc89348c23d955c8c0540da0a07"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:489bdfe1abd0406eba6b3bb4fdc87c7fa40f1031de073d0cfb744634cc8fa261"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c20f05e8e3d4fc76875fc9cb8cf24b90a63f5a1b4c5b9273f0e8225e169b100"}, - {file = "rpds_py-0.18.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:967342e045564cef76dfcf1edb700b1e20838d83b1aa02ab313e6a497cf923b8"}, - {file = "rpds_py-0.18.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:2cc7c1a47f3a63282ab0f422d90ddac4aa3034e39fc66a559ab93041e6505da7"}, - {file = "rpds_py-0.18.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:f7afbfee1157e0f9376c00bb232e80a60e59ed716e3211a80cb8506550671e6e"}, - {file = "rpds_py-0.18.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9e6934d70dc50f9f8ea47081ceafdec09245fd9f6032669c3b45705dea096b88"}, - {file = "rpds_py-0.18.1-cp311-none-win32.whl", hash = "sha256:c69882964516dc143083d3795cb508e806b09fc3800fd0d4cddc1df6c36e76bb"}, - {file = "rpds_py-0.18.1-cp311-none-win_amd64.whl", hash = "sha256:70a838f7754483bcdc830444952fd89645569e7452e3226de4a613a4c1793fb2"}, - {file = "rpds_py-0.18.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3dd3cd86e1db5aadd334e011eba4e29d37a104b403e8ca24dcd6703c68ca55b3"}, - {file = "rpds_py-0.18.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:05f3d615099bd9b13ecf2fc9cf2d839ad3f20239c678f461c753e93755d629ee"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:35b2b771b13eee8729a5049c976197ff58a27a3829c018a04341bcf1ae409b2b"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ee17cd26b97d537af8f33635ef38be873073d516fd425e80559f4585a7b90c43"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b646bf655b135ccf4522ed43d6902af37d3f5dbcf0da66c769a2b3938b9d8184"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:19ba472b9606c36716062c023afa2484d1e4220548751bda14f725a7de17b4f6"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e30ac5e329098903262dc5bdd7e2086e0256aa762cc8b744f9e7bf2a427d3f8"}, - {file = "rpds_py-0.18.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d58ad6317d188c43750cb76e9deacf6051d0f884d87dc6518e0280438648a9ac"}, - {file = "rpds_py-0.18.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e1735502458621921cee039c47318cb90b51d532c2766593be6207eec53e5c4c"}, - {file = "rpds_py-0.18.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:f5bab211605d91db0e2995a17b5c6ee5edec1270e46223e513eaa20da20076ac"}, - {file = "rpds_py-0.18.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2fc24a329a717f9e2448f8cd1f960f9dac4e45b6224d60734edeb67499bab03a"}, - {file = "rpds_py-0.18.1-cp312-none-win32.whl", hash = "sha256:1805d5901779662d599d0e2e4159d8a82c0b05faa86ef9222bf974572286b2b6"}, - {file = "rpds_py-0.18.1-cp312-none-win_amd64.whl", hash = "sha256:720edcb916df872d80f80a1cc5ea9058300b97721efda8651efcd938a9c70a72"}, - {file = "rpds_py-0.18.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:c827576e2fa017a081346dce87d532a5310241648eb3700af9a571a6e9fc7e74"}, - {file = "rpds_py-0.18.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:aa3679e751408d75a0b4d8d26d6647b6d9326f5e35c00a7ccd82b78ef64f65f8"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0abeee75434e2ee2d142d650d1e54ac1f8b01e6e6abdde8ffd6eeac6e9c38e20"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed402d6153c5d519a0faf1bb69898e97fb31613b49da27a84a13935ea9164dfc"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:338dee44b0cef8b70fd2ef54b4e09bb1b97fc6c3a58fea5db6cc083fd9fc2724"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7750569d9526199c5b97e5a9f8d96a13300950d910cf04a861d96f4273d5b104"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:607345bd5912aacc0c5a63d45a1f73fef29e697884f7e861094e443187c02be5"}, - {file = "rpds_py-0.18.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:207c82978115baa1fd8d706d720b4a4d2b0913df1c78c85ba73fe6c5804505f0"}, - {file = "rpds_py-0.18.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:6d1e42d2735d437e7e80bab4d78eb2e459af48c0a46e686ea35f690b93db792d"}, - {file = "rpds_py-0.18.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:5463c47c08630007dc0fe99fb480ea4f34a89712410592380425a9b4e1611d8e"}, - {file = "rpds_py-0.18.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:06d218939e1bf2ca50e6b0ec700ffe755e5216a8230ab3e87c059ebb4ea06afc"}, - {file = "rpds_py-0.18.1-cp38-none-win32.whl", hash = "sha256:312fe69b4fe1ffbe76520a7676b1e5ac06ddf7826d764cc10265c3b53f96dbe9"}, - {file = "rpds_py-0.18.1-cp38-none-win_amd64.whl", hash = "sha256:9437ca26784120a279f3137ee080b0e717012c42921eb07861b412340f85bae2"}, - {file = "rpds_py-0.18.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:19e515b78c3fc1039dd7da0a33c28c3154458f947f4dc198d3c72db2b6b5dc93"}, - {file = "rpds_py-0.18.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a7b28c5b066bca9a4eb4e2f2663012debe680f097979d880657f00e1c30875a0"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:673fdbbf668dd958eff750e500495ef3f611e2ecc209464f661bc82e9838991e"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d960de62227635d2e61068f42a6cb6aae91a7fe00fca0e3aeed17667c8a34611"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:352a88dc7892f1da66b6027af06a2e7e5d53fe05924cc2cfc56495b586a10b72"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e0ee01ad8260184db21468a6e1c37afa0529acc12c3a697ee498d3c2c4dcaf3"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4c39ad2f512b4041343ea3c7894339e4ca7839ac38ca83d68a832fc8b3748ab"}, - {file = "rpds_py-0.18.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:aaa71ee43a703c321906813bb252f69524f02aa05bf4eec85f0c41d5d62d0f4c"}, - {file = "rpds_py-0.18.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:6cd8098517c64a85e790657e7b1e509b9fe07487fd358e19431cb120f7d96338"}, - {file = "rpds_py-0.18.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:4adec039b8e2928983f885c53b7cc4cda8965b62b6596501a0308d2703f8af1b"}, - {file = "rpds_py-0.18.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:32b7daaa3e9389db3695964ce8e566e3413b0c43e3394c05e4b243a4cd7bef26"}, - {file = "rpds_py-0.18.1-cp39-none-win32.whl", hash = "sha256:2625f03b105328729f9450c8badda34d5243231eef6535f80064d57035738360"}, - {file = "rpds_py-0.18.1-cp39-none-win_amd64.whl", hash = "sha256:bf18932d0003c8c4d51a39f244231986ab23ee057d235a12b2684ea26a353590"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:cbfbea39ba64f5e53ae2915de36f130588bba71245b418060ec3330ebf85678e"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:a3d456ff2a6a4d2adcdf3c1c960a36f4fd2fec6e3b4902a42a384d17cf4e7a65"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7700936ef9d006b7ef605dc53aa364da2de5a3aa65516a1f3ce73bf82ecfc7ae"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:51584acc5916212e1bf45edd17f3a6b05fe0cbb40482d25e619f824dccb679de"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:942695a206a58d2575033ff1e42b12b2aece98d6003c6bc739fbf33d1773b12f"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b906b5f58892813e5ba5c6056d6a5ad08f358ba49f046d910ad992196ea61397"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6f8e3fecca256fefc91bb6765a693d96692459d7d4c644660a9fff32e517843"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7732770412bab81c5a9f6d20aeb60ae943a9b36dcd990d876a773526468e7163"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:bd1105b50ede37461c1d51b9698c4f4be6e13e69a908ab7751e3807985fc0346"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-musllinux_1_2_i686.whl", hash = "sha256:618916f5535784960f3ecf8111581f4ad31d347c3de66d02e728de460a46303c"}, - {file = "rpds_py-0.18.1-pp310-pypy310_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:17c6d2155e2423f7e79e3bb18151c686d40db42d8645e7977442170c360194d4"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-macosx_10_12_x86_64.whl", hash = "sha256:6c4c4c3f878df21faf5fac86eda32671c27889e13570645a9eea0a1abdd50922"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:fab6ce90574645a0d6c58890e9bcaac8d94dff54fb51c69e5522a7358b80ab64"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:531796fb842b53f2695e94dc338929e9f9dbf473b64710c28af5a160b2a8927d"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:740884bc62a5e2bbb31e584f5d23b32320fd75d79f916f15a788d527a5e83644"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:998125738de0158f088aef3cb264a34251908dd2e5d9966774fdab7402edfab7"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e2be6e9dd4111d5b31ba3b74d17da54a8319d8168890fbaea4b9e5c3de630ae5"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d0cee71bc618cd93716f3c1bf56653740d2d13ddbd47673efa8bf41435a60daa"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2c3caec4ec5cd1d18e5dd6ae5194d24ed12785212a90b37f5f7f06b8bedd7139"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:27bba383e8c5231cd559affe169ca0b96ec78d39909ffd817f28b166d7ddd4d8"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-musllinux_1_2_i686.whl", hash = "sha256:a888e8bdb45916234b99da2d859566f1e8a1d2275a801bb8e4a9644e3c7e7909"}, - {file = "rpds_py-0.18.1-pp38-pypy38_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:6031b25fb1b06327b43d841f33842b383beba399884f8228a6bb3df3088485ff"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:48c2faaa8adfacefcbfdb5f2e2e7bdad081e5ace8d182e5f4ade971f128e6bb3"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:d85164315bd68c0806768dc6bb0429c6f95c354f87485ee3593c4f6b14def2bd"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6afd80f6c79893cfc0574956f78a0add8c76e3696f2d6a15bca2c66c415cf2d4"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa242ac1ff583e4ec7771141606aafc92b361cd90a05c30d93e343a0c2d82a89"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d21be4770ff4e08698e1e8e0bce06edb6ea0626e7c8f560bc08222880aca6a6f"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c45a639e93a0c5d4b788b2613bd637468edd62f8f95ebc6fcc303d58ab3f0a8"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:910e71711d1055b2768181efa0a17537b2622afeb0424116619817007f8a2b10"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b9bb1f182a97880f6078283b3505a707057c42bf55d8fca604f70dedfdc0772a"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:1d54f74f40b1f7aaa595a02ff42ef38ca654b1469bef7d52867da474243cc633"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-musllinux_1_2_i686.whl", hash = "sha256:8d2e182c9ee01135e11e9676e9a62dfad791a7a467738f06726872374a83db49"}, - {file = "rpds_py-0.18.1-pp39-pypy39_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:636a15acc588f70fda1661234761f9ed9ad79ebed3f2125d44be0862708b666e"}, - {file = "rpds_py-0.18.1.tar.gz", hash = "sha256:dc48b479d540770c811fbd1eb9ba2bb66951863e448efec2e2c102625328e92f"}, -] - [[package]] name = "ruamel-yaml" version = "0.18.6" @@ -1080,21 +864,10 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] -[[package]] -name = "typing-extensions" -version = "4.12.2" -description = "Backported and Experimental Type Hints for Python 3.8+" -optional = false -python-versions = ">=3.8" -files = [ - {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, - {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, -] - [extras] ansible-core = ["ansible-core"] [metadata] lock-version = "2.0" python-versions = "^3.9.0" -content-hash = "959078252b56e4c17249a0d6ba1d4afaeebcddc63e9e5affd2a5feae7f22d588" +content-hash = "5f15bfc588e9148886e7499f46e2da42bdf381f537ba118ce6187d358922ed79" diff --git a/pyproject.toml b/pyproject.toml index 3a0b7029..3aaebbf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,16 +35,13 @@ Jinja2 = "3.1.4" anyconfig = "0.14.0" appdirs = "1.4.4" colorama = "0.4.6" -environs = "11.0.0" -jsonschema = "4.22.0" pathspec = "0.12.1" python = "^3.9.0" -python-json-logger = { git = "https://github.com/nhairs/python-json-logger.git", tag = "v3.1.0" } "ruamel.yaml" = "0.18.6" dynaconf = "3.2.5" gitpython = "3.1.43" ansible-core = { version = "2.14.17", optional = true } -structlog = "^24.2.0" +structlog = "24.2.0" [tool.poetry.extras] ansible-core = ["ansible-core"] From e16a05760dfb3d8a63c5857c05f7fed4134ac09c Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 16 Jun 2024 21:21:57 +0200 Subject: [PATCH 3/5] harmonize log messages and formatting --- ansibledoctor/annotation.py | 6 ++-- ansibledoctor/cli.py | 6 ++-- ansibledoctor/config.py | 50 ++++++++++++++++++++++++++++++- ansibledoctor/doc_generator.py | 12 +++----- ansibledoctor/doc_parser.py | 10 +++---- ansibledoctor/file_registry.py | 9 ++---- ansibledoctor/template.py | 10 +++---- ansibledoctor/utils/__init__.py | 4 +-- ansibledoctor/utils/yamlhelper.py | 21 +++++-------- poetry.lock | 37 ++++------------------- 10 files changed, 87 insertions(+), 78 deletions(-) diff --git a/ansibledoctor/annotation.py b/ansibledoctor/annotation.py index 97d23c22..56914848 100644 --- a/ansibledoctor/annotation.py +++ b/ansibledoctor/annotation.py @@ -67,7 +67,7 @@ def _find_annotation(self): num, line, self._annotation_definition["name"], rfile ) if item: - self.log.info(str(item)) + self.log.info(f"Found {item!s}") self._populate_item( item.get_obj().items(), self._annotation_definition["name"] ) @@ -85,7 +85,7 @@ def _populate_item(self, item, name): try: anyconfig.merge(self._all_items[key], value, ac_merge=anyconfig.MS_DICTS) except ValueError as e: - sysexit_with_message(f"Unable to merge annotation values:\n{e}") + sysexit_with_message("Failed to merge annotation values", error=e) def _get_annotation_data(self, num, line, name, rfile): """ @@ -181,5 +181,5 @@ def _str_to_json(self, key, string, rfile, num, line): return {key: json.loads(string)} except ValueError: sysexit_with_message( - f"Json value error: Can't parse json in {rfile}:{num!s}:\n{line.strip()}" + f"ValueError: Failed to parse json in {rfile}:{num!s}", src=line.strip() ) diff --git a/ansibledoctor/cli.py b/ansibledoctor/cli.py index 500e55fd..88d2c22a 100644 --- a/ansibledoctor/cli.py +++ b/ansibledoctor/cli.py @@ -125,13 +125,13 @@ def _execute(self): os.chdir(item) self.config.load(root_path=os.getcwd()) - self.log.debug(f"Switch working directory: {item}") - self.log.info(f"Lookup config file: {self.config.config_files}") + self.log.debug("Switch working directory", path=item) + self.log.info("Lookup config file", path=self.config.config_files) if self.config.config.role.autodetect: if self.config.is_role(): - self.log.info(f"Ansible role detected: {self.config.config.role_name}") structlog.contextvars.bind_contextvars(role=self.config.config.role_name) + self.log.info("Ansible role detected") else: sysexit_with_message("No Ansible role detected") else: diff --git a/ansibledoctor/config.py b/ansibledoctor/config.py index 25f9681b..45403c43 100644 --- a/ansibledoctor/config.py +++ b/ansibledoctor/config.py @@ -4,6 +4,7 @@ import logging import os import re +from io import StringIO import colorama import structlog @@ -244,9 +245,10 @@ def _init_logger(self): ] if self.config.logging.json: + processors.append(ErrorStringifier()) processors.append(structlog.processors.JSONRenderer()) else: - processors.append(structlog.dev.ConsoleRenderer(level_styles=styles)) + processors.append(MultilineConsoleRenderer(level_styles=styles)) try: structlog.configure( @@ -260,6 +262,52 @@ def _init_logger(self): raise ansibledoctor.exception.ConfigError(f"Can not set log level: {e!s}") from e +class ErrorStringifier: + """A processor that converts exceptions to a string representation.""" + + def __call__(self, _, __, event_dict): + if "error" not in event_dict: + return event_dict + + err = event_dict.get("error") + + if isinstance(err, Exception): + event_dict["error"] = f"{err.__class__.__name__}: {err}" + + return event_dict + + +class MultilineConsoleRenderer(structlog.dev.ConsoleRenderer): + """A processor for printing multiline strings.""" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + def __call__(self, _, __, event_dict): + err = None + + if "error" in event_dict: + err = event_dict.pop("error") + + event_dict = super().__call__(_, __, event_dict) + + if not err: + return event_dict + + sio = StringIO() + sio.write(event_dict) + + if isinstance(err, Exception): + sio.write( + f"\n{colorama.Fore.RED}{err.__class__.__name__}:" + f"{colorama.Style.RESET_ALL} {str(err).strip()}" + ) + else: + sio.write(f"\n{err.strip()}") + + return sio.getvalue() + + class SingleConfig(Config, metaclass=Singleton): """Singleton config class.""" diff --git a/ansibledoctor/doc_generator.py b/ansibledoctor/doc_generator.py index 534eadf9..619600d0 100644 --- a/ansibledoctor/doc_generator.py +++ b/ansibledoctor/doc_generator.py @@ -55,7 +55,7 @@ def _write_doc(self): with open(header_file) as a: header_content = a.read() except FileNotFoundError as e: - sysexit_with_message(f"Can not open custom header file\n{e!s}") + sysexit_with_message("Can not open custom header file", path=header_file, error=e) if ( len(files_to_overwite) > 0 @@ -79,7 +79,7 @@ def _write_doc(self): ) template = os.path.join(self.template.path, tf) - self.log.debug(f"Writing renderer output: {doc_file} src: {os.path.dirname(template)}") + self.log.debug("Writing renderer output", path=doc_file, src=os.path.dirname(template)) # make sure the directory exists self._create_dir(os.path.dirname(doc_file)) @@ -108,19 +108,16 @@ def _write_doc(self): with open(doc_file, "wb") as outfile: outfile.write(header_content.encode("utf-8")) outfile.write(data.encode("utf-8")) - self.log.info(f"Writing to: {doc_file}") - else: - self.log.info(f"Writing to: {doc_file}") except ( jinja2.exceptions.UndefinedError, jinja2.exceptions.TemplateSyntaxError, jinja2.exceptions.TemplateRuntimeError, ) as e: sysexit_with_message( - f"Jinja2 template error while loading file: {tf}\n{e!s}" + "Jinja2 template error while loading file", path=tf, error=e ) except UnicodeEncodeError as e: - sysexit_with_message(f"Unable to print special characters\n{e!s}") + sysexit_with_message("Failed to print special characters", error=e) def _to_nice_yaml(self, a, indent=4, **kw): """Make verbose, human readable yaml.""" @@ -152,5 +149,4 @@ def _safe_join(self, eval_ctx, value, d=""): return jinja2.filters.do_mark_safe(normalized) def render(self): - self.log.info(f"Using renderer destination: {self.config.config.get('renderer.dest')}") self._write_doc() diff --git a/ansibledoctor/doc_parser.py b/ansibledoctor/doc_parser.py index 5e32dfd3..7f79fb13 100644 --- a/ansibledoctor/doc_parser.py +++ b/ansibledoctor/doc_parser.py @@ -37,7 +37,7 @@ def _parse_var_files(self): try: raw = parse_yaml(yamlfile) except YAMLError as e: - sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message("Failed to read yaml file", path=rfile, error=e) data = defaultdict(dict, raw or {}) @@ -53,7 +53,7 @@ def _parse_meta_file(self): try: raw = parse_yaml(yamlfile) except YAMLError as e: - sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message("Failed to read yaml file", path=rfile, error=e) data = defaultdict(dict, raw) if data.get("galaxy_info"): @@ -70,7 +70,7 @@ def _parse_task_tags(self): try: raw = parse_yaml_ansible(yamlfile) except YAMLError as e: - sysexit_with_message(f"Unable to read yaml file {rfile}\n{e}") + sysexit_with_message("Failed to read yaml file", path=rfile, error=e) tags = [] for task in raw: @@ -89,7 +89,7 @@ def _populate_doc_data(self): """Generate the documentation data object.""" tags = defaultdict(dict) for annotation in self.config.get_annotations_names(automatic=True): - self.log.info(f"Finding annotations for: @{annotation}") + self.log.info(f"Lookup annotation @{annotation}") self._annotation_objs[annotation] = Annotation( name=annotation, files_registry=self._files_registry ) @@ -98,7 +98,7 @@ def _populate_doc_data(self): try: anyconfig.merge(self._data, tags, ac_merge=anyconfig.MS_DICTS) except ValueError as e: - sysexit_with_message(f"Unable to merge annotation values:\n{e}") + sysexit_with_message("Failed to merge annotation values", error=e) def get_data(self): return self._data diff --git a/ansibledoctor/file_registry.py b/ansibledoctor/file_registry.py index 548f2d69..3fc3fba6 100644 --- a/ansibledoctor/file_registry.py +++ b/ansibledoctor/file_registry.py @@ -36,19 +36,16 @@ def _scan_for_yamls(self): """ extensions = YAML_EXTENSIONS base_dir = self.config.config.base_dir - role_name = self.config.config.role_name excludes = self.config.config.get("exclude_files") excludespec = pathspec.PathSpec.from_lines("gitwildmatch", excludes) - self.log.debug(f"Scan for files: {base_dir}") + self.log.debug("Lookup role files", path=base_dir) for extension in extensions: pattern = os.path.join(base_dir, "**/*." + extension) for filename in glob.iglob(pattern, recursive=True): if not excludespec.match_file(filename): - self.log.debug( - f"Adding file to role: {role_name}: {os.path.relpath(filename, base_dir)}" - ) + self.log.debug("Found role file", path=os.path.relpath(filename, base_dir)) self._doc.append(filename) else: - self.log.debug(f"Excluding file: {os.path.relpath(filename, base_dir)}") + self.log.debug("Skippped role file", path=os.path.relpath(filename, base_dir)) diff --git a/ansibledoctor/template.py b/ansibledoctor/template.py index efe38ef3..3e5a2c67 100644 --- a/ansibledoctor/template.py +++ b/ansibledoctor/template.py @@ -68,7 +68,7 @@ def _clone_repo(self, repo_url, branch_or_tag=None): atexit.register(self._cleanup_temp_dir, temp_dir) try: - self.log.debug(f"Cloning template repo: {repo_url}") + self.log.debug("Cloning template repo", src=repo_url) repo = Repo.clone_from(repo_url, temp_dir) if branch_or_tag: self.log.debug(f"Checking out branch or tag: {branch_or_tag}") @@ -93,17 +93,17 @@ def _scan_files(self): template_files = [] if os.path.isdir(self.path): - self.log.info(f"Using template src: {self.src} name: {self.name}") + self.log.info("Lookup template files", src=self.src) else: - sysexit_with_message(f"Can not open template directory {self.path}") + sysexit_with_message("Can not open template directory", path=self.path) for file in glob.iglob(self.path + "/**/*.j2", recursive=True): relative_file = file[len(self.path) + 1 :] if ntpath.basename(file)[:1] != "_": - self.log.debug(f"Found template file: {relative_file}") + self.log.debug("Found template file", path=relative_file) template_files.append(relative_file) else: - self.log.debug(f"Ignoring template file: {relative_file}") + self.log.debug("Skipped template file", path=relative_file) return template_files diff --git a/ansibledoctor/utils/__init__.py b/ansibledoctor/utils/__init__.py index 76434a48..cb22138d 100644 --- a/ansibledoctor/utils/__init__.py +++ b/ansibledoctor/utils/__init__.py @@ -82,8 +82,8 @@ def sysexit(code=1): sys.exit(code) -def sysexit_with_message(msg, code=1): - structlog.get_logger().critical(str(msg).strip()) +def sysexit_with_message(msg, code=1, **kwargs): + structlog.get_logger().critical(str(msg).strip(), **kwargs) sysexit(code) diff --git a/ansibledoctor/utils/yamlhelper.py b/ansibledoctor/utils/yamlhelper.py index 0933b296..d7fe44bc 100644 --- a/ansibledoctor/utils/yamlhelper.py +++ b/ansibledoctor/utils/yamlhelper.py @@ -4,6 +4,7 @@ from contextlib import suppress import ruamel.yaml +import yaml from ansible.parsing.yaml.loader import AnsibleLoader import ansibledoctor.exception @@ -27,16 +28,12 @@ def parse_yaml_ansible(yamlfile): loader = AnsibleLoader(yamlfile) data = loader.get_single_data() or [] except ( - ruamel.yaml.parser.ParserError, - ruamel.yaml.scanner.ScannerError, - ruamel.yaml.constructor.ConstructorError, - ruamel.yaml.composer.ComposerError, + yaml.parser.ParserError, + yaml.scanner.ScannerError, + yaml.constructor.ConstructorError, + yaml.composer.ComposerError, ) as e: - message = ( - f"{e.context} in line {e.context_mark.line}, column {e.context_mark.line}\n" - f"{e.problem} in line {e.problem_mark.line}, column {e.problem_mark.column}" - ) - raise ansibledoctor.exception.YAMLError(message) from e + raise ansibledoctor.exception.YAMLError(e) from e return data @@ -58,11 +55,7 @@ def parse_yaml(yamlfile): ruamel.yaml.constructor.ConstructorError, ruamel.yaml.composer.ComposerError, ) as e: - message = ( - f"{e.context} in line {e.context_mark.line}, column {e.context_mark.line}\n" - f"{e.problem} in line {e.problem_mark.line}, column {e.problem_mark.column}" - ) - raise ansibledoctor.exception.YAMLError(message) from e + raise ansibledoctor.exception.YAMLError(e) from e return data diff --git a/poetry.lock b/poetry.lock index fce2ecc7..bcf2a2e5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -628,7 +628,6 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, - {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -636,16 +635,8 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, - {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, - {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, - {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, - {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, - {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -662,7 +653,6 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, - {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -670,7 +660,6 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, - {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -738,51 +727,37 @@ python-versions = ">=3.6" files = [ {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b42169467c42b692c19cf539c38d4602069d8c1505e97b86387fcf7afb766e1d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:07238db9cbdf8fc1e9de2489a4f68474e70dffcb32232db7c08fa61ca0c7c462"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:d92f81886165cb14d7b067ef37e142256f1c6a90a65cd156b063a43da1708cfd"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:fff3573c2db359f091e1589c3d7c5fc2f86f5bdb6f24252c2d8e539d4e45f412"}, - {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_24_aarch64.whl", hash = "sha256:aa2267c6a303eb483de8d02db2871afb5c5fc15618d894300b88958f729ad74f"}, - {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:840f0c7f194986a63d2c2465ca63af8ccbbc90ab1c6001b1978f05119b5e7334"}, - {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:024cfe1fc7c7f4e1aff4a81e718109e13409767e4f871443cbff3dba3578203d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win32.whl", hash = "sha256:c69212f63169ec1cfc9bb44723bf2917cbbd8f6191a00ef3410f5a7fe300722d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win_amd64.whl", hash = "sha256:cabddb8d8ead485e255fe80429f833172b4cadf99274db39abc080e068cbcc31"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b5edda50e5e9e15e54a6a8a0070302b00c518a9d32accc2346ad6c984aacd279"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b"}, - {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_24_aarch64.whl", hash = "sha256:1707814f0d9791df063f8c19bb51b0d1278b8e9a2353abbb676c2f685dee6afe"}, - {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899"}, - {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:7048c338b6c86627afb27faecf418768acb6331fc24cfa56c93e8c9780f815fa"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:1dc67314e7e1086c9fdf2680b7b6c2be1c0d8e3a8279f2e993ca2a7545fecf62"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b"}, {file = "ruamel.yaml.clib-0.2.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a5aa27bad2bb83670b71683aae140a1f52b0857a2deff56ad3f6c13a017a26ed"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c58ecd827313af6864893e7af0a3bb85fd529f862b6adbefe14643947cfe2942"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_12_0_arm64.whl", hash = "sha256:f481f16baec5290e45aebdc2a5168ebc6d35189ae6fea7a58787613a25f6e875"}, - {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_24_aarch64.whl", hash = "sha256:77159f5d5b5c14f7c34073862a6b7d34944075d9f93e681638f6d753606c6ce6"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:3fcc54cb0c8b811ff66082de1680b4b14cf8a81dce0d4fbf665c2265a81e07a1"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7f67a1ee819dc4562d444bbafb135832b0b909f81cc90f7aa00260968c9ca1b3"}, - {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:4ecbf9c3e19f9562c7fdd462e8d18dd902a47ca046a2e64dba80699f0b6c09b7"}, - {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:87ea5ff66d8064301a154b3933ae406b0863402a799b16e4a1d24d9fbbcbe0d3"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win32.whl", hash = "sha256:75e1ed13e1f9de23c5607fe6bd1aeaae21e523b32d83bb33918245361e9cc51b"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win_amd64.whl", hash = "sha256:3f215c5daf6a9d7bbed4a0a4f760f3113b10e82ff4c5c44bec20a68c8014f675"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1b617618914cb00bf5c34d4357c37aa15183fa229b24767259657746c9077615"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:a6a9ffd280b71ad062eae53ac1659ad86a17f59a0fdc7699fd9be40525153337"}, - {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_24_aarch64.whl", hash = "sha256:305889baa4043a09e5b76f8e2a51d4ffba44259f6b4c72dec8ca56207d9c6fe1"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:665f58bfd29b167039f714c6998178d27ccd83984084c286110ef26b230f259f"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:700e4ebb569e59e16a976857c8798aee258dceac7c7d6b50cab63e080058df91"}, - {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:e2b4c44b60eadec492926a7270abb100ef9f72798e18743939bdbf037aab8c28"}, - {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e79e5db08739731b0ce4850bed599235d601701d5694c36570a99a0c5ca41a9d"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win32.whl", hash = "sha256:955eae71ac26c1ab35924203fda6220f84dce57d6d7884f189743e2abe3a9fbe"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win_amd64.whl", hash = "sha256:56f4252222c067b4ce51ae12cbac231bce32aee1d33fbfc9d17e5b8d6966c312"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03d1162b6d1df1caa3a4bd27aa51ce17c9afc2046c31b0ad60a0a96ec22f8001"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:bba64af9fa9cebe325a62fa398760f5c7206b215201b0ec825005f1b18b9bccf"}, - {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_24_aarch64.whl", hash = "sha256:a1a45e0bb052edf6a1d3a93baef85319733a888363938e1fc9924cb00c8df24c"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:9eb5dee2772b0f704ca2e45b1713e4e5198c18f515b52743576d196348f374d3"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:da09ad1c359a728e112d60116f626cc9f29730ff3e0e7db72b9a2dbc2e4beed5"}, - {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:184565012b60405d93838167f425713180b949e9d8dd0bbc7b49f074407c5a8b"}, - {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a75879bacf2c987c003368cf14bed0ffe99e8e85acfa6c0bfffc21a090f16880"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win32.whl", hash = "sha256:84b554931e932c46f94ab306913ad7e11bba988104c5cff26d90d03f68258cd5"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win_amd64.whl", hash = "sha256:25ac8c08322002b06fa1d49d1646181f0b2c72f5cbc15a85e80b4c30a544bb15"}, {file = "ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512"}, From 8daf78b66bf1ccbf4c18d25cd167ec8eacac35be Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 16 Jun 2024 21:26:54 +0200 Subject: [PATCH 4/5] cleanup --- ansibledoctor/annotation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansibledoctor/annotation.py b/ansibledoctor/annotation.py index 56914848..de6560b1 100644 --- a/ansibledoctor/annotation.py +++ b/ansibledoctor/annotation.py @@ -171,15 +171,15 @@ def _get_annotation_data(self, num, line, name, rfile): if parts[2].startswith("$"): source = "".join([x.strip() for x in multiline]) - multiline = self._str_to_json(key, source, rfile, num, line) + multiline = self._str_to_json(key, source, rfile, num) item.data[key][parts[1]] = multiline return item - def _str_to_json(self, key, string, rfile, num, line): + def _str_to_json(self, key, string, rfile, num): try: return {key: json.loads(string)} except ValueError: sysexit_with_message( - f"ValueError: Failed to parse json in {rfile}:{num!s}", src=line.strip() + f"ValueError: Failed to parse json in {rfile}:{num!s}", file=rfile ) From 657555bf649e728e7956fce45d75dcf6cf8d7de2 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 17 Jun 2024 11:33:57 +0200 Subject: [PATCH 5/5] cleanup --- poetry.lock | 74 +++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/poetry.lock b/poetry.lock index bcf2a2e5..4bd4c80b 100644 --- a/poetry.lock +++ b/poetry.lock @@ -581,41 +581,6 @@ pytest = ">=6.2.5" [package.extras] dev = ["pre-commit", "pytest-asyncio", "tox"] -[[package]] -name = "python-dotenv" -version = "1.0.1" -description = "Read key-value pairs from a .env file and set them as environment variables" -optional = false -python-versions = ">=3.8" -files = [ - {file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"}, - {file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"}, -] - -[package.extras] -cli = ["click (>=5.0)"] - -[[package]] -name = "python-json-logger" -version = "3.1.0" -description = "JSON Log Formatter for the Python Logging Package" -optional = false -python-versions = ">=3.8" -files = [] -develop = false - -[package.dependencies] -typing_extensions = "*" - -[package.extras] -dev = ["backports.zoneinfo", "black", "build", "freezegun", "mdx_truly_sane_lists", "mike", "mkdocs", "mkdocs-awesome-pages-plugin", "mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-material (>=8.5)", "mkdocstrings[python]", "msgspec", "mypy", "orjson", "pylint", "pytest", "tzdata", "validate-pyproject[all]"] - -[package.source] -type = "git" -url = "https://github.com/nhairs/python-json-logger.git" -reference = "v3.1.0" -resolved_reference = "e2b40e420f4181fd921b01a2fd0b23ca82b5fc9b" - [[package]] name = "pyyaml" version = "6.0.1" @@ -628,6 +593,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -635,8 +601,16 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -653,6 +627,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -660,6 +635,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -727,37 +703,51 @@ python-versions = ">=3.6" files = [ {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b42169467c42b692c19cf539c38d4602069d8c1505e97b86387fcf7afb766e1d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-macosx_13_0_arm64.whl", hash = "sha256:07238db9cbdf8fc1e9de2489a4f68474e70dffcb32232db7c08fa61ca0c7c462"}, - {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:d92f81886165cb14d7b067ef37e142256f1c6a90a65cd156b063a43da1708cfd"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:fff3573c2db359f091e1589c3d7c5fc2f86f5bdb6f24252c2d8e539d4e45f412"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-manylinux_2_24_aarch64.whl", hash = "sha256:aa2267c6a303eb483de8d02db2871afb5c5fc15618d894300b88958f729ad74f"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:840f0c7f194986a63d2c2465ca63af8ccbbc90ab1c6001b1978f05119b5e7334"}, + {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:024cfe1fc7c7f4e1aff4a81e718109e13409767e4f871443cbff3dba3578203d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win32.whl", hash = "sha256:c69212f63169ec1cfc9bb44723bf2917cbbd8f6191a00ef3410f5a7fe300722d"}, {file = "ruamel.yaml.clib-0.2.8-cp310-cp310-win_amd64.whl", hash = "sha256:cabddb8d8ead485e255fe80429f833172b4cadf99274db39abc080e068cbcc31"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:bef08cd86169d9eafb3ccb0a39edb11d8e25f3dae2b28f5c52fd997521133069"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:b16420e621d26fdfa949a8b4b47ade8810c56002f5389970db4ddda51dbff248"}, - {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b5edda50e5e9e15e54a6a8a0070302b00c518a9d32accc2346ad6c984aacd279"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:25c515e350e5b739842fc3228d662413ef28f295791af5e5110b543cf0b57d9b"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-manylinux_2_24_aarch64.whl", hash = "sha256:1707814f0d9791df063f8c19bb51b0d1278b8e9a2353abbb676c2f685dee6afe"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:46d378daaac94f454b3a0e3d8d78cafd78a026b1d71443f4966c696b48a6d899"}, + {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:09b055c05697b38ecacb7ac50bdab2240bfca1a0c4872b0fd309bb07dc9aa3a9"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win32.whl", hash = "sha256:53a300ed9cea38cf5a2a9b069058137c2ca1ce658a874b79baceb8f892f915a7"}, {file = "ruamel.yaml.clib-0.2.8-cp311-cp311-win_amd64.whl", hash = "sha256:c2a72e9109ea74e511e29032f3b670835f8a59bbdc9ce692c5b4ed91ccf1eedb"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:ebc06178e8821efc9692ea7544aa5644217358490145629914d8020042c24aa1"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:edaef1c1200c4b4cb914583150dcaa3bc30e592e907c01117c08b13a07255ec2"}, - {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux2014_aarch64.whl", hash = "sha256:7048c338b6c86627afb27faecf418768acb6331fc24cfa56c93e8c9780f815fa"}, {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d176b57452ab5b7028ac47e7b3cf644bcfdc8cacfecf7e71759f7f51a59e5c92"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-manylinux_2_24_aarch64.whl", hash = "sha256:1dc67314e7e1086c9fdf2680b7b6c2be1c0d8e3a8279f2e993ca2a7545fecf62"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:3213ece08ea033eb159ac52ae052a4899b56ecc124bb80020d9bbceeb50258e9"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:aab7fd643f71d7946f2ee58cc88c9b7bfc97debd71dcc93e03e2d174628e7e2d"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win32.whl", hash = "sha256:5c365d91c88390c8d0a8545df0b5857172824b1c604e867161e6b3d59a827eaa"}, + {file = "ruamel.yaml.clib-0.2.8-cp312-cp312-win_amd64.whl", hash = "sha256:1758ce7d8e1a29d23de54a16ae867abd370f01b5a69e1a3ba75223eaa3ca1a1b"}, {file = "ruamel.yaml.clib-0.2.8-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:a5aa27bad2bb83670b71683aae140a1f52b0857a2deff56ad3f6c13a017a26ed"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c58ecd827313af6864893e7af0a3bb85fd529f862b6adbefe14643947cfe2942"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-macosx_12_0_arm64.whl", hash = "sha256:f481f16baec5290e45aebdc2a5168ebc6d35189ae6fea7a58787613a25f6e875"}, - {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:3fcc54cb0c8b811ff66082de1680b4b14cf8a81dce0d4fbf665c2265a81e07a1"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_24_aarch64.whl", hash = "sha256:77159f5d5b5c14f7c34073862a6b7d34944075d9f93e681638f6d753606c6ce6"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:7f67a1ee819dc4562d444bbafb135832b0b909f81cc90f7aa00260968c9ca1b3"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:4ecbf9c3e19f9562c7fdd462e8d18dd902a47ca046a2e64dba80699f0b6c09b7"}, + {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:87ea5ff66d8064301a154b3933ae406b0863402a799b16e4a1d24d9fbbcbe0d3"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win32.whl", hash = "sha256:75e1ed13e1f9de23c5607fe6bd1aeaae21e523b32d83bb33918245361e9cc51b"}, {file = "ruamel.yaml.clib-0.2.8-cp37-cp37m-win_amd64.whl", hash = "sha256:3f215c5daf6a9d7bbed4a0a4f760f3113b10e82ff4c5c44bec20a68c8014f675"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1b617618914cb00bf5c34d4357c37aa15183fa229b24767259657746c9077615"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-macosx_12_0_arm64.whl", hash = "sha256:a6a9ffd280b71ad062eae53ac1659ad86a17f59a0fdc7699fd9be40525153337"}, - {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:665f58bfd29b167039f714c6998178d27ccd83984084c286110ef26b230f259f"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_24_aarch64.whl", hash = "sha256:305889baa4043a09e5b76f8e2a51d4ffba44259f6b4c72dec8ca56207d9c6fe1"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:700e4ebb569e59e16a976857c8798aee258dceac7c7d6b50cab63e080058df91"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:e2b4c44b60eadec492926a7270abb100ef9f72798e18743939bdbf037aab8c28"}, + {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:e79e5db08739731b0ce4850bed599235d601701d5694c36570a99a0c5ca41a9d"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win32.whl", hash = "sha256:955eae71ac26c1ab35924203fda6220f84dce57d6d7884f189743e2abe3a9fbe"}, {file = "ruamel.yaml.clib-0.2.8-cp38-cp38-win_amd64.whl", hash = "sha256:56f4252222c067b4ce51ae12cbac231bce32aee1d33fbfc9d17e5b8d6966c312"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:03d1162b6d1df1caa3a4bd27aa51ce17c9afc2046c31b0ad60a0a96ec22f8001"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-macosx_12_0_arm64.whl", hash = "sha256:bba64af9fa9cebe325a62fa398760f5c7206b215201b0ec825005f1b18b9bccf"}, - {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:9eb5dee2772b0f704ca2e45b1713e4e5198c18f515b52743576d196348f374d3"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_24_aarch64.whl", hash = "sha256:a1a45e0bb052edf6a1d3a93baef85319733a888363938e1fc9924cb00c8df24c"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:da09ad1c359a728e112d60116f626cc9f29730ff3e0e7db72b9a2dbc2e4beed5"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:184565012b60405d93838167f425713180b949e9d8dd0bbc7b49f074407c5a8b"}, + {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a75879bacf2c987c003368cf14bed0ffe99e8e85acfa6c0bfffc21a090f16880"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win32.whl", hash = "sha256:84b554931e932c46f94ab306913ad7e11bba988104c5cff26d90d03f68258cd5"}, {file = "ruamel.yaml.clib-0.2.8-cp39-cp39-win_amd64.whl", hash = "sha256:25ac8c08322002b06fa1d49d1646181f0b2c72f5cbc15a85e80b4c30a544bb15"}, {file = "ruamel.yaml.clib-0.2.8.tar.gz", hash = "sha256:beb2e0404003de9a4cab9753a8805a8fe9320ee6673136ed7f04255fe60bb512"}, @@ -845,4 +835,4 @@ ansible-core = ["ansible-core"] [metadata] lock-version = "2.0" python-versions = "^3.9.0" -content-hash = "5f15bfc588e9148886e7499f46e2da42bdf381f537ba118ce6187d358922ed79" +content-hash = "bf88dff6070204056a2c1c15172585388329d54aa2eebdc2ff909cd3f8a412ab"