summaryrefslogtreecommitdiffstats
path: root/bin/opssh
diff options
context:
space:
mode:
authorAndrew Butcher <abutcher@redhat.com>2016-05-25 11:15:10 -0400
committerAndrew Butcher <abutcher@redhat.com>2016-05-25 11:15:10 -0400
commit4c911eeed06fa433b5ac78dbf644ce923d7411e0 (patch)
treed39395c1fb4f45a469627fa74ff290992b7c4e41 /bin/opssh
parent00eba039c9312fbd04cc05a8a890ef48f2311769 (diff)
downloadopenshift-4c911eeed06fa433b5ac78dbf644ce923d7411e0.tar.gz
openshift-4c911eeed06fa433b5ac78dbf644ce923d7411e0.tar.bz2
openshift-4c911eeed06fa433b5ac78dbf644ce923d7411e0.tar.xz
openshift-4c911eeed06fa433b5ac78dbf644ce923d7411e0.zip
Cleanup bin, test and roles/openshift_ansible_inventory following move to openshift-tools
Diffstat (limited to 'bin/opssh')
-rwxr-xr-xbin/opssh154
1 files changed, 0 insertions, 154 deletions
diff --git a/bin/opssh b/bin/opssh
deleted file mode 100755
index 0113e7216..000000000
--- a/bin/opssh
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-# vim: expandtab:tabstop=4:shiftwidth=4
-
-
-function usage() {
- cat << EOF
-Usage: opssh [OPTIONS] command [...]
-
-Options:
- --version show program's version number and exit
- --help show this help message and exit
- -l USER, --user=USER username (OPTIONAL)
- -p PAR, --par=PAR max number of parallel threads (OPTIONAL)
- --outdir=OUTDIR output directory for stdout files (OPTIONAL)
- --errdir=ERRDIR output directory for stderr files (OPTIONAL)
- -c CLUSTER, --cluster CLUSTER
- which cluster to use
- -e ENV, --env ENV which environment to use
- --v3 When working with v3 environments. v2 by default
- -t HOST_TYPE, --host-type HOST_TYPE
- which host type to use
- --list-host-types list all of the host types
- --timeout=TIMEOUT timeout (secs) (0 = no timeout) per host (OPTIONAL)
- -O OPTION, --option=OPTION
- SSH option (OPTIONAL)
- -v, --verbose turn on warning and diagnostic messages (OPTIONAL)
- -A, --askpass Ask for a password (OPTIONAL)
- -x ARGS, --extra-args=ARGS
- Extra command-line arguments, with processing for
- spaces, quotes, and backslashes
- -X ARG, --extra-arg=ARG
- Extra command-line argument
- -i, --inline inline aggregated output and error for each server
- --inline-stdout inline standard output for each server
- -I, --send-input read from standard input and send as input to ssh
- -P, --print print output as we get it
-
-Example: opssh -t ex-srv -e stg -l irb2 --outdir /tmp/foo uptime
-
-EOF
-}
-
-if [ $# -eq 0 ] || [ "$1" == "--help" ]
-then
- usage
- exit 1
-fi
-
-# See if ohi is installed
-if ! which ohi &>/dev/null ; then
- echo "ERROR: can't find ohi (OpenShift Host Inventory) on your system, please either install the openshift-ansible-bin package, or add openshift-ansible/bin to your path."
-
- exit 10
-fi
-
-PAR=200
-USER=root
-TIMEOUT=0
-ENV=""
-HOST_TYPE=""
-
-while [ $# -gt 0 ] ; do
- case $1 in
- -t|--host-type)
- shift # get past the option
- HOST_TYPE=$1
- shift # get past the value of the option
- ;;
-
- -c)
- shift # get past the option
- CLUSTER=$1
- shift # get past the value of the option
- ;;
-
- -e)
- shift # get past the option
- ENV=$1
- shift # get past the value of the option
- ;;
-
- --v3)
- OPENSHIFT_VERSION="--v3 --ip"
- shift # get past the value of the option
- ;;
-
- --timeout)
- shift # get past the option
- TIMEOUT=$1
- shift # get past the value of the option
- ;;
-
- -p|--par)
- shift # get past the option
- PAR=$1
- shift # get past the value of the option
- ;;
-
- -l|--user)
- shift # get past the option
- USER=$1
- shift # get past the value of the option
- ;;
-
- --list-host-types)
- ohi --list-host-types
- exit 0
- ;;
-
- -h|--hosts|-H|--host|-o)
- echo "ERROR: unknown option $1"
- exit 20
- ;;
-
- *)
- args+=("$1")
- shift
- ;;
- esac
-done
-
-# Get host list from ohi
-CMD=""
-if [ -n "$CLUSTER" ] ; then
- CMD="$CMD -c $CLUSTER"
-fi
-
-if [ -n "$ENV" ] ; then
- CMD="$CMD -e $ENV"
-fi
-
-if [ -n "$HOST_TYPE" ] ; then
- CMD="$CMD -t $HOST_TYPE"
-fi
-
-if [ -n "$OPENSHIFT_VERSION" ] ; then
- CMD="$CMD $OPENSHIFT_VERSION"
-fi
-
-if [ -n "$CMD" ] ; then
- HOSTS="$(ohi $CMD 2>/dev/null)"
- OHI_ECODE=$?
-fi
-
-if [ $OHI_ECODE -ne 0 ] ; then
- echo
- echo "ERROR: ohi failed with exit code $OHI_ECODE"
- echo
- echo "This is usually caused by a bad value passed for host-type or environment."
- echo
- exit 25
-fi
-
-exec pssh -t $TIMEOUT -p $PAR -l $USER -h <(echo "$HOSTS") "${args[@]}"