|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# Get the schema registry URL from the config. |
| 4 | +ss_url=$(grep -E '^key.converter.schema.registry.url=' /tmp/strimzi-connect.properties | cut -d'=' -f2) |
| 5 | + |
| 6 | +# If the schema registry URL is not set, exit... |
| 7 | +if [ -z "$ss_url" ]; then |
| 8 | + echo "Schema registry URL is not set in strimzi-connect.properties." |
| 9 | + echo "We will not check for schema registry availability." |
| 10 | + exit 0 |
| 11 | +fi |
| 12 | + |
3 | 13 | echo "===> Checking if Schema Registry is available ..." |
4 | 14 |
|
5 | | -if [ -z "$CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL" ]; then |
6 | | - echo "CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL is not defined" |
7 | | -else |
8 | | - tries=10 |
9 | | - timeout=1 |
10 | | - while true; do |
11 | | - if wget --spider -q "${CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL}/subjects" 2>/dev/null; then |
12 | | - echo "Schema registry available." |
13 | | - break |
14 | | - fi |
15 | | - tries=$((tries - 1)) |
16 | | - if [ $tries -eq 0 ]; then |
17 | | - echo "FAILED TO REACH SCHEMA REGISTRY." |
18 | | - exit 6 |
19 | | - fi |
20 | | - echo "Failed to reach schema registry. Retrying in ${timeout} seconds." |
21 | | - sleep ${timeout} |
22 | | - if [ ${timeout} -lt ${max_timeout} ]; then |
23 | | - timeout=$((timeout * 2)) |
24 | | - fi |
25 | | - done |
| 15 | +tries=10 |
| 16 | +timeout=1 |
| 17 | +while true; do |
| 18 | + if wget --spider -q "${ss_url}/subjects" 2>/dev/null; then |
| 19 | + echo "Schema registry available." |
| 20 | + break |
| 21 | + fi |
| 22 | + tries=$((tries - 1)) |
| 23 | + if [ $tries -eq 0 ]; then |
| 24 | + echo "FAILED TO REACH SCHEMA REGISTRY." |
| 25 | + exit 6 |
| 26 | + fi |
| 27 | + echo "Failed to reach schema registry. Retrying in ${timeout} seconds." |
| 28 | + sleep ${timeout} |
| 29 | + if [ ${timeout} -lt ${max_timeout} ]; then |
| 30 | + timeout=$((timeout * 2)) |
| 31 | + fi |
| 32 | +done |
26 | 33 |
|
27 | | - echo "Schema registry is available." |
28 | | -fi |
| 34 | +echo "Schema registry is available." |
0 commit comments