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.


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.


So it turns out that there is an argument that is implied when you invoke a command from Fabric called shell=True. To get things to work correctly I had to specify an argument shell=False.

So for example, here is a command that I was running that was failing.

def config_t():
  run("config t")

Which was producing the Line has invalid autocommand "/bin/bash -l -c "config t"" error. Change your command to include the shell=False

def config_t():
    run("config t", shell=False)

Everything ran smoothly for me after I made this change. For more information there is a section in the documentation describing this. Fabric docs.


I'm not familiar with Fabric, but from the error, it's clear it's attempting to run a shell (bash) to run your selected command. IOS devices don't have a "shell"; simply give the CLI the command to run.

(In other words, Fabric doesn't appear to be designed to talk to anything that's not a UNIX(tm) system.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.