Scripting with VMWare Invoke-VMScript

Hello,

I am using VMWare’s Invoke-VMScript command to invoke a command on the VyOS box.

$script =@'
source /opt/vyatta/etc/functions/script-template
run show configuration
'@

Invoke-VMScript -vm $vm -ScriptText $script -GuestUser "vyos" -GuestPassword "vyos"

No matter what I try, I can not get the scripts to work succesfully.

As of now, I am getting: bash: run: command not found

Any information would be helpful.

Try it

/opt/vyatta/bin/vyatta-op-cmd-wrapper show interfaces

@Viacheslav
ScriptOutput
-----------------------------------------------------------------------------------------------------------------------| Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
| Interface IP Address S/L Description
| --------- ---------- — -----------
| Traceback (most recent call last):
| File “/usr/libexec/vyos/op_mode/show_interfaces.py”, line 301, in
| args.vrrp
| File “/usr/libexec/vyos/op_mode/show_interfaces.py”, line 221, in run_show_intf_brief
| descs = list(split_text(interface.get_alias(),56))
| File “/usr/libexec/vyos/op_mode/show_interfaces.py”, line 90, in split_text
| returned = cmd(‘stty size’)
| File “/usr/lib/python3/dist-packages/vyos/util.py”, line 178, in cmd
| raise OSError(code, feedback)
| PermissionError: [Errno 1] failed to run command: stty size
| returned:
| exit code: 1
|
-----------------------------------------------------------------------------------------------------------------------

With this command:
/opt/vyatta/bin/vyatta-op-cmd-wrapper set service ssh port 22

-----------------------------------------------------------------------------------------------------------------------|    Invalid command: set [service]
|  
|  
-----------------------------------------------------------------------------------------------------------------------

https://phabricator.vyos.net/T2946
Ttysize was mentioned here