Skip to content

Commit

Permalink
[OCPQE-18591] - add hpecmd for hpe SoL support (#65)
Browse files Browse the repository at this point in the history
* add hpecmd for hpe SoL support

* review
  • Loading branch information
bmanzari authored Jun 12, 2024
1 parent f6ca364 commit 0e177ab
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions images/fcos-bastion-image/root/usr/bin/hpecmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

function cleanup() {
rm -f $p
}

trap cleanup INT TERM

if [ "${#}" -lt 1 ]; then
echo "Usage: ${0} <host_id> <command>"
exit 1
fi

host_id="${1}"
shift

host_obj=$(sed 's/^#//' "/etc/hosts_pool_inventory" | yq -p csv '.[] | select(.bmc_address == "*'".${host_id}"'*")')

user=$(echo "${host_obj}" | yq -r '.bmc_user')
password=$(echo "${host_obj}" | yq -r '.bmc_pass')
address=$(echo "${host_obj}" | yq -r '.bmc_address')
echo -n "${address}: "
p=$(mktemp)
echo "${password}" > $p
sshpass -f $p ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=1000 "${user}"@"${address}" "${@}"

0 comments on commit 0e177ab

Please sign in to comment.