Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/openshift-install/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ func logGatherBootstrap(bootstrap string, port int, masters []string, directory
if err != nil {
return errors.Wrap(err, "failed to create SSH client")
}
if err := ssh.Run(client, fmt.Sprintf("/usr/local/bin/installer-gather.sh %s", strings.Join(masters, " "))); err != nil {
gatherID := time.Now().Format("20060102150405")
if err := ssh.Run(client, fmt.Sprintf("/usr/local/bin/installer-gather.sh --id %s %s", gatherID, strings.Join(masters, " "))); err != nil {
return errors.Wrap(err, "failed to run remote command")
}
file := filepath.Join(directory, fmt.Sprintf("log-bundle-%s.tar.gz", time.Now().Format("20060102150405")))
if err := ssh.PullFileTo(client, "/home/core/log-bundle.tar.gz", file); err != nil {
file := filepath.Join(directory, fmt.Sprintf("log-bundle-%s.tar.gz", gatherID))
if err := ssh.PullFileTo(client, fmt.Sprintf("/home/core/log-bundle-%s.tar.gz", gatherID), file); err != nil {
return errors.Wrap(err, "failed to pull log file from remote")
}
logrus.Infof("Bootstrap gather logs captured here %q", file)
Expand Down
17 changes: 12 additions & 5 deletions data/data/bootstrap/files/usr/local/bin/installer-gather.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash

ARTIFACTS="/tmp/artifacts"
if test "x${1}" = 'x--id'
then
GATHER_ID="${2}"
shift 2
fi

ARTIFACTS="/tmp/artifacts-${GATHER_ID}"

echo "Gathering bootstrap journals ..."
mkdir -p "${ARTIFACTS}/bootstrap/journals"
Expand Down Expand Up @@ -112,8 +118,9 @@ do
echo "Collecting info from ${master}"
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null -q /usr/local/bin/installer-masters-gather.sh "core@${master}:"
mkdir -p "${ARTIFACTS}/control-plane/${master}"
ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null "core@${master}" -C 'sudo ./installer-masters-gather.sh' </dev/null
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null -r -q "core@${master}:/tmp/artifacts/*" "${ARTIFACTS}/control-plane/${master}/"
ssh -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null "core@${master}" -C "sudo ./installer-masters-gather.sh --id '${GATHER_ID}'" </dev/null
scp -o PreferredAuthentications=publickey -o StrictHostKeyChecking=false -o UserKnownHostsFile=/dev/null -r -q "core@${master}:/tmp/artifacts-${GATHER_ID}/*" "${ARTIFACTS}/control-plane/${master}/"
done
tar cz -C /tmp/artifacts . > ~/log-bundle.tar.gz
echo "Log bundle written to ~/log-bundle.tar.gz"
TAR_FILE="${TAR_FILE:-${HOME}/log-bundle-${GATHER_ID}.tar.gz}"
tar cz -C "${ARTIFACTS}" . >"${TAR_FILE}"
echo "Log bundle written to ${TAR_FILE}"
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#!/usr/bin/env bash

ARTIFACTS="${1:-/tmp/artifacts}"
if test "x${1}" = 'x--id'
then
GATHER_ID="${2}"
shift 2
fi

ARTIFACTS="/tmp/artifacts-${GATHER_ID}"
mkdir -p "${ARTIFACTS}"

echo "Gathering master journals ..."
Expand Down