How to run EdgeOS configuration commands in python fabric

I’m trying to programmatically update configuration in EdgeOS using a python script. I’m using fabric as an ssh client. https://docs.fabfile.org/en/latest/index.html

Below “—original question—” describes the problem, but I think I’ve hit on the source of the issue, but not the solution. Fabric ssh’s into the router in non-interactive mode, and as such doesn’t get the full bash configuration. The configure command isn’t available, nor show nor other router management commands. The .bashrc file in the router is this:

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# enable completion
source /etc/bash_completion.d/vyatta-cfg
source /etc/bash_completion.d/vyatta-op

unset HISTFILE

So I can see I’m not sourcing the bash_completion files. I tried doing that manually in python: c.run("source /etc/bash_completion.d/vyatta-cfg"), but it doesn’t seem to work. My next best solution is to find the hard path to those commands, but I’m not sure where to look.

—original question—

what I’d like to do is to create small configuration changes such as:

configure
set interfaces ethernet eth2 vif 20 disable
commit
save

However, the configure command fails when I run it through fabric. I notice, when I’m in an ssh session, the configure command creates a new sub-session or something. I’m not sure of the term.

$ configure
[edit]
#

script so far:

from fabric import Connection
c = Connection('routerip')
c.run("configure")

And the error:

vbash: configure: command not found
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/decorator.py", line 231, in fun
    return caller(func, *(extras + args), **kw)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/fabric/connection.py", line 23, in opens
    return method(self, *args, **kwargs)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/fabric/connection.py", line 763, in run
    return self._run(self._remote_runner(), command, **kwargs)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/invoke/context.py", line 113, in _run
    return runner.run(command, **kwargs)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/fabric/runners.py", line 83, in run
    return super().run(command, **kwargs)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/invoke/runners.py", line 395, in run
    return self._run_body(command, **kwargs)
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/invoke/runners.py", line 451, in _run_body
    return self.make_promise() if self._asynchronous else self._finish()
  File "/Users/me/opt/anaconda3/lib/python3.8/site-packages/invoke/runners.py", line 518, in _finish
    raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!

Command: 'configure'

Exit code: 127

Stdout: already printed

Stderr: already printed