mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-20 01:06:03 +02:00
Solved all open test issues
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# run_once_sys_stk_front_proxy: deactivated
|
||||||
|
|
||||||
- name: "Load Proxy procedures if Proxy is enabled"
|
- name: "Load Proxy procedures if Proxy is enabled"
|
||||||
include_tasks: "01_base.yml"
|
include_tasks: "01_base.yml"
|
||||||
when: SYS_STK_FRONT_PROXY_ENABLED | bool
|
when: SYS_STK_FRONT_PROXY_ENABLED | bool
|
@@ -17,63 +17,6 @@ _JOB_LOC_RE = re.compile(r"/rest/jobstatus/([^?\s#]+)")
|
|||||||
def _join_elements(elems: Iterable[Any]) -> str:
|
def _join_elements(elems: Iterable[Any]) -> str:
|
||||||
return "/".join(str(x) for x in elems)
|
return "/".join(str(x) for x in elems)
|
||||||
|
|
||||||
|
|
||||||
def xwiki_job_id(response: Any, default: Optional[str] = None, strict: bool = False) -> Optional[str]:
|
|
||||||
"""
|
|
||||||
Extract a XWiki job ID from a typical Ansible `uri` response.
|
|
||||||
|
|
||||||
Supports:
|
|
||||||
- JSON mapping: {"id": {"elements": ["install", "extensions", "123"]}}
|
|
||||||
- JSON mapping: {"id": "install/extensions/123"}
|
|
||||||
- Fallback from Location header or URL containing "/rest/jobstatus/<id>"
|
|
||||||
|
|
||||||
Args:
|
|
||||||
response: The registered result from the `uri` task (dict-like).
|
|
||||||
default: Value to return when no ID can be found (if strict=False).
|
|
||||||
strict: If True, raise AnsibleFilterError when no ID is found.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The job ID string, or `default`/None.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
AnsibleFilterError: if `strict=True` and no job ID can be determined.
|
|
||||||
"""
|
|
||||||
if not isinstance(response, dict):
|
|
||||||
if strict:
|
|
||||||
raise AnsibleFilterError("xwiki_job_id: response must be a dict-like Ansible result.")
|
|
||||||
return default
|
|
||||||
|
|
||||||
# 1) Try JSON body
|
|
||||||
j = response.get("json")
|
|
||||||
if isinstance(j, dict):
|
|
||||||
job_id = j.get("id")
|
|
||||||
if isinstance(job_id, dict):
|
|
||||||
elems = job_id.get("elements")
|
|
||||||
if isinstance(elems, list) and elems:
|
|
||||||
return _join_elements(elems)
|
|
||||||
if isinstance(job_id, str) and job_id.strip():
|
|
||||||
return job_id.strip()
|
|
||||||
|
|
||||||
# 2) Fallback: Location header (Ansible `uri` exposes it as `location`)
|
|
||||||
loc = response.get("location")
|
|
||||||
if isinstance(loc, str) and loc:
|
|
||||||
m = _JOB_LOC_RE.search(loc)
|
|
||||||
if m:
|
|
||||||
return m.group(1)
|
|
||||||
|
|
||||||
# 3) As a last resort, try the final `url` (in case server redirected and Ansible captured it)
|
|
||||||
url = response.get("url")
|
|
||||||
if isinstance(url, str) and url:
|
|
||||||
m = _JOB_LOC_RE.search(url)
|
|
||||||
if m:
|
|
||||||
return m.group(1)
|
|
||||||
|
|
||||||
# Not found
|
|
||||||
if strict:
|
|
||||||
raise AnsibleFilterError("xwiki_job_id: could not extract job ID from response.")
|
|
||||||
return default
|
|
||||||
|
|
||||||
|
|
||||||
def xwiki_extension_status(raw: str) -> int:
|
def xwiki_extension_status(raw: str) -> int:
|
||||||
"""
|
"""
|
||||||
Parse the output of the Groovy CheckExtension page.
|
Parse the output of the Groovy CheckExtension page.
|
||||||
@@ -103,6 +46,5 @@ class FilterModule(object):
|
|||||||
"""Custom filters for XWiki helpers."""
|
"""Custom filters for XWiki helpers."""
|
||||||
def filters(self):
|
def filters(self):
|
||||||
return {
|
return {
|
||||||
"xwiki_job_id": xwiki_job_id,
|
|
||||||
"xwiki_extension_status": xwiki_extension_status,
|
"xwiki_extension_status": xwiki_extension_status,
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
vars:
|
vars:
|
||||||
xwiki_oidc_enabled_switch: false
|
xwiki_oidc_enabled_switch: false
|
||||||
xwiki_ldap_enabled_switch: false
|
xwiki_ldap_enabled_switch: false
|
||||||
xwiki_superadmin_enabled_switch: true
|
|
||||||
|
|
||||||
- name: "ASSERT | superadmin can authenticate (needed for installer)"
|
- name: "ASSERT | superadmin can authenticate (needed for installer)"
|
||||||
uri:
|
uri:
|
||||||
@@ -49,6 +48,5 @@
|
|||||||
vars:
|
vars:
|
||||||
xwiki_oidc_enabled_switch: "{{ XWIKI_OIDC_ENABLED | bool }}"
|
xwiki_oidc_enabled_switch: "{{ XWIKI_OIDC_ENABLED | bool }}"
|
||||||
xwiki_ldap_enabled_switch: "{{ XWIKI_LDAP_ENABLED | bool }}"
|
xwiki_ldap_enabled_switch: "{{ XWIKI_LDAP_ENABLED | bool }}"
|
||||||
xwiki_superadmin_enabled_switch: false
|
|
||||||
|
|
||||||
- include_tasks: utils/run_once.yml
|
- include_tasks: utils/run_once.yml
|
||||||
|
@@ -14,7 +14,6 @@ XWIKI_HOST_PORT: "{{ ports.localhost.http[application_id] }
|
|||||||
XWIKI_HOSTNAME: "{{ container_hostname }}"
|
XWIKI_HOSTNAME: "{{ container_hostname }}"
|
||||||
|
|
||||||
## Paths
|
## Paths
|
||||||
XWIKI_HOST_CONF_PATH: "{{ [docker_compose.directories.config, 'xwiki.cfg'] | path_join }}"
|
|
||||||
XWIKI_HOST_PROPERTIES_PATH: "{{ [docker_compose.directories.config, 'xwiki.properties'] | path_join }}"
|
XWIKI_HOST_PROPERTIES_PATH: "{{ [docker_compose.directories.config, 'xwiki.properties'] | path_join }}"
|
||||||
XWIKI_DOCK_DATA_DIR: "/usr/local/xwiki"
|
XWIKI_DOCK_DATA_DIR: "/usr/local/xwiki"
|
||||||
|
|
||||||
@@ -32,7 +31,6 @@ XWIKI_SSO_ENABLED: "{{ (XWIKI_OIDC_ENABLED | bool) or (XWIKI_
|
|||||||
|
|
||||||
# Admin credentials (must be provided via inventory/vault)
|
# Admin credentials (must be provided via inventory/vault)
|
||||||
XWIKI_ADMIN_USER: "{{ users.administrator.username }}"
|
XWIKI_ADMIN_USER: "{{ users.administrator.username }}"
|
||||||
XWIKI_ADMIN_PASS: "{{ users.administrator.password }}"
|
|
||||||
XWIKI_ADMIN_GROUP: "{{ application_id }}-administrator"
|
XWIKI_ADMIN_GROUP: "{{ application_id }}-administrator"
|
||||||
|
|
||||||
# Superadministrator
|
# Superadministrator
|
||||||
@@ -43,7 +41,6 @@ XWIKI_SUPERADMIN_USERNAME: "superadmin"
|
|||||||
XWIKI_REST_BASE: "{{ ['http://127.0.0.1:'~ XWIKI_HOST_PORT, '/rest/'] | url_join }}"
|
XWIKI_REST_BASE: "{{ ['http://127.0.0.1:'~ XWIKI_HOST_PORT, '/rest/'] | url_join }}"
|
||||||
XWIKI_REST_XWIKI: "{{ [XWIKI_REST_BASE, 'wikis/xwiki'] | url_join }}"
|
XWIKI_REST_XWIKI: "{{ [XWIKI_REST_BASE, 'wikis/xwiki'] | url_join }}"
|
||||||
XWIKI_REST_XWIKI_PAGES: "{{ [XWIKI_REST_BASE, 'wikis/xwiki/spaces/XWiki/pages'] | url_join }}"
|
XWIKI_REST_XWIKI_PAGES: "{{ [XWIKI_REST_BASE, 'wikis/xwiki/spaces/XWiki/pages'] | url_join }}"
|
||||||
XWIKI_REST_EXTENSION_INSTALL: "{{ [XWIKI_REST_BASE, 'jobs'] | url_join }}"
|
|
||||||
|
|
||||||
# LDAP configuration (mapped to LDAP.* context)
|
# LDAP configuration (mapped to LDAP.* context)
|
||||||
XWIKI_LDAP_SERVER: "{{ LDAP.SERVER.DOMAIN }}"
|
XWIKI_LDAP_SERVER: "{{ LDAP.SERVER.DOMAIN }}"
|
||||||
|
Reference in New Issue
Block a user