Using Fabric on a Cisco device : “Line has invalid autocommand”

cisco-catalystcisco-ios-12

I wasn't sure where to ask this but it seems to be something on the switch side so I thought I would start here first.

I am working on a little project to automate updates to config files in bulk using Fabric. I have everything installed and seemingly working correctly in Python and have gotten to the point where I am ready to start building some tests. However, all of the commands that I feed through Fabric come back with the following error:

Line has invalid autocommand "/bin/bash -l -c "X""

Where X is the command I am trying to run on the switch. I am having trouble understanding why this is failing, maybe somebody can offer an explaination? Is this something that needs to be configured on the Cisco side? I am testing this on a 3750 switch running 12.2, not sure what other details to provide.

Best Answer

Fabric is designed with a certain execution model; It assumes something, Bash by default, will run on the remote to execute your command.

You can change what the remote command is though. You might try changing the remote command into a single space for when you're sending commands to something like a CLI (eg, Cisco IOS).

See Fabric's Environment Dictionary about the 'shell' setting.