Will Lopez
Will Lopez

Reputation: 2119

fabric command in local context is failing grep command

I'm on OS X using boot2docker. I'm trying to use fabric to simplify running docker containers for our QA's.

Running this command...

  containerFound = fab.local('docker ps -a | grep nodejs', capture=True)
  # this didn't work either if fab.local('docker ps -a | grep nodejs').succeeded

generates the following error:

Fatal error: local() encountered an error (return code 1) while executing 'docker ps -a | grep nodejs'

Is this an issue using boot2docker. I tried using sudo as well but nothing. I believe boot2docker runs as root anyways so sudo isn't needed.

Upvotes: 0

Views: 329

Answers (1)

jw.john
jw.john

Reputation: 362

In Fabric 1.3.2 at least, you can recover the exception by catching the SystemExit exception. That's helpful if you have more than one command to run in a batch (like a deploy) and want to cleanup if one of them fails.

Upvotes: 1

Related Questions