diff --git a/cmd/openshift-install/gather.go b/cmd/openshift-install/gather.go index f8331dff46d..83c6bcafe6b 100644 --- a/cmd/openshift-install/gather.go +++ b/cmd/openshift-install/gather.go @@ -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) diff --git a/data/data/bootstrap/files/usr/local/bin/installer-gather.sh b/data/data/bootstrap/files/usr/local/bin/installer-gather.sh index 254895a1f06..5a010e70430 100755 --- a/data/data/bootstrap/files/usr/local/bin/installer-gather.sh +++ b/data/data/bootstrap/files/usr/local/bin/installer-gather.sh @@ -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" @@ -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' ~/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}" diff --git a/data/data/bootstrap/files/usr/local/bin/installer-masters-gather.sh b/data/data/bootstrap/files/usr/local/bin/installer-masters-gather.sh index 4fd080ca099..8e674722a69 100755 --- a/data/data/bootstrap/files/usr/local/bin/installer-masters-gather.sh +++ b/data/data/bootstrap/files/usr/local/bin/installer-masters-gather.sh @@ -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 ..."