devzone 7.5.5 → 7.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,125 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck shell=bash
3
- # devzone, module state: read, write, enable, disable (change_module).
4
- # Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
5
- # functions only, shared variables are defined in devzone.
6
-
7
- description() {
8
- case "$1" in
9
- ai) echo "AI assistants: Claude Code, opencode" ;;
10
- kubernetes) echo "connection to the host cluster and metrics-server at startup" ;;
11
- gitlab) echo "test GitLab in the services cluster" ;;
12
- postgres) echo "shared PostgreSQL, one database per project" ;;
13
- argocd) echo "Argo CD, deployment interface of the services cluster" ;;
14
- mysql) echo "shared MySQL, one database per project" ;;
15
- esac
16
- }
17
-
18
- is_known() {
19
- local m
20
- for m in "${MODULES[@]}"; do [ "$m" = "$1" ] && return 0; done
21
- return 1
22
- }
23
-
24
- # First start (no state): the state is created by Go state command (#879): old global
25
- # state taken over, backup copy restored, state rebuilt from the services
26
- # cluster, otherwise first installation
27
- init_state() {
28
- DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state init "${MODULES[@]}"
29
- }
30
-
31
- value_of() {
32
- init_state
33
- local v
34
- v="$(grep -E "^$1=" "$ETAT" | tail -1 | cut -d= -f2 || true)"
35
- [ "$v" = on ] && echo on || echo off
36
- }
37
-
38
- # State-file write delegated to Go (#879): lock, backup and atomic replace.
39
- write_value() {
40
- init_state || return 1
41
- DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state write "$1" "$2"
42
- }
43
-
44
- # Removes a key from the state file: the configuration of a service only exists
45
- # while it is chosen (#242)
46
- remove_key() {
47
- init_state || return 1
48
- DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove "$1"
49
- }
50
-
51
- # True if the file only holds the $schema key (created by opencode by default)
52
- only_schema_key() {
53
- local others
54
- others="$(grep -vcE '^[[:space:]]*([{}]|"?[$]schema"?[[:space:]]*:.*)?[[:space:]]*$' "$1" || true)"
55
- [ "$others" -eq 0 ] && grep -qF "\$schema" "$1"
56
- }
57
-
58
- # Message for the removed llm module (migration, #669).
59
- llm_removed_msg() {
60
- echo "devzone : llm module removed: devzone no longer hosts a model; the host (Ollama) models are detected instead (devzone ai). To free the disk: kubectl delete namespace devzone-llm"
61
- }
62
-
63
- # Drops the llm= state line when present and reports the removal once (#669).
64
- migrate_llm() {
65
- [ -f "$ETAT" ] || return 0
66
- grep -qE '^llm=' "$ETAT" 2>/dev/null || return 0
67
- DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove llm
68
- llm_removed_msg
69
- }
70
-
71
- change_module() {
72
- local m="${2:-}"
73
- if [ -z "$m" ]; then
74
- echo "devzone : unknown module : (none) ; modules : ${MODULES[*]}" >&2
75
- exit 1
76
- fi
77
- # llm removed (#669): migration message, never unknown module.
78
- if [ "$m" = llm ]; then
79
- init_state 2>/dev/null || true
80
- if [ -f "$ETAT" ] && grep -qE '^llm=' "$ETAT" 2>/dev/null; then
81
- DEVZONE_STATE="$ETAT" bash "${ICI:-$(dirname "${BASH_SOURCE[0]}")}/devzone" state remove llm
82
- fi
83
- llm_removed_msg
84
- return 1
85
- fi
86
- migrate_llm
87
- if ! is_known "$m"; then
88
- # An application of the catalog: the line is written, then applied
89
- if [ -f "$ICI/catalog/$m/app.conf" ]; then
90
- write_value "$m" "$1"
91
- DEVZONE_STATE="$ETAT" "$ICI/devzone" catalog apply
92
- return
93
- fi
94
- echo "devzone : unknown module : $m ; modules : ${MODULES[*]}" >&2
95
- exit 1
96
- fi
97
- # In the Kubernetes workspace pod the services are installed from the
98
- # workstation (#528): the pod has no administrator access to the cluster.
99
- # DEVZONE_SERVICES_ADMIN=1: run by services-admin.sh with a temporary one.
100
- if in_pod && service_module "$m" && [ -z "${DEVZONE_SERVICES_ADMIN:-}" ]; then
101
- if [ "$1" = on ]; then
102
- echo "devzone: in the workspace pod, $m is installed from the workstation: devzone workspace services enable $m" >&2
103
- else
104
- echo "devzone: in the workspace pod, $m is removed from the workstation: devzone workspace services disable $m" >&2
105
- fi
106
- return 2
107
- fi
108
- if [ "$1" = off ] && { [ "$m" = postgres ] || [ "$m" = mysql ] || [ "$m" = gitlab ]; }; then
109
- confirm_removal "$m" "${@:3}" || return 0
110
- fi
111
- write_value "$m" "$1"
112
- # Services held by Argo CD (#559): postgres and mysql, plus the release
113
- # of the Applications when argocd is turned off. gitlab has its own path,
114
- # the other modules go straight to their installer (hook exit 3).
115
- if [ "$m" = postgres ] || [ "$m" = mysql ] || { [ "$m" = argocd ] && [ "$1" = off ]; }; then
116
- # 0 done by Argo CD, 3 helm direct as before, else failed
117
- if DEVZONE_STATE="$ETAT" "$ICI/devzone" argocd services-hook "$m" "$1" "${@:3}"; then return 0; elif [ $? -ne 3 ]; then return 1; fi
118
- fi
119
- # The assistant part of enable/disable ai runs in the Go command (#882).
120
- if [ "$m" = ai ]; then
121
- DEVZONE_STATE="$ETAT" "$ICI/devzone" ai apply "$1" "${@:3}"
122
- else
123
- "apply_$m" "$1" "${@:3}"
124
- fi
125
- }
@@ -1,189 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck shell=bash
3
- # devzone, platform: GitHub or GitLab.
4
- # Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
5
- # functions only, shared variables are defined in devzone.
6
-
7
-
8
- # ---- Platform: GitHub (default) or GitLab (#240) ----
9
- # Choice kept in the state file (platform=, gitlab_url=), per instance; the
10
- # configuration of a service only exists while it is chosen (#242): glab and the
11
- # URL disappear when going back to github.
12
-
13
- # Current platform: github when there is no line (default)
14
- platform_read() {
15
- local v
16
- v="$(grep -E '^platform=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2 || true)"
17
- [ "$v" = gitlab ] && echo gitlab || echo github
18
- }
19
-
20
- # URL of the GitLab instance, nothing if missing
21
- gitlab_url_read() {
22
- grep -E '^gitlab_url=' "$ETAT" 2>/dev/null | tail -1 | cut -d= -f2- || true
23
- }
24
-
25
- # Host of a URL, without its protocol (glab --hostname)
26
- host_of() {
27
- echo "$1" | sed -E 's#^[a-z]+://##; s#/$##'
28
- }
29
-
30
- # Removes glab and its configuration (back to github)
31
- remove_glab() {
32
- rm -f "$GLAB"
33
- rm -rf "$HOME/.config/glab-cli"
34
- }
35
-
36
- # State line for the platform: github by default, or the GitLab instance with
37
- # its connected glab on the login command otherwise
38
- platform_line() {
39
- local url host
40
- if [ "$(platform_read)" = gitlab ]; then
41
- url="$(gitlab_url_read)"
42
- host="$(host_of "$url")"
43
- if [ -x "$GLAB" ] && "$GLAB" auth status --hostname "$host" >/dev/null 2>&1; then
44
- printf ' ✔ platform gitlab: %s, glab connected\n' "$url"
45
- else
46
- printf ' ⚠ platform gitlab: %s, glab not connected: glab auth login --hostname %s\n' "$url" "$host"
47
- fi
48
- else
49
- echo " ✔ platform github"
50
- fi
51
- }
52
-
53
- # Simple display of the platform (devzone platform)
54
- platform_summary() {
55
- local url host
56
- if [ "$(platform_read)" = gitlab ]; then
57
- url="$(gitlab_url_read)"
58
- host="$(host_of "$url")"
59
- if [ -x "$GLAB" ] && "$GLAB" auth status --hostname "$host" >/dev/null 2>&1; then
60
- echo "devzone : gitlab platform: $url, glab connected"
61
- else
62
- echo "devzone : gitlab platform: $url, glab not connected: glab auth login --hostname $host"
63
- fi
64
- else
65
- echo "devzone : github platform (default)"
66
- fi
67
- }
68
-
69
- # Installs glab (official release, SHA-256 sum checked), nothing if it is
70
- # already there; the binary ends in ~/.local/bin (remove_glab removes it)
71
- install_glab() {
72
- local arch="" sum archive folder glab_tmp
73
- if [ -x "$GLAB" ] && "$GLAB" --version >/dev/null 2>&1; then
74
- return 0
75
- fi
76
- case "$(uname -m)" in
77
- arm64 | aarch64) arch=arm64 sum="$GLAB_SOMME_ARM64" ;;
78
- *) arch=amd64 sum="$GLAB_SOMME_AMD64" ;;
79
- esac
80
- echo "devzone : downloading glab $GLAB_VERSION (SHA-256 checked)…"
81
- archive="$(mktemp)"
82
- if ! curl -fsSL -o "$archive" "https://gitlab.com/gitlab-org/cli/-/releases/$GLAB_VERSION/downloads/glab_${GLAB_VERSION#v}_linux_${arch}.tar.gz"; then
83
- rm -f "$archive"
84
- echo "devzone : glab download failed (official gitlab.com release); retry: devzone platform gitlab --url URL" >&2
85
- return 1
86
- fi
87
- if [ "$(sha256sum "$archive" | cut -d' ' -f1)" != "$sum" ]; then
88
- rm -f "$archive"
89
- echo "devzone : glab SHA-256 sum unexpected, aborting; archive refused" >&2
90
- return 1
91
- fi
92
- folder="$(mktemp -d)"
93
- glab_tmp="$folder/bin/glab"
94
- if ! tar -xzf "$archive" -C "$folder" || [ ! -f "$glab_tmp" ]; then
95
- glab_tmp="$folder/glab"
96
- fi
97
- if [ ! -f "$glab_tmp" ]; then
98
- rm -rf "$folder" "$archive"
99
- echo "devzone : glab binary missing from the archive, aborting" >&2
100
- return 1
101
- fi
102
- mkdir -p "$HOME/.local/bin"
103
- mv "$glab_tmp" "$GLAB"
104
- chmod +x "$GLAB"
105
- rm -rf "$folder" "$archive"
106
- }
107
-
108
- # Login to the GitLab instance: instance of the gitlab module -> root token of
109
- # the module (http protocol, never shown); another instance -> interactive, a
110
- # browser asking for the login code. Checks: exit code of the auth login, then
111
- # auth status --hostname; without that check, not "connected".
112
- connect_glab() {
113
- local host="$1" url="$2" token
114
- if [ "$url" = "$GITLAB_URL_MODULE" ]; then
115
- if [ ! -f "$RACINE/workspace/.gitlab/root-token" ]; then
116
- echo "devzone : root token of the gitlab module not found ($RACINE/workspace/.gitlab/root-token): devzone enable gitlab, or by hand: glab auth login --hostname $host" >&2
117
- return 1
118
- fi
119
- token="$(cat "$RACINE/workspace/.gitlab/root-token")"
120
- if ! "$GLAB" auth login --hostname "$host" --api-protocol http --git-protocol http --token "$token"; then
121
- echo "devzone : cannot connect to the gitlab instance: devzone enable gitlab, or by hand: glab auth login --hostname $host" >&2
122
- return 1
123
- fi
124
- elif ! "$GLAB" auth login --hostname "$host"; then
125
- echo "devzone : cannot connect to the gitlab instance: glab auth login --hostname $host" >&2
126
- return 1
127
- fi
128
- if ! "$GLAB" auth status --hostname "$host" >/dev/null 2>&1; then
129
- echo "devzone : cannot verify the connection: glab auth status --hostname $host" >&2
130
- return 1
131
- fi
132
- }
133
-
134
- # Changes the platform: github (default, current behaviour) or gitlab
135
- change_platform() {
136
- local target="${1:-}" url="" expect="" arg host
137
- case "$target" in
138
- github)
139
- # Removes the credential setting of the last gitlab host, if there is one
140
- if [ -n "$(gitlab_url_read)" ]; then
141
- git config --global --unset-all "credential.$(gitlab_url_read).helper" 2>/dev/null || true
142
- fi
143
- remove_glab
144
- remove_key platform
145
- remove_key gitlab_url
146
- echo "devzone : github platform (default): gh checks; glab and its configuration removed if they were installed"
147
- ;;
148
- gitlab)
149
- for arg in "${@:2}"; do
150
- if [ -n "$expect" ]; then url="$arg"; expect=""; continue; fi
151
- case "$arg" in
152
- --url) expect=1 ;;
153
- *) echo "devzone : unknown argument: $arg (devzone platform gitlab --url URL)" >&2; return 1 ;;
154
- esac
155
- done
156
- if [ -n "$expect" ]; then
157
- echo "devzone : --url expects a URL" >&2
158
- return 1
159
- fi
160
- if [ -z "$url" ]; then
161
- if [ "$(value_of gitlab)" = on ]; then
162
- url="$GITLAB_URL_MODULE"
163
- else
164
- echo "devzone : missing URL: devzone platform gitlab --url URL (or an active gitlab module for the local instance)" >&2
165
- return 1
166
- fi
167
- fi
168
- host="$(host_of "$url")"
169
- if ! install_glab; then
170
- return 1
171
- fi
172
- if ! connect_glab "$host" "$url"; then
173
- echo "devzone : reconnect needed: glab auth login --hostname $host" >&2
174
- return 1
175
- fi
176
- if ! git config --global "credential.$url.helper" "!$GLAB auth git-credential"; then
177
- echo "devzone : cannot set the git credential" >&2
178
- return 1
179
- fi
180
- write_value platform gitlab
181
- write_value gitlab_url "$url"
182
- echo "devzone : gitlab platform: $url, glab connected"
183
- ;;
184
- *)
185
- echo "devzone : unknown platform: ${target:-(none)}; choices: github (default) or gitlab [--url URL]" >&2
186
- return 1
187
- ;;
188
- esac
189
- }
@@ -1,242 +0,0 @@
1
- #!/usr/bin/env bash
2
- # shellcheck shell=bash
3
- # devzone, services of the cluster and their apply functions.
4
- # Sourced by .devcontainer/devzone (split of the 1 600 lines file, #722):
5
- # functions only, shared variables are defined in devzone.
6
-
7
- # Runs a long command, writing "still running" every DEVZONE_PROGRESS s on
8
- # stderr: a silent installation looks blocked (#195)
9
- with_progress() {
10
- local step="${DEVZONE_PROGRESS:-30}" elapsed=0 pid code=0
11
- "$@" &
12
- pid=$!
13
- while kill -0 "$pid" 2>/dev/null; do
14
- sleep 1
15
- elapsed=$((elapsed + 1))
16
- if [ $((elapsed % step)) -eq 0 ] && kill -0 "$pid" 2>/dev/null; then
17
- echo "devzone : … still running (${elapsed} s)" >&2
18
- fi
19
- done
20
- wait "$pid" || code=$?
21
- return "$code"
22
- }
23
-
24
- # File that marks an active module in failure (content: where to look); next to
25
- # the state, in its volume: the state shows it at each startup
26
- failure_marker_file() {
27
- echo "$ETAT-failed-$1"
28
- }
29
-
30
- # Services in the Kubernetes workspace pod (#528): gitlab, postgres and argocd
31
- # live in the cluster, installed from the workstation (devzone workspace
32
- # services). The pod has no kubeconfig and a limited account (#430): their
33
- # presence is the cluster DNS (like #515), never an installer failure marker.
34
- in_pod() {
35
- [ "${DEVZONE_WORKSPACE:-}" = kubernetes ]
36
- }
37
-
38
- service_module() {
39
- case "$1" in
40
- gitlab | postgres | argocd) return 0 ;;
41
- esac
42
- return 1
43
- }
44
-
45
- # DNS name of the service of a module: <service>.<namespace>.svc
46
- service_dns() {
47
- case "$1" in
48
- gitlab) echo "gitlab-webservice-default.devzone-gitlab${INSTANCE_SUFFIX}.svc" ;;
49
- postgres) echo "postgres.devzone-postgres.svc" ;;
50
- argocd) echo "argocd-server.devzone-argocd.svc" ;;
51
- esac
52
- }
53
-
54
- service_present() {
55
- getent hosts "$(service_dns "$1")" >/dev/null 2>&1
56
- }
57
-
58
- # Status line of a service module in the pod: present → active; absent → the
59
- # workstation command that installs it
60
- service_pod_line() {
61
- local m="$1"
62
- if service_present "$m"; then
63
- printf ' ✔ module %-10s active: %s (%s)\n' "$m" "$(description "$m")" "$(service_dns "$m")"
64
- elif [ "$(value_of "$m")" = on ]; then
65
- printf ' ⚠ module %-10s not in the cluster: on the workstation, devzone workspace services enable %s\n' "$m" "$m"
66
- else
67
- printf ' ○ module %-10s optional, %s: on the workstation, devzone workspace services enable %s\n' "$m" "$(description "$m")" "$m"
68
- fi
69
- }
70
-
71
- # devzone apply of a service module: in the Kubernetes workspace pod nothing
72
- # is installed (the workstation does it, #528) and the failure marker of an
73
- # earlier start is cleared; elsewhere, the installer of the module
74
- apply_service() {
75
- if in_pod; then
76
- rm -f "$(failure_marker_file "$1")"
77
- echo "devzone: $1 is installed from the workstation (devzone workspace services enable $1): nothing to do in the pod"
78
- return 0
79
- fi
80
- "apply_$1" on
81
- }
82
-
83
- apply_kubernetes() {
84
- if [ "$1" = on ]; then
85
- # Clusters are connected from the workstation; no script to run here.
86
- return 0
87
- else
88
- rm -f "$HOME/.kube/hote.config"
89
- # metrics-server removed from the clusters where devzone installed it
90
- # (devzone=installe marker set by the Go command); via its subcommand
91
- "$ICI/devzone" metrics remove || true
92
- echo "devzone : kubernetes disabled"
93
- fi
94
- }
95
-
96
- apply_gitlab() {
97
- local current_state
98
- if [ "$1" = on ]; then
99
- # Skip if the state is ready and the runner online; otherwise install resumes
100
- current_state="$("$ICI/devzone" gitlab status)"
101
- if [[ "$current_state" == *"ready"* && "$current_state" == *"runner online"* ]]; then
102
- echo "devzone : gitlab already active, nothing to do."
103
- # /etc/hosts regenerated by Docker: gitlab.localhost is set again here too
104
- "$ICI/devzone" gitlab host-set
105
- # Failure of an old run cleared: gitlab is ready (#366)
106
- rm -f "$(failure_marker_file gitlab)"
107
- else
108
- echo "devzone : activating gitlab via its installer…"
109
- if ! "$ICI/devzone" gitlab install; then
110
- echo "gitlab" > "$(failure_marker_file gitlab)"
111
- return 1
112
- fi
113
- rm -f "$(failure_marker_file gitlab)"
114
- fi
115
- else
116
- # Disable gitlab only if its namespace still exists
117
- if "$ICI/devzone" gitlab installed; then
118
- echo "devzone : deactivating gitlab…"
119
- if [ -n "${DELETE_DATA:-}" ]; then
120
- "$ICI/devzone" gitlab uninstall --yes
121
- else
122
- "$ICI/devzone" gitlab uninstall
123
- fi
124
- else
125
- echo "devzone : gitlab already deactivated (no devzone-gitlab namespace)."
126
- fi
127
- fi
128
- }
129
-
130
- # Shared PostgreSQL (#280): installed on the devzone cluster, chosen at the
131
- # first activation (--context, terminal menu, dedicated kind otherwise)
132
- apply_postgres() {
133
- local wanted="" confirm_ctx="" expect="" arg ctx actual current_state
134
- if [ "$1" = on ]; then
135
- for arg in "${@:2}"; do
136
- if [ -n "$expect" ]; then
137
- case "$expect" in
138
- context) wanted="$arg" ;;
139
- confirm) confirm_ctx="$arg" ;;
140
- esac
141
- expect=""
142
- continue
143
- fi
144
- case "$arg" in
145
- --context) expect=context ;;
146
- --confirm) expect=confirm ;;
147
- *) echo "devzone : unknown argument: $arg (devzone enable postgres --context CTX [--confirm CTX])" >&2; write_value postgres off; return 2 ;;
148
- esac
149
- done
150
- if [ -n "$expect" ]; then
151
- echo "devzone : $expect expects a context" >&2
152
- write_value postgres off
153
- return 2
154
- fi
155
- actual="$("$ICI/devzone" kube saved)"
156
- if [ -n "$wanted" ] && [ -n "$actual" ] && [ "$wanted" != "$actual" ]; then
157
- echo "devzone : devzone services are on $actual; to change: devzone cluster $wanted" >&2
158
- write_value postgres off
159
- return 2
160
- fi
161
- if [ -n "$confirm_ctx" ]; then
162
- ctx="$("$ICI/devzone" kube choose "$wanted" --confirm "$confirm_ctx")" || { write_value postgres off; return 2; }
163
- else
164
- ctx="$("$ICI/devzone" kube choose "$wanted")" || { write_value postgres off; return 2; }
165
- fi
166
- # Choice kept before the installation: a resume targets the same cluster
167
- "$ICI/devzone" kube save "$ctx"
168
- current_state="$("$ICI/devzone" postgres status)"
169
- # "relay stopped" first: this line also starts with "ready on"
170
- if [[ "$current_state" == *"relay stopped"* ]]; then
171
- "$ICI/devzone" postgres relay-start
172
- echo "devzone : postgres : relay restarted"
173
- elif [[ "$current_state" == "ready on"* ]]; then
174
- echo "devzone : postgres already active, nothing to do."
175
- elif ! "$ICI/devzone" postgres install; then
176
- echo "postgres" >"$(failure_marker_file postgres)"
177
- return 1
178
- fi
179
- rm -f "$(failure_marker_file postgres)"
180
- else
181
- "$ICI/devzone" postgres uninstall
182
- rm -f "$(failure_marker_file postgres)"
183
- fi
184
- }
185
-
186
- # Argo CD (#411): installed in the services cluster, access through the relay
187
- # 127.0.0.1:8443; a failure is marked in the state and resumed by devzone apply
188
- apply_argocd() {
189
- local current_state
190
- if [ "$1" = on ]; then
191
- current_state="$("$ICI/devzone" argocd status)"
192
- # "relay stopped" first: this line also starts with "ready"
193
- if [[ "$current_state" == *"relay stopped"* ]]; then
194
- "$ICI/devzone" argocd relay-start
195
- echo "devzone : argocd : relay restarted"
196
- elif [[ "$current_state" == "ready"* ]]; then
197
- echo "devzone : argocd already active, nothing to do."
198
- elif ! "$ICI/devzone" argocd install; then
199
- echo "argocd" >"$(failure_marker_file argocd)"
200
- return 1
201
- fi
202
- rm -f "$(failure_marker_file argocd)"
203
- else
204
- "$ICI/devzone" argocd uninstall
205
- rm -f "$(failure_marker_file argocd)"
206
- fi
207
- }
208
-
209
- # Catalog MySQL (#414): same logic as postgres (relay restarted if stopped),
210
- # installation delegated to the Go module
211
- apply_mysql() {
212
- local current_state ctx
213
- if [ "$1" = on ]; then
214
- ctx="$(cluster_saved)"
215
- if [ -z "$ctx" ]; then
216
- echo "devzone : mysql: no cluster chosen: devzone enable mysql" >&2
217
- write_value mysql off
218
- echo mysql >"$(failure_marker_file mysql)"
219
- return 2
220
- fi
221
- current_state="$("$ICI/devzone" mysql status)"
222
- # "relay stopped" first: this line also starts with "ready on"
223
- if [[ "$current_state" == *"relay stopped"* ]]; then
224
- "$ICI/devzone" mysql relay-start
225
- echo "devzone : mysql: relay restarted"
226
- elif [[ "$current_state" == "ready on"* ]]; then
227
- echo "devzone : mysql already active, nothing to do."
228
- elif ! "$ICI/devzone" mysql install; then
229
- echo mysql >"$(failure_marker_file mysql)"
230
- return 1
231
- fi
232
- rm -f "$(failure_marker_file mysql)"
233
- else
234
- # Removal without deleting the data: volume kept (#441); the databases
235
- # only leave with a yes (confirm_removal)
236
- DEVZONE_STATE="$ETAT" "$ICI/devzone" catalog remove mysql
237
- if [ -n "${DELETE_DATA:-}" ]; then
238
- "$ICI/devzone" mysql delete-data --yes
239
- fi
240
- rm -f "$(failure_marker_file mysql)"
241
- fi
242
- }