Page MenuHomeVyOS Platform

ssh scripts should work with arguments again; they do not anymore
Needs reporter action, NormalPublicBUG

Description

Create two scripts.

automation.sh:

#!/usr/bin/env bash
set -x
SCRIPT_DIR=$(dirname "$0") || exit 1
HOST=$1
echo $HOST
ssh [email protected] '/bin/vbash -s' < "${SCRIPT_DIR}/some_script.sh" "${HOST}"

some_script.sh:

#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
HOSTNAME="$1"
# Load VyOS environment
echo $HOSTNAME

Now, with both scripts in the local directory, run

./automation.sh test

Observe on the local side, "test" is printed.
On the remote side, "1" is printed. "test" is expected.

This worked with 1.3.

$ show version
Version:          VyOS 1.5-rolling-202401260023
Release train:    current

Built by:         [email protected]
Built on:         Fri 26 Jan 2024 02:16 UTC
Build UUID:       a910324d-c275-44d3-b026-bde38781fd97
Build commit ID:  6c6a5856122790

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  HP
Hardware model:   HP EliteDesk 800 G5 Desktop Mini
Hardware S/N:     MXL95025NY
Hardware UUID:    800b5dc3-e6c8-ba65-0bcb-dc6bfdfbccb2

Copyright:        VyOS maintainers and contributors

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.5-rolling-202401260023
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change
Issue type
Bug (incorrect behavior)

Event Timeline

Viacheslav triaged this task as Normal priority.Feb 16 2024, 9:03 AM

Do not see the difference with 1.3.6

$ ./automation.sh te123
++ dirname ./automation.sh
+ SCRIPT_DIR=.
+ HOST=te123
+ echo 'local arg of host: te123'
local arg of host: te123
+ ssh [email protected] '/bin/vbash -s' te123
remote hostname: 1
Viacheslav changed the task status from Open to Needs reporter action.Feb 16 2024, 9:09 AM

interesting, it may have been broken sometime between 1.3.1 and 1.3.6 then. I used automations like these all the time. let me verify the behavior generally on ubuntu