autogenerate docs
This commit is contained in:
parent
771a474b4f
commit
db1379631f
16 changed files with 1078 additions and 175 deletions
|
@ -4,6 +4,7 @@
|
|||
__all__ = [
|
||||
"common",
|
||||
"docker_volume_backupper",
|
||||
"homepage",
|
||||
"traefik_middleware",
|
||||
"traefik_router",
|
||||
"traefik_service",
|
||||
|
@ -12,6 +13,7 @@ __all__ = [
|
|||
from . import (
|
||||
common,
|
||||
docker_volume_backupper,
|
||||
homepage,
|
||||
traefik_middleware,
|
||||
traefik_router,
|
||||
traefik_service,
|
||||
|
|
|
@ -8,6 +8,20 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Configuration for docker_volume_backupper labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
stop:
|
||||
description:
|
||||
- If true, stop the container when backing up.
|
||||
type: bool
|
||||
required: true
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"stop": {"type": "bool", "required": True},
|
||||
}
|
||||
|
|
86
plugins/module_utils/label/homepage.py
Normal file
86
plugins/module_utils/label/homepage.py
Normal file
|
@ -0,0 +1,86 @@
|
|||
# Copyright: (c) 2025, Luca Bilke <luca@bil.ke>
|
||||
# MIT License (see LICENSE)
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
homepage:
|
||||
description:
|
||||
- Configuration for homepage labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name to set on dashboard.
|
||||
- Defaults to name of service.
|
||||
type: str
|
||||
href:
|
||||
description:
|
||||
- HREF to set on dashboard.
|
||||
type: str
|
||||
icon:
|
||||
description:
|
||||
- URL to an image to use as icon.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- Description text to set on dashboard.
|
||||
type: str
|
||||
group:
|
||||
description:
|
||||
- Group to place service under on dashboard.
|
||||
type: str
|
||||
widget:
|
||||
description:
|
||||
- Widget configuration.
|
||||
- See U(https://gethomepage.dev/configs/services/) for more info.
|
||||
type: dict
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"name": {"type": "str"},
|
||||
"href": {"type": "str"},
|
||||
"icon": {"type": "str"},
|
||||
"description": {"type": "str"},
|
||||
"group": {"type": "str"},
|
||||
"widget": {"type": "dict"},
|
||||
}
|
||||
|
||||
|
||||
def helper(_state: State, service_name: str, params: dict[str, Any]) -> dict[str, Any]:
|
||||
name: str = params.get("name", service_name)
|
||||
href: str | None = params.get("href")
|
||||
icon: str | None = params.get("icon")
|
||||
description: str | None = params.get("description")
|
||||
group: str | None = params.get("group")
|
||||
widget: dict[str, str] | None = params.get("widget")
|
||||
|
||||
labels: dict[str, Any] = {
|
||||
"homepage.name": name,
|
||||
}
|
||||
|
||||
if href:
|
||||
labels["homepage.href"] = href
|
||||
|
||||
if icon:
|
||||
labels["homepage.icon"] = icon
|
||||
|
||||
if description:
|
||||
labels["homepage.description"] = description
|
||||
|
||||
if group:
|
||||
labels["homepage.group"] = group
|
||||
|
||||
if widget:
|
||||
for k, v in widget.items():
|
||||
labels[f"homepage.widget.{k}"] = v
|
||||
|
||||
return {
|
||||
"labels": labels,
|
||||
}
|
|
@ -8,10 +8,39 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
traefik_middleware:
|
||||
description:
|
||||
- Configuration for traefik_middleware labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
middleware:
|
||||
description:
|
||||
- The name of the traefik middleware to use.
|
||||
type: str
|
||||
required: true
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
settings:
|
||||
description:
|
||||
- Middleware options.
|
||||
type: dict
|
||||
required: true
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"proxy_type": {"type": "str", "default": "http"},
|
||||
"name": {"type": "str"},
|
||||
"middleware": {"type": "str", "required": True},
|
||||
"proxy_type": {"type": "str", "default": "http"},
|
||||
"settings": {"type": "dict", "required": True},
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,48 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
traefik_router:
|
||||
description:
|
||||
- Configuration for traefik_router labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
rule:
|
||||
description:
|
||||
- Routing rule to match.
|
||||
type: str
|
||||
required: true
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
service:
|
||||
description:
|
||||
- Traefik service to point at.
|
||||
type: str
|
||||
certresolver:
|
||||
description:
|
||||
- Certresolver to use.
|
||||
type: str
|
||||
entrypoints:
|
||||
description:
|
||||
- Entrypoints to listen on.
|
||||
type: list
|
||||
elements: str
|
||||
middlewares:
|
||||
description:
|
||||
- Middlewares to use.
|
||||
type: list
|
||||
elements: str
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"name": {"type": "str"},
|
||||
"rule": {"type": "str", "required": True},
|
||||
|
|
|
@ -8,9 +8,36 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
traefik_service:
|
||||
description:
|
||||
- Configuration for traefik_service labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
port:
|
||||
description:
|
||||
- Port to forward to.
|
||||
type: int
|
||||
protocol_version:
|
||||
description:
|
||||
- Proxy protocol version to use (TCP only).
|
||||
type: int
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"proxy_type": {"type": "str", "default": "http"},
|
||||
"name": {"type": "str"},
|
||||
"proxy_type": {"type": "str", "default": "http"},
|
||||
"port": {"type": "int"},
|
||||
"protocol_version": {"type": "int"},
|
||||
}
|
||||
|
|
|
@ -12,6 +12,17 @@ from ansible_collections.snailed.ez_docker.plugins.module_utils.common import re
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
BASE_DOCUMENTATION = """
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
"""
|
||||
|
||||
BASE_ARGS: dict[str, Any] = {
|
||||
"name": {"type": "str"},
|
||||
"overwrite": {"type": "dict"},
|
||||
|
|
|
@ -10,6 +10,30 @@ from ansible_collections.snailed.ez_docker.plugins.module_utils import label, sp
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
custom:
|
||||
description:
|
||||
- Configuration for custom service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service
|
||||
type: str
|
||||
required: true
|
||||
definition:
|
||||
description:
|
||||
- Service definition
|
||||
type: dict
|
||||
required: true
|
||||
label_helpers:
|
||||
description:
|
||||
- Label helper configurations
|
||||
type: dict
|
||||
suboptions:
|
||||
""" # NOTE: label helpers are added programatically
|
||||
|
||||
FORCE_ARGS = {
|
||||
"name": {"type": "str", "required": True},
|
||||
"definition": {"type": "dict", "required": True},
|
||||
|
|
|
@ -8,13 +8,18 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
|
||||
DOCUMENTATION = """
|
||||
docker_in_docker:
|
||||
description:
|
||||
- Configuration for docker_in_docker service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {}
|
||||
|
||||
|
||||
def helper(_state: State, _params: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"privileged": True,
|
||||
"networks": {
|
||||
"internal": {}
|
||||
}
|
||||
}
|
||||
return {"privileged": True, "networks": {"internal": {}}}
|
||||
|
|
|
@ -8,6 +8,21 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
|
||||
DOCUMENTATION = """
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Configuration for docker_socket_proxy service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
read_only:
|
||||
description:
|
||||
- If true, only allow read access to the docker socket.
|
||||
type: bool
|
||||
required: true
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"read_only": {"type": "bool", "required": True},
|
||||
}
|
||||
|
@ -25,9 +40,4 @@ def helper(_state: State, params: dict[str, Any]) -> dict[str, Any]:
|
|||
},
|
||||
]
|
||||
|
||||
return {
|
||||
"volumes": volumes,
|
||||
"networks": {
|
||||
"internal": {}
|
||||
}
|
||||
}
|
||||
return {"volumes": volumes, "networks": {"internal": {}}}
|
||||
|
|
|
@ -8,12 +8,36 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"archive": {"type": "path"},
|
||||
"backup_volumes": {"type": "list", "elements": "str", "required": True},
|
||||
"docker_socket_proxy": {"type": "str"},
|
||||
}
|
||||
|
||||
DOCUMENTATION = """
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Configuration for docker_volume_backupper service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
archive:
|
||||
description:
|
||||
- Directory to store backups in.
|
||||
type: path
|
||||
backup_volumes:
|
||||
description:
|
||||
- List of volume names of volumes to backup.
|
||||
type: list
|
||||
elements: str
|
||||
required: true
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Hostname of a docker socket proxy to use.
|
||||
type: str
|
||||
"""
|
||||
|
||||
|
||||
def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
||||
project_name: str = state.params["name"]
|
||||
|
@ -36,7 +60,6 @@ def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
|||
"BACKUP_LATEST_SYMLINK": f"{project_name}-latest",
|
||||
"BACKUP_PRUNING_PREFIX": f"{project_name}-",
|
||||
"BACKUP_STOP_DURING_BACKUP_LABEL": project_name,
|
||||
# "DOCKER_HOST": f"tcp://{project_name}_{service_name}_socket_proxy:2375",
|
||||
}
|
||||
|
||||
if socket_proxy:
|
||||
|
|
|
@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
|
||||
EXTRA_ARGS = {
|
||||
"backup": {"type": "bool", "default": True},
|
||||
"database": {"type": "str", "required": True},
|
||||
|
@ -17,6 +18,39 @@ EXTRA_ARGS = {
|
|||
"root_password": {"type": "str"},
|
||||
}
|
||||
|
||||
DOCUMENTATION = """
|
||||
mariadb:
|
||||
description:
|
||||
- Configuration for mariadb service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
default: true
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
type: str
|
||||
required: true
|
||||
username:
|
||||
description:
|
||||
- Username for database.
|
||||
type: str
|
||||
required: true
|
||||
password:
|
||||
description:
|
||||
- Password for database.
|
||||
type: str
|
||||
required: true
|
||||
root_password:
|
||||
description:
|
||||
- Root password for database.
|
||||
type: str
|
||||
"""
|
||||
|
||||
|
||||
def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
||||
project_name: str = state.params["name"]
|
||||
|
@ -76,7 +110,5 @@ def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
|||
"environment": environment,
|
||||
"volumes": volumes,
|
||||
"labels": labels,
|
||||
"networks": {
|
||||
"internal": {}
|
||||
}
|
||||
"networks": {"internal": {}},
|
||||
}
|
||||
|
|
|
@ -16,6 +16,35 @@ EXTRA_ARGS = {
|
|||
"password": {"type": "str", "required": True},
|
||||
}
|
||||
|
||||
DOCUMENTATION = """
|
||||
postgres:
|
||||
description:
|
||||
- Configuration for postgres service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
default: true
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
type: str
|
||||
required: true
|
||||
username:
|
||||
description:
|
||||
- Username for database.
|
||||
type: str
|
||||
required: true
|
||||
password:
|
||||
description:
|
||||
- Password for database.
|
||||
type: str
|
||||
required: true
|
||||
"""
|
||||
|
||||
|
||||
def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
||||
project_name: str = state.params["name"]
|
||||
|
@ -67,7 +96,5 @@ def helper(state: State, params: dict[str, Any]) -> dict[str, Any]:
|
|||
"environment": environment,
|
||||
"volumes": volumes,
|
||||
"labels": labels,
|
||||
"networks": {
|
||||
"internal": {}
|
||||
}
|
||||
"networks": {"internal": {}},
|
||||
}
|
||||
|
|
|
@ -8,6 +8,15 @@ from typing import TYPE_CHECKING, Any
|
|||
if TYPE_CHECKING:
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils.models import State
|
||||
|
||||
DOCUMENTATION = """
|
||||
redis:
|
||||
description:
|
||||
- Configuration for redis service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
"""
|
||||
|
||||
EXTRA_ARGS = {}
|
||||
|
||||
|
||||
|
|
|
@ -5,23 +5,16 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
# WARN: This documentation is out of date
|
||||
# TODO: break this down per module
|
||||
# TODO: generate this by reassembling
|
||||
# TODO: add note about not setting container_name or host_name in defaults
|
||||
DOCUMENTATION = """
|
||||
---
|
||||
module: compose
|
||||
version_added: 1.0.0
|
||||
short_description: Simplify docker-compose deployments
|
||||
short_description: Simplify docker-compose deployments.
|
||||
description: Easily create docker-compose files using a single module
|
||||
seealso:
|
||||
- name: Compose file reference
|
||||
description: Complete reference of the compose file spec.
|
||||
link: https://docs.docker.com/reference/compose-file/
|
||||
description:
|
||||
- Easily create docker-compose files using a single module
|
||||
author:
|
||||
- "Luca Bilke (@ssnailed)"
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
|
@ -68,27 +61,27 @@ options:
|
|||
type: dict
|
||||
docker_in_docker:
|
||||
description:
|
||||
- Default definitions for docker in docker services.
|
||||
- Default definitions for docker_in_docker services.
|
||||
type: dict
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Default definitions for docker socket proxy services.
|
||||
- Default definitions for docker_socket_proxy services.
|
||||
type: dict
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Default definitions for docker volume backupper services.
|
||||
- Default definitions for docker_volume_backupper services.
|
||||
type: dict
|
||||
mariadb:
|
||||
description:
|
||||
- Default definitions for MariaDB services.
|
||||
- Default definitions for mariadb services.
|
||||
type: dict
|
||||
postgres:
|
||||
description:
|
||||
- Default definitions for PostgreSQL services.
|
||||
- Default definitions for postgres services.
|
||||
type: dict
|
||||
redis:
|
||||
description:
|
||||
- Default definitions for Redis services.
|
||||
- Default definitions for redis services.
|
||||
type: dict
|
||||
service_default_args:
|
||||
description:
|
||||
|
@ -97,32 +90,285 @@ options:
|
|||
suboptions:
|
||||
custom:
|
||||
description:
|
||||
- Default args for custom services.
|
||||
type: dict
|
||||
- Configuration for custom service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service
|
||||
type: str
|
||||
definition:
|
||||
description:
|
||||
- Service definition
|
||||
type: dict
|
||||
label_helpers:
|
||||
description:
|
||||
- Label helper configurations
|
||||
type: dict
|
||||
suboptions:
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Configuration for docker_volume_backupper labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
stop:
|
||||
description:
|
||||
- If true, stop the container when backing up.
|
||||
type: bool
|
||||
homepage:
|
||||
description:
|
||||
- Configuration for homepage labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name to set on dashboard.
|
||||
- Defaults to name of service.
|
||||
type: str
|
||||
href:
|
||||
description:
|
||||
- HREF to set on dashboard.
|
||||
type: str
|
||||
icon:
|
||||
description:
|
||||
- URL to an image to use as icon.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- Description text to set on dashboard.
|
||||
type: str
|
||||
group:
|
||||
description:
|
||||
- Group to place service under on dashboard.
|
||||
type: str
|
||||
widget:
|
||||
description:
|
||||
- Widget configuration.
|
||||
- See U(https://gethomepage.dev/configs/services/) for more info.
|
||||
type: dict
|
||||
traefik_middleware:
|
||||
description:
|
||||
- Configuration for traefik_middleware labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
middleware:
|
||||
description:
|
||||
- The name of the traefik middleware to use.
|
||||
type: str
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
settings:
|
||||
description:
|
||||
- Middleware options.
|
||||
type: dict
|
||||
traefik_router:
|
||||
description:
|
||||
- Configuration for traefik_router labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
rule:
|
||||
description:
|
||||
- Routing rule to match.
|
||||
type: str
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
service:
|
||||
description:
|
||||
- Traefik service to point at.
|
||||
type: str
|
||||
certresolver:
|
||||
description:
|
||||
- Certresolver to use.
|
||||
type: str
|
||||
entrypoints:
|
||||
description:
|
||||
- Entrypoints to listen on.
|
||||
type: list
|
||||
elements: str
|
||||
middlewares:
|
||||
description:
|
||||
- Middlewares to use.
|
||||
type: list
|
||||
elements: str
|
||||
traefik_service:
|
||||
description:
|
||||
- Configuration for traefik_service labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
port:
|
||||
description:
|
||||
- Port to forward to.
|
||||
type: int
|
||||
protocol_version:
|
||||
description:
|
||||
- Proxy protocol version to use (TCP only).
|
||||
type: int
|
||||
docker_in_docker:
|
||||
description:
|
||||
- Default args for docker in docker services.
|
||||
type: dict
|
||||
- Configuration for docker_in_docker service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Default args for docker socket proxy services.
|
||||
type: dict
|
||||
- Configuration for docker_socket_proxy service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
read_only:
|
||||
description:
|
||||
- If true, only allow read access to the docker socket.
|
||||
type: bool
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Default args for docker volume backupper services.
|
||||
type: dict
|
||||
- Configuration for docker_volume_backupper service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
archive:
|
||||
description:
|
||||
- Directory to store backups in.
|
||||
type: path
|
||||
backup_volumes:
|
||||
description:
|
||||
- List of volume names of volumes to backup.
|
||||
type: list
|
||||
elements: str
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Hostname of a docker socket proxy to use.
|
||||
type: str
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
mariadb:
|
||||
description:
|
||||
- Default args for MariaDB services.
|
||||
type: dict
|
||||
- Configuration for mariadb service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- Username for database.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for database.
|
||||
type: str
|
||||
root_password:
|
||||
description:
|
||||
- Root password for database.
|
||||
type: str
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
postgres:
|
||||
description:
|
||||
- Default args for PostgreSQL services.
|
||||
type: dict
|
||||
- Configuration for postgres service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
type: str
|
||||
username:
|
||||
description:
|
||||
- Username for database.
|
||||
type: str
|
||||
password:
|
||||
description:
|
||||
- Password for database.
|
||||
type: str
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
redis:
|
||||
description:
|
||||
- Default args for Redis services.
|
||||
type: dict
|
||||
- Configuration for redis service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
label_default_args:
|
||||
description:
|
||||
- Default arguments for each label helper.
|
||||
|
@ -130,20 +376,129 @@ options:
|
|||
suboptions:
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Docker Volume Backupper label helper configuration.
|
||||
type: dict
|
||||
- Configuration for docker_volume_backupper labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
stop:
|
||||
description:
|
||||
- If true, stop the container when backing up.
|
||||
type: bool
|
||||
homepage:
|
||||
description:
|
||||
- Configuration for homepage labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name to set on dashboard.
|
||||
- Defaults to name of service.
|
||||
type: str
|
||||
href:
|
||||
description:
|
||||
- HREF to set on dashboard.
|
||||
type: str
|
||||
icon:
|
||||
description:
|
||||
- URL to an image to use as icon.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- Description text to set on dashboard.
|
||||
type: str
|
||||
group:
|
||||
description:
|
||||
- Group to place service under on dashboard.
|
||||
type: str
|
||||
widget:
|
||||
description:
|
||||
- Widget configuration.
|
||||
- See U(https://gethomepage.dev/configs/services/) for more info.
|
||||
type: dict
|
||||
traefik_middleware:
|
||||
description:
|
||||
- Traefik Middleware label helper configuration.
|
||||
type: dict
|
||||
- Configuration for traefik_middleware labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
middleware:
|
||||
description:
|
||||
- The name of the traefik middleware to use.
|
||||
type: str
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
settings:
|
||||
description:
|
||||
- Middleware options.
|
||||
type: dict
|
||||
traefik_router:
|
||||
description:
|
||||
- Traefik Router label helper configuration.
|
||||
type: dict
|
||||
- Configuration for traefik_router labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
rule:
|
||||
description:
|
||||
- Routing rule to match.
|
||||
type: str
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
service:
|
||||
description:
|
||||
- Traefik service to point at.
|
||||
type: str
|
||||
certresolver:
|
||||
description:
|
||||
- Certresolver to use.
|
||||
type: str
|
||||
entrypoints:
|
||||
description:
|
||||
- Entrypoints to listen on.
|
||||
type: list
|
||||
elements: str
|
||||
middlewares:
|
||||
description:
|
||||
- Middlewares to use.
|
||||
type: list
|
||||
elements: str
|
||||
traefik_service:
|
||||
description:
|
||||
- Traefik Service label helper configuration.
|
||||
type: dict
|
||||
- Configuration for traefik_service labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
port:
|
||||
description:
|
||||
- Port to forward to.
|
||||
type: int
|
||||
protocol_version:
|
||||
description:
|
||||
- Proxy protocol version to use (TCP only).
|
||||
type: int
|
||||
services:
|
||||
description:
|
||||
- Services to create in the project.
|
||||
|
@ -151,27 +506,28 @@ options:
|
|||
suboptions:
|
||||
custom:
|
||||
description:
|
||||
- Custom service definition.
|
||||
- Configuration for custom service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
- Name of the service
|
||||
type: str
|
||||
required: true
|
||||
definition:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Service definition
|
||||
type: dict
|
||||
required: true
|
||||
label_helpers:
|
||||
description:
|
||||
- Label helper configurations.
|
||||
- Label helper configurations
|
||||
type: dict
|
||||
suboptions:
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Docker Volume Backupper label helper configuration.
|
||||
- Configuration for docker_volume_backupper labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
|
@ -179,45 +535,67 @@ options:
|
|||
description:
|
||||
- If true, stop the container when backing up.
|
||||
type: bool
|
||||
default: true
|
||||
traefik_middleware:
|
||||
homepage:
|
||||
description:
|
||||
- Traefik Middleware label helper configuration.
|
||||
- Configuration for homepage labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
proxy_type:
|
||||
name:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
- Name to set on dashboard.
|
||||
- Defaults to name of service.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
href:
|
||||
description:
|
||||
- HREF to set on dashboard.
|
||||
type: str
|
||||
icon:
|
||||
description:
|
||||
- URL to an image to use as icon.
|
||||
type: str
|
||||
description:
|
||||
description:
|
||||
- Description text to set on dashboard.
|
||||
type: str
|
||||
group:
|
||||
description:
|
||||
- Group to place service under on dashboard.
|
||||
type: str
|
||||
widget:
|
||||
description:
|
||||
- Widget configuration.
|
||||
- See U(https://gethomepage.dev/configs/services/) for more info.
|
||||
type: dict
|
||||
traefik_middleware:
|
||||
description:
|
||||
- Configuration for traefik_middleware labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
middleware:
|
||||
description:
|
||||
- The traefik middleware to use.
|
||||
- The name of the traefik middleware to use.
|
||||
type: str
|
||||
required: true
|
||||
settings:
|
||||
description:
|
||||
- Middleware options.
|
||||
type: dict
|
||||
required: true
|
||||
traefik_router:
|
||||
description:
|
||||
- Traefik Router label helper configuration.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
settings:
|
||||
description:
|
||||
- Middleware options.
|
||||
type: dict
|
||||
traefik_router:
|
||||
description:
|
||||
- Configuration for traefik_router labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
|
@ -226,7 +604,11 @@ options:
|
|||
description:
|
||||
- Routing rule to match.
|
||||
type: str
|
||||
required: true
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
service:
|
||||
description:
|
||||
- Traefik service to point at.
|
||||
|
@ -247,27 +629,30 @@ options:
|
|||
elements: str
|
||||
traefik_service:
|
||||
description:
|
||||
- Traefik Service label helper configuration.
|
||||
- Configuration for traefik_service labels.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
proxy_type:
|
||||
description:
|
||||
- Traefik proxy type.
|
||||
type: str
|
||||
choices: [http, tcp, udp]
|
||||
default: http
|
||||
name:
|
||||
description:
|
||||
- Name of the middleware.
|
||||
type: string
|
||||
port:
|
||||
description:
|
||||
- Port to forward to.
|
||||
type: int
|
||||
protocol_version:
|
||||
description:
|
||||
- Proxy protocol version to use (TCP only).
|
||||
type: int
|
||||
docker_in_docker:
|
||||
description:
|
||||
- Docker-in-Docker service definition.
|
||||
- Configuration for docker_in_docker service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
|
@ -275,67 +660,35 @@ options:
|
|||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Definition to force.
|
||||
type: dict
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Docker Socket Proxy service definition.
|
||||
- Configuration for docker_socket_proxy service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
type: dict
|
||||
read_only:
|
||||
description:
|
||||
- If true, only allow read access to the docker socket.
|
||||
type: bool
|
||||
default: true
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Docker Volume Backupper service definition.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
required: true
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Definition to force.
|
||||
type: dict
|
||||
docker_volume_backupper:
|
||||
description:
|
||||
- Configuration for docker_volume_backupper service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
archive:
|
||||
description:
|
||||
- Directory to store backups in.
|
||||
|
@ -345,32 +698,30 @@ options:
|
|||
- List of volume names of volumes to backup.
|
||||
type: list
|
||||
elements: str
|
||||
mariadb:
|
||||
description:
|
||||
- MariaDB service definition.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
required: true
|
||||
docker_socket_proxy:
|
||||
description:
|
||||
- Hostname of a docker socket proxy to use.
|
||||
type: str
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Definition to force.
|
||||
type: dict
|
||||
mariadb:
|
||||
description:
|
||||
- Configuration for mariadb service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
default: true
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
|
@ -390,32 +741,25 @@ options:
|
|||
description:
|
||||
- Root password for database.
|
||||
type: str
|
||||
postgres:
|
||||
description:
|
||||
- PostgreSQL service definition.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Definition to force.
|
||||
type: dict
|
||||
postgres:
|
||||
description:
|
||||
- Configuration for postgres service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
backup:
|
||||
description:
|
||||
- If true, add labels for the docker volume backupper.
|
||||
type: bool
|
||||
default: true
|
||||
database:
|
||||
description:
|
||||
- Name of database.
|
||||
|
@ -431,9 +775,17 @@ options:
|
|||
- Password for database.
|
||||
type: str
|
||||
required: true
|
||||
name:
|
||||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
overwrite:
|
||||
description:
|
||||
- Definition to force.
|
||||
type: dict
|
||||
redis:
|
||||
description:
|
||||
- Redis service definition.
|
||||
- Configuration for redis service.
|
||||
type: list
|
||||
elements: dict
|
||||
suboptions:
|
||||
|
@ -441,19 +793,11 @@ options:
|
|||
description:
|
||||
- Name of the service.
|
||||
type: str
|
||||
image:
|
||||
description:
|
||||
- Image to use for service.
|
||||
type: str
|
||||
defaults:
|
||||
description:
|
||||
- Service definition to be overwritten.
|
||||
type: dict
|
||||
overwrite:
|
||||
description:
|
||||
- Service definition to overwrite with.
|
||||
- Definition to force.
|
||||
type: dict
|
||||
"""
|
||||
""" # noqa: E501
|
||||
|
||||
from dataclasses import asdict
|
||||
from importlib.util import find_spec
|
||||
|
|
218
scripts/generate_docs.py
Executable file
218
scripts/generate_docs.py
Executable file
|
@ -0,0 +1,218 @@
|
|||
#!/bin/env python3
|
||||
# Copyright: (c) 2025, Luca Bilke <luca@bil.ke>
|
||||
# MIT License (see LICENSE)
|
||||
# ruff: noqa: T201
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, cast
|
||||
|
||||
import yaml
|
||||
from ansible_collections.snailed.ez_docker.plugins.module_utils import (
|
||||
label,
|
||||
service,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from types import ModuleType
|
||||
|
||||
GALAXY_METADATA_PATH = Path("../galaxy.yml")
|
||||
|
||||
|
||||
def get_modules(parent_module: ModuleType) -> list[tuple[str, ModuleType]]:
|
||||
return [
|
||||
(name, getattr(parent_module, name)) for name in parent_module.__all__ if name != "common"
|
||||
]
|
||||
|
||||
|
||||
def settings_format(text: str) -> str:
|
||||
return "\n".join(
|
||||
line for line in text.splitlines() if not line.strip().startswith(("default:", "required:"))
|
||||
)
|
||||
|
||||
|
||||
def get_module_docs(
|
||||
module: ModuleType,
|
||||
) -> str:
|
||||
ret: str = ""
|
||||
if docs := getattr(module, "DOCUMENTATION", None):
|
||||
ret = docs
|
||||
|
||||
if ret:
|
||||
return ret
|
||||
|
||||
msg = f"Module {module.__name__} has no documentation"
|
||||
raise ValueError(msg)
|
||||
|
||||
|
||||
def get_metadata() -> str:
|
||||
with GALAXY_METADATA_PATH.open("r") as f:
|
||||
metadata = yaml.safe_load(f)
|
||||
|
||||
docs = """
|
||||
module: compose
|
||||
version_added: 1.0.0
|
||||
short_description: Simplify docker-compose deployments.
|
||||
description: Easily create docker-compose files using a single module
|
||||
seealso:
|
||||
- name: Compose file reference
|
||||
description: Complete reference of the compose file spec.
|
||||
link: https://docs.docker.com/reference/compose-file/
|
||||
attributes:
|
||||
check_mode:
|
||||
support: full
|
||||
diff_mode:
|
||||
support: full
|
||||
"""
|
||||
|
||||
if author := metadata.get("author"):
|
||||
if isinstance(author, str):
|
||||
docs += f"author: {author}\n"
|
||||
|
||||
elif isinstance(author, list):
|
||||
docs += "author:\n"
|
||||
for a in cast(list[str], author):
|
||||
docs += f" - {a}\n"
|
||||
|
||||
return docs
|
||||
|
||||
|
||||
def get_settings_docs() -> str:
|
||||
service_default_definitions = """
|
||||
service_default_definitions:
|
||||
description:
|
||||
- Default definitions for each service
|
||||
type: dict
|
||||
suboptions:
|
||||
"""
|
||||
|
||||
service_default_args = """
|
||||
service_default_args:
|
||||
description:
|
||||
- Default arguments for each service helper.
|
||||
type: dict
|
||||
suboptions:
|
||||
"""
|
||||
|
||||
label_default_args = """
|
||||
label_default_args:
|
||||
description:
|
||||
- Default arguments for each label helper.
|
||||
type: dict
|
||||
suboptions:
|
||||
"""
|
||||
|
||||
for name, module in get_modules(service):
|
||||
if module.__name__.endswith("common"):
|
||||
continue
|
||||
|
||||
service_default_definitions += f"""
|
||||
{name}:
|
||||
description:
|
||||
- Default definitions for {name} services.
|
||||
type: dict
|
||||
"""
|
||||
|
||||
service_default_args += textwrap.indent(settings_format(get_module_docs(module)), " " * 8)
|
||||
|
||||
if module.__name__.endswith("custom"):
|
||||
for _, label_module in get_modules(label):
|
||||
if label_module.__name__.endswith("common"):
|
||||
continue
|
||||
|
||||
service_default_args += textwrap.indent(
|
||||
settings_format(get_module_docs(label_module)), " " * 24
|
||||
)
|
||||
else:
|
||||
service_default_args += textwrap.indent(
|
||||
settings_format(service.common.BASE_DOCUMENTATION), " " * 16
|
||||
)
|
||||
|
||||
for _, module in get_modules(label):
|
||||
if module.__name__.endswith("common"):
|
||||
continue
|
||||
|
||||
label_default_args += textwrap.indent(settings_format(get_module_docs(module)), " " * 8)
|
||||
|
||||
return f"""
|
||||
settings:
|
||||
description:
|
||||
- Settings/Defaults for the module.
|
||||
type: dict
|
||||
suboptions:
|
||||
external_networks:
|
||||
description:
|
||||
- Networks to mark as external.
|
||||
type: list
|
||||
elements: str
|
||||
external_volumes:
|
||||
description:
|
||||
- Volumes to mark as external.
|
||||
type: list
|
||||
elements: str
|
||||
default_definition:
|
||||
description:
|
||||
- Default definition for all containers.
|
||||
- Overwritten by per-service defaults.
|
||||
type: dict
|
||||
{textwrap.indent(service_default_definitions, " " * 8)}
|
||||
{textwrap.indent(service_default_args, " " * 8)}
|
||||
{textwrap.indent(label_default_args, " " * 8)}
|
||||
"""
|
||||
|
||||
|
||||
def get_service_docs() -> str:
|
||||
service_docs = """
|
||||
services:
|
||||
description:
|
||||
- Services to create in the project.
|
||||
type: dict
|
||||
suboptions:
|
||||
"""
|
||||
for _, module in get_modules(service):
|
||||
service_docs += f"""
|
||||
{textwrap.indent(get_module_docs(module), " " * 8)}
|
||||
"""
|
||||
|
||||
if module.__name__.endswith("custom"):
|
||||
for _, label_module in get_modules(label):
|
||||
if label_module.__name__ == "common":
|
||||
continue
|
||||
|
||||
service_docs += textwrap.indent(
|
||||
settings_format(get_module_docs(label_module)), " " * 24
|
||||
)
|
||||
else:
|
||||
service_docs += textwrap.indent(service.common.BASE_DOCUMENTATION, " " * 16)
|
||||
|
||||
return service_docs
|
||||
|
||||
|
||||
ret = f"""
|
||||
---
|
||||
{get_metadata()}
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Name of the compose project to create or modify.
|
||||
aliases: [project]
|
||||
type: str
|
||||
project_dir:
|
||||
description:
|
||||
- Path to store project directory under.
|
||||
type: path
|
||||
{textwrap.indent(get_settings_docs(), " " * 4)}
|
||||
{textwrap.indent(get_service_docs(), " " * 4)}
|
||||
"""
|
||||
|
||||
ret = "\n".join(line for line in ret.splitlines() if line.strip())
|
||||
|
||||
print(ret)
|
||||
try:
|
||||
yaml.safe_load(ret)
|
||||
except yaml.YAMLError as e:
|
||||
print("YAML is invalid!\n", file=sys.stderr)
|
||||
print(e, file=sys.stderr)
|
Loading…
Add table
Reference in a new issue