From 0d092851bfd9d0c571d6f7cc581b90618cabac71 Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Mon, 9 Jan 2023 17:10:08 +0200 Subject: [PATCH] docs & faq update --- Dockerfile | 1 + docker/entrypoint.sh | 3 +++ docs/configuration.rst | 8 ++++++++ docs/faq.rst | 30 +++++++++++++++++++++++++++++- 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 551c3f1e..a2d1ec12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,7 @@ ENV AHRIMAN_REPOSITORY="aur-clone" ENV AHRIMAN_REPOSITORY_ROOT="/var/lib/ahriman/ahriman" ENV AHRIMAN_UNIX_SOCKET="" ENV AHRIMAN_USER="ahriman" +ENV AHRIMAN_VALIDATE_CONFIGURATION="" # install environment ## update pacman.conf with multilib diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index cd4f7192..1bfec206 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -47,6 +47,9 @@ if [ -n "$AHRIMAN_UNIX_SOCKET" ]; then fi ahriman "${AHRIMAN_DEFAULT_ARGS[@]}" repo-setup "${AHRIMAN_SETUP_ARGS[@]}" +# validate configuration if set +[ -n "$AHRIMAN_VALIDATE_CONFIGURATION" ] && ahriman "${AHRIMAN_DEFAULT_ARGS[@]}" repo-config-validate --exit-code + # create machine-id which is required by build tools systemd-machine-id-setup &> /dev/null diff --git a/docs/configuration.rst b/docs/configuration.rst index 74294e44..5e4977c5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -12,6 +12,14 @@ There are two variable types which have been added to default ones, they are pat Path values, except for casting to ``pathlib.Path`` type, will be also expanded to absolute paths relative to the configuration path. E.g. if path is set to ``ahriman.ini.d/logging.ini`` and root configuration path is ``/etc/ahriman.ini``, the value will be expanded to ``/etc/ahriman.ini.d/logging.ini``. In order to disable path expand, use the full path, e.g. ``/etc/ahriman.ini.d/logging.ini``. +There is also additional subcommand which will allow to validate configuration and print found errors. In order to do so, run ``repo-config-validate`` subcommand, e.g.: + +.. code-block:: shell + + ahriman -a x86_64 repo-config-validate + +It will check current settings on common errors and compare configuration with known schema. + ``settings`` group ------------------ diff --git a/docs/faq.rst b/docs/faq.rst index 63ef35bf..1530ac23 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -26,6 +26,33 @@ Long answer The idea is to install the package as usual, create working directory tree, create configuration for ``sudo`` and ``devtools``. Detailed description of the setup instruction can be found :doc:`here `. +How to validate settings +^^^^^^^^^^^^^^^^^^^^^^^^ + +There is special command which can be used in order to validate current configuration: + +.. code-block:: shell + + ahriman -a x86_64 repo-config-validate --exit-code + +This command will print found errors, based on `cerberus `_, e.g.: + +.. code-block:: shell + + auth + ssalt: unknown field + target: none or more than one rule validate + oneof definition 0: unallowed value mapping + oneof definition 1: field 'salt' is required + oneof definition 2: unallowed value mapping + oneof definition 2: field 'salt' is required + oneof definition 2: field 'client_id' is required + oneof definition 2: field 'client_secret' is required + gitremote + pull_url: unknown field + +If an additional flag ``--exit-code`` is supplied, the application will return non-zero exit code, which can be used partially in scripts. + What does "architecture specific" mean / How to configure for different architectures ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -392,7 +419,8 @@ The following environment variables are supported: * ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur-clone``. * ``AHRIMAN_REPOSITORY_ROOT`` - repository root. Because of filesystem rights it is required to override default repository root. By default, it uses ``ahriman`` directory inside ahriman's home, which can be passed as mount volume. * ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside ``AHRIMAN_REPOSITORY_ROOT`` directory (e.g. ``/var/lib/ahriman/ahriman/ahriman-web.sock``) or to ``/tmp``. -* ``AHRIMAN_USER`` - ahriman user, usually must not be overwritten, default is ``ahriman``. +* ``AHRIMAN_USER`` - ahriman user, usually must not be overwritten, default is ``ahriman``. +* ``AHRIMAN_VALIDATE_CONFIGURATION`` - if set validate service configuration You can pass any of these variables by using ``-e`` argument, e.g.: