Skip to content

Commit 7307f1f

Browse files
committed
return fake uuids when cluster.conf doesn't exist
Or it's invalid, which it is for most of these tests.
1 parent 5e2068e commit 7307f1f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

test/bin/ghe-cluster-nodes

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,21 @@ CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf"
2121

2222
hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2)
2323

24-
for hostname in $hosts; do
25-
[ -n "$MATCH_ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$MATCH_ROLE-server)" != "true" ] && continue
24+
if $PRINT_UUIDS; then
25+
CONFIG="$GHE_REMOTE_DATA_USER_DIR/common/cluster.conf"
2626

27-
print_line="$hostname"
27+
hosts=$(git config -f $CONFIG --get-regexp cluster.*.hostname | cut -d ' ' -f2)
2828

29-
if [ -n "$PRINT_UUIDS" ]; then
30-
uuid="$(ghe-config cluster.$hostname.uuid || true)"
31-
print_line="$print_line\t$uuid"
32-
fi
33-
34-
echo -e "${print_line#\\t}"
35-
done
29+
if [ -z "$hosts" ]; then
30+
# Mimic `ghe-cluster-each $role -u`
31+
echo "fake-uuid
32+
fake-uuid1
33+
fake-uuid2
34+
"
35+
else
36+
for hostname in $hosts; do
37+
[ -n "$ROLE" ] && [ "$(git config -f $CONFIG cluster.$hostname.$ROLE-server)" != "true" ] && continue
38+
echo $hostname
39+
done
40+
fi
41+
fi

0 commit comments

Comments
 (0)