File tree Expand file tree Collapse file tree 3 files changed +38
-32
lines changed
share/github-backup-utils Expand file tree Collapse file tree 3 files changed +38
-32
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ prefix="$2"
28
28
role=$( echo " $prefix " | cut -d ' -' -f1)
29
29
30
30
if ghe-ssh " $GHE_HOSTNAME " test -f $GHE_REMOTE_ROOT_DIR /etc/github/cluster; then
31
- node_uuids=$( ghe-ssh " $GHE_HOSTNAME " ghe-cluster-each -r " $role " -u)
31
+ node_uuids=$( ghe-ssh " $GHE_HOSTNAME " /usr/local/bin/ ghe-cluster-nodes -r " $role " -u | cut -f 2 )
32
32
hostnames=' '
33
33
for uuid in $node_uuids ; do
34
34
hostnames+=" $prefix -$uuid "
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
- # Usage: ghe-config
3
- # Emulates the remote GitHub ghe-config command. Tests use this
2
+ # Usage: ghe-cluster-each
3
+ # Emulates the remote GitHub ghe-cluster-each command. Tests use this
4
4
# to assert that the command was executed.
5
5
set -e
6
6
7
7
for _ in " $@ " ; do
8
8
case " $1 " in
9
- -u)
10
- SHOW_UUID=true
11
- shift
12
- ;;
13
- -r|--role)
14
- # fake change last save timestamp every 1s
15
- ROLE=$2
16
- shift
17
- shift
18
- ;;
19
9
--)
20
10
if [ " $1 " = " --" ]; then
21
11
shift
@@ -43,22 +33,3 @@ if [ "$COMMAND" == "/usr/local/share/enterprise/ghe-nomad-cleanup" ]; then
43
33
echo " nomad cleanup"
44
34
exit 0
45
35
fi
46
-
47
- if $SHOW_UUID ; then
48
- CONFIG=" $GHE_REMOTE_DATA_USER_DIR /common/cluster.conf"
49
-
50
- hosts=$( git config -f $CONFIG --get-regexp cluster.* .hostname | cut -d ' ' -f2)
51
-
52
- if [ -z " $hosts " ]; then
53
- # Mimic `ghe-cluster-each $role -u`
54
- echo " fake-uuid
55
- fake-uuid1
56
- fake-uuid2
57
- "
58
- else
59
- for hostname in $hosts ; do
60
- [ -n " $ROLE " ] && [ " $( git config -f $CONFIG cluster.$hostname .$ROLE -server) " != " true" ] && continue
61
- echo $hostname
62
- done
63
- fi
64
- fi
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # Usage: ghe-cluster-nodes
3
+ # Emulates the remote GitHub ghe-cluster-nodes command. Tests use this
4
+ # to assert that the command was executed.
5
+ set -e
6
+
7
+ for _ in " $@ " ; do
8
+ case " $1 " in
9
+ -r|--role)
10
+ MATCH_ROLE=$2
11
+ shift
12
+ ;;
13
+ -u|--uuid)
14
+ PRINT_UUIDS=true
15
+ shift
16
+ ;;
17
+ esac
18
+ done
19
+
20
+ CONFIG=" $GHE_REMOTE_DATA_USER_DIR /common/cluster.conf"
21
+
22
+ hosts=$( git config -f $CONFIG --get-regexp cluster.* .hostname | cut -d ' ' -f2)
23
+
24
+ for hostname in $hosts ; do
25
+ [ -n " $MATCH_ROLE " ] && [ " $( git config -f $CONFIG cluster.$hostname .$MATCH_ROLE -server) " != " true" ] && continue
26
+
27
+ print_line=" $hostname "
28
+
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
You can’t perform that action at this time.
0 commit comments