diff --git a/contrib/bin/user-ssh-list b/contrib/bin/user-ssh-list index 32cc829..873c316 100755 --- a/contrib/bin/user-ssh-list +++ b/contrib/bin/user-ssh-list @@ -26,8 +26,12 @@ if [ "$query" = "all" ] ; then query="(clusto_type=server)" fi export CLUSTO_TYPE_FILTER="server" +args="" +if [ "$SSH_LIST_IGNORE_HOST_KEYS" -eq 1 ]; then + args="$args -o UserKnownHostsFile=/dev/null" +fi for h in $($CLUSTO $query | sort) ; do - ping -w1 -c1 -q $h > /dev/null 2>&1 + ping -w1 -c1 -q "$h" > /dev/null 2>&1 if [ $? -ne 0 ]; then continue fi @@ -36,5 +40,6 @@ for h in $($CLUSTO $query | sort) ; do else sed_cmd="s,^,$h | ," fi - ( ssh -o ConnectTimeout=3 -o StrictHostKeyChecking=no -l $username $h -- "$@" 2>&1 ) | sed -e "$sed_cmd" + $ar + ( ssh -o ConnectTimeout=3 -o StrictHostKeyChecking=no $args -l "$username" "$h" -- "$@" 2>&1 ) | sed -e "$sed_cmd" done diff --git a/contrib/bin/user-ssh-list-async b/contrib/bin/user-ssh-list-async index 2617668..ca991ba 100755 --- a/contrib/bin/user-ssh-list-async +++ b/contrib/bin/user-ssh-list-async @@ -17,10 +17,13 @@ def run_command_on(host, command, username): except Exception: print >>sys.stderr, 'Could not ping %s, moving on' % host return - cmd = [ + base_cmd = [ '/usr/bin/ssh', '-o', 'ConnectTimeout=3', '-o', - 'StrictHostKeyChecking=no', '-l', username, host, - ] + command + 'StrictHostKeyChecking=no', '-l', username, + ] + if os.environ.get('SSH_LIST_IGNORE_HOST_KEYS', False): + base_cmd += ['-o', 'UserKnownHostsFile=/dev/null'] + cmd = base_cmd + [host] + command p = subprocess.Popen( cmd,