Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions contrib/bin/user-ssh-list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 6 additions & 3 deletions contrib/bin/user-ssh-list-async
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down