fix: use IP address for local node detection in ssh_exec
- Compare node IP against local IP instead of hostname - Fixes SSH permission issues when running on gitea-runner - gitea-runner (10.1.223.98) should execute commands directly for aitbc2
This commit is contained in:
@@ -58,8 +58,11 @@ ssh_exec() {
|
|||||||
local node="$1"
|
local node="$1"
|
||||||
local command="$2"
|
local command="$2"
|
||||||
|
|
||||||
# If node is localhost, execute directly without SSH
|
# Get local IP address
|
||||||
if [ "$node" = "localhost" ] || [ "$node" = "$(hostname)" ]; then
|
local local_ip=$(hostname -I | awk '{print $1}')
|
||||||
|
|
||||||
|
# If node is localhost or local IP, execute directly without SSH
|
||||||
|
if [ "$node" = "localhost" ] || [ "$node" = "$(hostname)" ] || [ "$node" = "$local_ip" ]; then
|
||||||
bash -c "$command" 2>&1 || return 1
|
bash -c "$command" 2>&1 || return 1
|
||||||
else
|
else
|
||||||
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$node" "$command" 2>&1 || return 1
|
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$node" "$command" 2>&1 || return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user