diff --git a/README.md b/README.md index 6b26321..2163517 100644 --- a/README.md +++ b/README.md @@ -670,7 +670,81 @@ CMK_DOWNLOAD_PASSWORD= Die Zugangsdaten stammen aus dem Checkmk-Kundenportal (portal.checkmk.com). Die `.env` sollte deshalb `chmod 600` haben – `install.sh` setzt das. -### 8.4 Image holen – drei Wege +### 8.4 Zugangsdaten vorab prüfen + +Bevor ein mehrere Gigabyte grosser Download an einer falschen Anmeldung +scheitert, lässt sich beides in Sekunden testen: + +```bash +./scripts/cmk-manage.sh image test --edition enterprise --version 2.3.0p23 +``` + +Geprüft wird ohne jeden Download und ohne dass eine Anmeldung gespeichert wird: + +| Prüfung | Was sie beantwortet | +|---|---| +| Registry erreichbar | Netzwerk, Proxy, DNS | +| Anmeldung akzeptiert | stimmen Benutzer und Kennwort? | +| Zugriff auf das Repository | hat das Konto die nötige Berechtigung (Subskription)? | +| Downloadportal | liegt der Image-Tarball dort und wird die Anmeldung akzeptiert? | + +Beispiel mit korrekten Zugangsdaten aus der `.env`: + +``` +Registry registry.checkmk.com + [ OK ] erreichbar (HTTP 401) + [ OK ] Anmeldung akzeptiert + [ OK ] Zugriff auf 'enterprise/check-mk-enterprise' vorhanden + +Downloadportal download.checkmk.com + [ OK ] Datei erreichbar (HTTP 200) + https://download.checkmk.com/checkmk/2.3.0p23/check-mk-enterprise-2.3.0p23.docker.tar.gz + +[ OK ] Zugangsweg nutzbar. +``` + +Bei falschem Kennwort: + +``` +Registry registry.checkmk.com + [ OK ] erreichbar (HTTP 401) + [FEHLER] Anmeldung abgelehnt (HTTP 401) + Benutzername/Kennwort des Checkmk-Kundenportals pruefen +``` + +Nützliche Unterscheidungen, die der Test trifft: + +* **Anmeldung akzeptiert, aber kein Zugriff auf das Repository** – die + Zugangsdaten stimmen, der Subskription fehlt aber die Berechtigung für diese + Edition. +* **Anmeldung akzeptiert, aber HTTP 404 im Downloadportal** – Benutzer und + Kennwort sind richtig, nur Version oder Dateiname passen nicht. Dann die + exakte Version angeben (kein `-latest`) oder `CMK_DOWNLOAD_URL` setzen. +* Bei den frei verfügbaren Editionen (`raw`, `pro`, `cloud` …) meldet der Test + „öffentliches Repository – keine Anmeldung nötig" und prüft trotzdem, ob das + Repository wirklich abrufbar ist. + +Optionen: + +```bash +# Zugangsdaten einmalig angeben, ohne sie in die .env zu schreiben +./scripts/cmk-manage.sh image test --edition enterprise --version 2.3.0p23 \ + --user --password + +# nur einen Bezugsweg prüfen +./scripts/cmk-manage.sh image test --only registry +./scripts/cmk-manage.sh image test --only download +``` + +Die Zugangsdaten werden über eine temporäre `.netrc` an `curl` übergeben und +erscheinen daher **nicht** in der Prozessliste. Fehlt `curl`, weicht der Test +für die Registry auf `podman login` bzw. `docker login` aus – auch dann in eine +Wegwerfdatei, die gespeicherte Anmeldung des Systems bleibt unberührt. + +In der ncurses-Oberfläche liegt der Test unter +**Checkmk-Image beschaffen/auswählen → „Zugangsdaten prüfen"**. + +### 8.5 Image holen – drei Wege **a) Aus einer Registry (empfohlen)** @@ -721,7 +795,7 @@ ihn als `CMK_IMAGE` in die `.env` ein. Danach: sudo ./scripts/cmk-manage.sh up ``` -### 8.5 Nachsehen, was gilt +### 8.6 Nachsehen, was gilt ```bash ./scripts/cmk-manage.sh image status # konfiguriertes + lokale Images diff --git a/README_en.md b/README_en.md index 6bc4ea8..050bb15 100644 --- a/README_en.md +++ b/README_en.md @@ -673,7 +673,83 @@ CMK_DOWNLOAD_PASSWORD= The credentials come from the Checkmk customer portal (portal.checkmk.com). `.env` should therefore be `chmod 600` – `install.sh` takes care of that. -### 8.4 Fetching the image – three ways +### 8.4 Testing the credentials first + +Rather than having a multi-gigabyte download fail on a wrong login, both can be +checked in seconds: + +```bash +./scripts/cmk-manage.sh image test --edition enterprise --version 2.3.0p23 +``` + +Nothing is downloaded and no login is stored. What gets checked: + +| Check | What it answers | +|---|---| +| registry reachable | network, proxy, DNS | +| login accepted | are the username and password correct? | +| access to the repository | does the account have the required entitlement (subscription)? | +| download portal | is the image tarball there and is the login accepted? | + +Example with correct credentials from `.env`: + +``` +Registry registry.checkmk.com + [ OK ] erreichbar (HTTP 401) + [ OK ] Anmeldung akzeptiert + [ OK ] Zugriff auf 'enterprise/check-mk-enterprise' vorhanden + +Downloadportal download.checkmk.com + [ OK ] Datei erreichbar (HTTP 200) + https://download.checkmk.com/checkmk/2.3.0p23/check-mk-enterprise-2.3.0p23.docker.tar.gz + +[ OK ] Zugangsweg nutzbar. +``` + +With a wrong password: + +``` +Registry registry.checkmk.com + [ OK ] erreichbar (HTTP 401) + [FEHLER] Anmeldung abgelehnt (HTTP 401) + Benutzername/Kennwort des Checkmk-Kundenportals pruefen +``` + +(`erreichbar` = reachable, `Anmeldung akzeptiert` = login accepted, +`Anmeldung abgelehnt` = login rejected, `Zugangsweg nutzbar` = a route works.) + +Useful distinctions the test makes: + +* **Login accepted, but no access to the repository** – the credentials are + correct, but the subscription lacks the entitlement for this edition. +* **Login accepted, but HTTP 404 on the download portal** – username and + password are right, only the version or file name does not match. Give the + exact version (no `-latest`) or set `CMK_DOWNLOAD_URL`. +* For the freely available editions (`raw`, `pro`, `cloud`, …) the test reports + "public repository – no login required" and still verifies that the + repository can actually be reached. + +Options: + +```bash +# supply credentials once without writing them to .env +./scripts/cmk-manage.sh image test --edition enterprise --version 2.3.0p23 \ + --user --password + +# check only one route +./scripts/cmk-manage.sh image test --only registry +./scripts/cmk-manage.sh image test --only download +``` + +The credentials are passed to `curl` through a temporary `.netrc` and therefore +do **not** appear in the process list. If `curl` is missing, the registry check +falls back to `podman login` / `docker login` – into a throwaway file as well, +so the system's stored login is left untouched. + +In the ncurses interface the test lives under +**Checkmk-Image beschaffen/auswählen → "Zugangsdaten prüfen"**. + +### 8.5 Fetching the image – three ways **a) From a registry (recommended)** @@ -724,7 +800,7 @@ typically `localhost/checkmk/check-mk-enterprise:2.3.0p23`) and writes it to sudo ./scripts/cmk-manage.sh up ``` -### 8.5 Checking what is in effect +### 8.6 Checking what is in effect ```bash ./scripts/cmk-manage.sh image status # configured image + local images diff --git a/scripts/cmk-manage.sh b/scripts/cmk-manage.sh index 89f62c3..1624426 100755 --- a/scripts/cmk-manage.sh +++ b/scripts/cmk-manage.sh @@ -92,6 +92,11 @@ KOMMANDOS - Backup / Restore / Migration KOMMANDOS - Checkmk-Image beschaffen image status konfiguriertes und lokal vorhandene Images anzeigen image list lokal vorhandene Checkmk-Images + image test [Opt.] Zugangsdaten pruefen, ohne etwas herunterzuladen + --edition E Edition, deren Repository geprueft wird + --version V Version fuer die Pruefung des Downloadportals + --user U --password P statt der Werte aus der .env + --only registry|download nur einen Bezugsweg pruefen image pull [Opt.] Image aus einer Registry holen --edition E raw|community|free|cloud|managed|pro|ultimate| ultimatemt|enterprise (Vorgabe: CMK_EDITION) @@ -137,6 +142,7 @@ BEISPIELE ./scripts/cmk-manage.sh up ./scripts/cmk-manage.sh backup --all --no-logs ./scripts/cmk-manage.sh import --file backups/cmkmigrate_prod_2.3.0p23_*.tar.gz --set-default-site + ./scripts/cmk-manage.sh image test --edition enterprise --version 2.3.0p23 ./scripts/cmk-manage.sh image pull --edition enterprise --version 2.3.0p23 \ --user --password ./scripts/cmk-manage.sh image download --edition enterprise --version 2.3.0p23 @@ -649,6 +655,301 @@ image_cmd_status() { echo } +# --------------------------------------------------------------------- +# Zugangsdaten pruefen +# +# Testet, ohne etwas herunterzuladen oder eine Anmeldung zu speichern: +# 1. Registry (registry.checkmk.com): Docker-Registry-v2-Anmeldung und +# ob das Konto Zugriff auf das Enterprise-Repository hat. +# 2. Downloadportal: HTTP-Basic-Anmeldung auf die Image-Tarballs. +# Die Zugangsdaten gehen per temporaerer .netrc an curl und tauchen +# damit nicht in der Prozessliste auf. +# --------------------------------------------------------------------- + +# Schreibt eine temporaere .netrc fuer die uebergebenen Hosts +netrc_make() { # user pass host [host ...] -> Pfad auf stdout + local user="$1" pass="$2"; shift 2 + local f h; f="$(mktemp)"; chmod 600 "$f" + for h in "$@"; do + [ -n "$h" ] && printf 'machine %s login %s password %s\n' "$h" "$user" "$pass" >>"$f" + done + printf '%s\n' "$f" +} + +# HTTP-Status einer URL holen (optional mit .netrc) +http_code() { # url [netrc] [extra-header] + local url="$1" netrc="${2:-}" hdr="${3:-}" + local -a a=(-sS -o /dev/null -w '%{http_code}' --max-time 30) + [ -n "$netrc" ] && a+=(--netrc-file "$netrc") + [ -n "$hdr" ] && a+=(-H "$hdr") + curl "${a[@]}" "$url" 2>/dev/null || echo "000" +} + +test_result() { # status text [detail] + case "$1" in + ok) printf ' %s[ OK ]%s %s\n' "$C_GRN" "$C_RST" "$2" ;; + fail) printf ' %s[FEHLER]%s %s\n' "$C_RED" "$C_RST" "$2" ;; + warn) printf ' %s[ WARN ]%s %s\n' "$C_YEL" "$C_RST" "$2" ;; + *) printf ' [ INFO ] %s\n' "$2" ;; + esac + [ -n "${3:-}" ] && printf ' %s\n' "$3" || true +} + +# --- Registry pruefen ------------------------------------------------- +# Der Name im Image-Bezeichner ist nicht immer der API-Host: +# "docker.io" spricht man als "registry-1.docker.io" an. +registry_api_host() { + case "$1" in + docker.io|index.docker.io) echo "registry-1.docker.io" ;; + *) echo "$1" ;; + esac +} + +test_registry_login() { # reg repo user pass needs_login -> 0 = alles gut + local reg="$1" repo="$2" user="$3" pass="$4" needs_login="${5:-}" + local rc=0 anon="" + local api; api="$(registry_api_host "$reg")" + [ -z "$user" ] && anon=1 + + printf '\n%sRegistry %s%s\n' "$C_BLD" "$reg" "$C_RST" + [ "$api" != "$reg" ] && printf ' API-Host: %s\n' "$api" + + if [ -n "$anon" ] && [ -n "$needs_login" ]; then + test_result fail "keine Zugangsdaten hinterlegt" \ + "Diese Edition ist nur mit Anmeldung erreichbar. CMK_REGISTRY_USER/-PASSWORD + setzen oder --user/--password angeben." + return 1 + fi + + # 1) Erreichbarkeit + local hdrf; hdrf="$(mktemp)" + local code + code="$(curl -sS -o /dev/null -D "$hdrf" -w '%{http_code}' --max-time 30 "https://$api/v2/" 2>/dev/null || echo 000)" + if [ "$code" = "000" ]; then + test_result fail "nicht erreichbar" "Netzwerk/Proxy/DNS pruefen: https://$api/v2/" + rm -f "$hdrf"; return 1 + fi + test_result ok "erreichbar (HTTP $code)" + + # 2) Authentifizierungsverfahren aus dem WWW-Authenticate-Kopf lesen + local wa realm service + wa="$(tr -d '\r' <"$hdrf" | grep -i '^www-authenticate:' | head -n1)" + rm -f "$hdrf" + + [ -n "$anon" ] && test_result info "oeffentliches Repository - keine Anmeldung noetig" + + case "$wa" in + *[Bb]earer*) + realm="$(printf '%s' "$wa" | sed -n 's/.*realm="\([^"]*\)".*/\1/p')" + service="$(printf '%s' "$wa" | sed -n 's/.*service="\([^"]*\)".*/\1/p')" + [ -n "$realm" ] || { test_result fail "Token-Dienst nicht ermittelbar" "$wa"; return 1; } + + local realm_host; realm_host="$(printf '%s' "$realm" | sed -E 's|^[a-z]+://([^/]+).*|\1|')" + local netrc="" + [ -z "$anon" ] && netrc="$(netrc_make "$user" "$pass" "$api" "$realm_host")" + local url="$realm?service=$service&scope=repository:$repo:pull" + local body tcode + if [ -n "$netrc" ]; then + body="$(curl -sS --netrc-file "$netrc" --max-time 30 "$url" 2>/dev/null || true)" + tcode="$(http_code "$url" "$netrc")" + else + body="$(curl -sS --max-time 30 "$url" 2>/dev/null || true)" + tcode="$(http_code "$url")" + fi + + if [ "$tcode" = "401" ] || [ "$tcode" = "403" ]; then + test_result fail "Anmeldung abgelehnt (HTTP $tcode)" \ + "Benutzername/Kennwort des Checkmk-Kundenportals pruefen" + [ -n "$netrc" ] && rm -f "$netrc"; return 1 + fi + if [ "$tcode" != "200" ]; then + test_result fail "Token-Abruf fehlgeschlagen (HTTP $tcode)" + [ -n "$netrc" ] && rm -f "$netrc"; return 1 + fi + [ -n "$anon" ] && test_result ok "anonymer Zugriff moeglich" \ + || test_result ok "Anmeldung akzeptiert" + + # 3) Zugriff auf das konkrete Repository + local token + token="$(printf '%s' "$body" | sed -n 's/.*"token"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')" + [ -n "$token" ] || token="$(printf '%s' "$body" | sed -n 's/.*"access_token"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')" + if [ -n "$token" ]; then + local lcode + lcode="$(http_code "https://$api/v2/$repo/tags/list" "" "Authorization: Bearer $token")" + case "$lcode" in + 200) test_result ok "Zugriff auf '$repo' vorhanden" ;; + 401|403) test_result fail "kein Zugriff auf '$repo' (HTTP $lcode)" \ + "Die Anmeldung stimmt, das Konto hat aber keine Berechtigung fuer dieses Repository (Subskription?)" + rc=1 ;; + 404) test_result warn "Repository '$repo' nicht gefunden (HTTP 404)" \ + "Pfad pruefen - Anmeldung selbst ist in Ordnung" ;; + *) test_result warn "Repository-Pruefung nicht eindeutig (HTTP $lcode)" ;; + esac + fi + [ -n "$netrc" ] && rm -f "$netrc" + ;; + *[Bb]asic*|"") + local netrc; netrc="$(netrc_make "$user" "$pass" "$api")" + local bcode; bcode="$(http_code "https://$api/v2/" "$netrc")" + rm -f "$netrc" + case "$bcode" in + 200) test_result ok "Anmeldung akzeptiert (Basic)" ;; + 401|403) test_result fail "Anmeldung abgelehnt (HTTP $bcode)"; rc=1 ;; + *) test_result warn "unklares Ergebnis (HTTP $bcode)"; rc=1 ;; + esac + ;; + *) + test_result warn "unbekanntes Anmeldeverfahren" "$wa"; rc=1 ;; + esac + return $rc +} + +# Rueckfall ohne curl: Anmeldung ueber die Runtime, in eine Wegwerfdatei +test_registry_login_runtime() { # reg user pass + local reg="$1" user="$2" pass="$3" tmp rc=0 + tmp="$(mktemp -d)" + printf '\n%sRegistry %s (ueber %s)%s\n' "$C_BLD" "$reg" "$RUNTIME" "$C_RST" + if [ "$RUNTIME" = podman ]; then + if printf '%s' "$pass" | $RUNTIME login --username "$user" --password-stdin \ + --authfile "$tmp/auth.json" "$reg" >/dev/null 2>&1; then + test_result ok "Anmeldung akzeptiert" + else + test_result fail "Anmeldung abgelehnt"; rc=1 + fi + else + if printf '%s' "$pass" | DOCKER_CONFIG="$tmp" $RUNTIME login --username "$user" \ + --password-stdin "$reg" >/dev/null 2>&1; then + test_result ok "Anmeldung akzeptiert" + else + test_result fail "Anmeldung abgelehnt"; rc=1 + fi + fi + rm -rf "$tmp" + return $rc +} + +# --- Downloadportal pruefen ------------------------------------------- +test_download_login() { # baseurl edition version user pass + local base="$1" edition="$2" version="$3" user="$4" pass="$5" + local host; host="$(printf '%s' "$base" | sed -E 's|^[a-z]+://([^/]+).*|\1|')" + local rc=1 + + printf '\n%sDownloadportal %s%s\n' "$C_BLD" "$host" "$C_RST" + + if [ -z "$user" ]; then + test_result warn "keine Zugangsdaten hinterlegt - uebersprungen" \ + "CMK_DOWNLOAD_USER/-PASSWORD setzen oder --user/--password angeben" + return 1 + fi + + local netrc; netrc="$(netrc_make "$user" "$pass" "$host")" + local pkg; pkg="$(edition_pkgname "$edition")" + local -a urls=() + if [ -n "${CMK_DOWNLOAD_URL:-}" ]; then + urls=("$CMK_DOWNLOAD_URL") + elif [ -n "$version" ]; then + urls=("$base/$version/$pkg-$version.docker.tar.gz" + "$base/$version/$pkg-docker-$version.tar.gz") + else + urls=("$base/") + fi + + local u code seen401="" seen404="" + for u in "${urls[@]}"; do + code="$(http_code "$u" "$netrc")" + case "$code" in + 200) test_result ok "Datei erreichbar (HTTP 200)" "$u"; rc=0; break ;; + 401|403) seen401=1; test_result fail "Anmeldung abgelehnt (HTTP $code)" "$u" ;; + 404) seen404=1 ;; + 000) test_result fail "nicht erreichbar" "$u" ;; + *) test_result warn "unerwartete Antwort (HTTP $code)" "$u" ;; + esac + done + rm -f "$netrc" + + if [ "$rc" != 0 ] && [ -z "$seen401" ] && [ -n "$seen404" ]; then + test_result ok "Anmeldung akzeptiert, aber kein Tarball unter diesem Namen (HTTP 404)" + printf ' %s\n' "Version pruefen (z.B. 2.3.0p23, kein '-latest') oder" + printf ' %s\n' "CMK_DOWNLOAD_URL mit der vollstaendigen URL setzen." + rc=0 + fi + return $rc +} + +image_cmd_test() { + local edition="${CMK_EDITION:-raw}" version="${CMK_VERSION:-}" + local ruser="${CMK_REGISTRY_USER:-}" rpass="${CMK_REGISTRY_PASSWORD:-}" + local duser="${CMK_DOWNLOAD_USER:-}" dpass="${CMK_DOWNLOAD_PASSWORD:-}" + local reg="${CMK_REGISTRY:-registry.checkmk.com}" + local only="" + while [ $# -gt 0 ]; do + case "$1" in + --edition) edition="$2"; shift 2 ;; + --version) version="$2"; shift 2 ;; + --registry) reg="$2"; shift 2 ;; + --user) ruser="$2"; duser="$2"; shift 2 ;; + --password) rpass="$2"; dpass="$2"; shift 2 ;; + --only) only="$2"; shift 2 ;; + *) die "Unbekannte Option fuer 'image test': $1" ;; + esac + done + + edition_known "$edition" || die "Unbekannte Edition '$edition'." + + printf '\n%sPruefe Zugangsdaten%s\n' "$C_BLD" "$C_RST" + printf ' Edition : %s\n' "$edition" + printf ' Version : %s\n' "${version:-}" + + local rc_reg=1 rc_dl=1 ran_reg="" ran_dl="" + + if [ -z "$only" ] || [ "$only" = registry ]; then + ran_reg=1 + local full repo + CMK_REGISTRY="$reg" + full="$(edition_repo "$edition")" + repo="${full#*/}" + local rhost="${full%%/*}" + local needs="" + edition_needs_login "$edition" && needs=1 + if command -v curl >/dev/null 2>&1; then + test_registry_login "$rhost" "$repo" "$ruser" "$rpass" "$needs" && rc_reg=0 + elif [ -n "$ruser" ]; then + test_registry_login_runtime "$rhost" "$ruser" "$rpass" && rc_reg=0 + else + warn "Weder curl noch Zugangsdaten vorhanden - Registry uebersprungen." + fi + fi + + if [ -z "$only" ] || [ "$only" = download ]; then + ran_dl=1 + if command -v curl >/dev/null 2>&1; then + test_download_login "${CMK_DOWNLOAD_BASEURL:-https://download.checkmk.com/checkmk}" \ + "$edition" "$version" "$duser" "$dpass" && rc_dl=0 + else + warn "curl fehlt - Downloadportal kann nicht geprueft werden." + fi + fi + + [ -n "$ran_reg$ran_dl" ] || die "Unbekannter Wert fuer --only: '$only' (registry|download)" + + echo + local good="" + [ -n "$ran_reg" ] && [ "$rc_reg" = 0 ] && good=1 + [ -n "$ran_dl" ] && [ "$rc_dl" = 0 ] && good=1 + if [ -n "$good" ]; then + ok "Zugangsweg nutzbar." + [ -n "$ran_reg" ] && [ "$rc_reg" = 0 ] && \ + log "Weiter mit: $SELF image pull --edition $edition --version ${version:-}" + [ -n "$ran_dl" ] && [ "$rc_dl" = 0 ] && [ "${rc_reg}" != 0 ] && \ + log "Weiter mit: $SELF image download --edition $edition --version ${version:-}" + echo + return 0 + fi + err "Kein geprüfter Bezugsweg ist nutzbar - bitte Zugangsdaten pruefen." + echo + return 1 +} + cmd_image() { local sub="${1:-status}"; [ $# -gt 0 ] && shift || true case "$sub" in @@ -658,8 +959,9 @@ cmd_image() { download) image_cmd_download "$@" ;; load) image_cmd_load "$@" ;; use|set) image_cmd_use "$@" ;; + test|check) image_cmd_test "$@" ;; *) die "Unbekanntes Unterkommando 'image $sub'. - Moeglich: status | list | pull | download | load | use" ;; + Moeglich: status | list | test | pull | download | load | use" ;; esac } @@ -1881,6 +2183,7 @@ gui_image_menu() { "Aktuell (.env): ${CMK_IMAGE:-} Edition/Version: ${CMK_EDITION:-raw} / ${CMK_VERSION:-?}" \ status "Status und lokale Images anzeigen" \ + test "Zugangsdaten pruefen (Registry und Downloadportal)" \ pull "Aus Registry holen (Docker Hub / registry.checkmk.com)" \ download "Tarball vom Downloadportal holen (mit Zugangsdaten)" \ load "Heruntergeladenen Tarball einspielen (load)" \ @@ -1889,6 +2192,7 @@ Edition/Version: ${CMK_EDITION:-raw} / ${CMK_VERSION:-?}" \ case "$sel" in status) local f; f="$(mktemp)"; NO_COLOR=1 cmd_image status >"$f" 2>&1 || true ui_text "Image-Status" "$f"; rm -f "$f" ;; + test) gui_image_test ;; pull) gui_image_pull ;; download) gui_image_download ;; load) local lf; lf="$(ui_pick_file "${IMAGE_DIR:-$PROJECT_DIR/images}" '*.tar.gz')" || continue @@ -1913,6 +2217,22 @@ gui_image_pick_edition() { ultimatemt "Ultimate Multi-Tenancy (ab 2.5)" } +gui_image_test() { + local ed ver user pass + ed="$(gui_image_pick_edition)" || return + ver="$(ui_input "Version" "Version (fuer die Pruefung des Downloadportals):" "${CMK_VERSION:-}")" || return + local -a extra=() + if ui_yesno "Zugangsdaten" "Zugangsdaten aus der .env verwenden?\n\nRegistry : ${CMK_REGISTRY_USER:-}\nDownload : ${CMK_DOWNLOAD_USER:-}\n\n = jetzt eingeben"; then + : + else + user="$(ui_input "Zugangsdaten" "Benutzer (Checkmk-Kundenportal):" "${CMK_REGISTRY_USER:-}")" || return + pass="$(ui_password "Zugangsdaten" "Kennwort:")" || return + [ -n "$user" ] && extra+=(--user "$user" --password "$pass") + fi + ui_run "Zugangsdaten pruefen" bash -c \ + "cd '$PROJECT_DIR' && NO_COLOR=1 '$SELF' image test --edition '$ed' --version '$ver' ${extra[*]+${extra[*]}}" +} + gui_image_pull() { local ed ver user pass ed="$(gui_image_pick_edition)" || return