summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wiest <twiest@users.noreply.github.com>2015-05-05 16:34:35 -0400
committerThomas Wiest <twiest@users.noreply.github.com>2015-05-05 16:34:35 -0400
commitb8851dc88428d5305f529456a44b33d75b5c1251 (patch)
tree21a6365c53dfc5b9736abf8651686034646fcca5
parenta7090d80d93186ab6875b0680143cd2b694d59cc (diff)
parenta61078e1411dd5b877b062a632a48d67921a5ada (diff)
downloadopenshift-b8851dc88428d5305f529456a44b33d75b5c1251.tar.gz
openshift-b8851dc88428d5305f529456a44b33d75b5c1251.tar.bz2
openshift-b8851dc88428d5305f529456a44b33d75b5c1251.tar.xz
openshift-b8851dc88428d5305f529456a44b33d75b5c1251.zip
Merge pull request #205 from twiest/pr
fixed opssh and opscp to allow just environment or just host-type.
-rwxr-xr-xbin/opscp30
-rwxr-xr-xbin/opssh31
2 files changed, 28 insertions, 33 deletions
diff --git a/bin/opscp b/bin/opscp
index 32fd341b9..391cb6696 100755
--- a/bin/opscp
+++ b/bin/opscp
@@ -102,28 +102,26 @@ while [ $# -gt 0 ] ; do
esac
done
-if [ -z "$ENV" ]
-then
+# Get host list from ohi
+if [ -n "$ENV" -a -n "$HOST_TYPE" ] ; then
+ HOSTS="$(ohi -t "$HOST_TYPE" -e "$ENV" 2>/dev/null)"
+ OHI_ECODE=$?
+elif [ -n "$ENV" ] ; then
+ HOSTS="$(ohi -e "$ENV" 2>/dev/null)"
+ OHI_ECODE=$?
+elif [ -n "$HOST_TYPE" ] ; then
+ HOSTS="$(ohi -t "$HOST_TYPE" 2>/dev/null)"
+ OHI_ECODE=$?
+else
echo
- echo "-e is a required paramemeter"
+ echo "Error: either -e or -t must be specified"
echo
exit 10
fi
-if [ -z "$HOST_TYPE" ]
-then
- echo
- echo "-t is a required paramemeter"
- echo
- exit 15
-fi
-
-# See if the ohi options are valid
-HOSTS="$(ohi -t "$HOST_TYPE" -e "$ENV" 2>/dev/null)"
-ECODE=$?
-if [ $ECODE -ne 0 ] ; then
+if [ $OHI_ECODE -ne 0 ] ; then
echo
- echo "ERROR: ohi failed with exit code $ECODE"
+ 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
diff --git a/bin/opssh b/bin/opssh
index 130549506..8ac526049 100755
--- a/bin/opssh
+++ b/bin/opssh
@@ -105,29 +105,26 @@ while [ $# -gt 0 ] ; do
esac
done
-if [ -z "$ENV" ]
-then
+# Get host list from ohi
+if [ -n "$ENV" -a -n "$HOST_TYPE" ] ; then
+ HOSTS="$(ohi -t "$HOST_TYPE" -e "$ENV" 2>/dev/null)"
+ OHI_ECODE=$?
+elif [ -n "$ENV" ] ; then
+ HOSTS="$(ohi -e "$ENV" 2>/dev/null)"
+ OHI_ECODE=$?
+elif [ -n "$HOST_TYPE" ] ; then
+ HOSTS="$(ohi -t "$HOST_TYPE" 2>/dev/null)"
+ OHI_ECODE=$?
+else
echo
- echo "-e is a required paramemeter"
+ echo "Error: either -e or -t must be specified"
echo
exit 10
fi
-if [ -z "$HOST_TYPE" ]
-then
- echo
- echo "-t is a required paramemeter"
- echo
- exit 15
-fi
-
-# See if the ohi options are valid
-HOSTS="$(ohi -t "$HOST_TYPE" -e "$ENV" 2>/dev/null)"
-ECODE=$?
-
-if [ $ECODE -ne 0 ] ; then
+if [ $OHI_ECODE -ne 0 ] ; then
echo
- echo "ERROR: ohi failed with exit code $ECODE"
+ 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