fabric

How to answer to prompts automatically with python fabric?

How to answer to prompts automatically with python fabric? Question: I want to run a command which prompts me to enter yes/no or y/n or whatever. If I just run the command local(“my_command”) then it stops and asks me for input. When I type what is needed, script continues to work. How can I automatically …

Total answers: 6

How to set the working directory for a Fabric task?

How to set the working directory for a Fabric task? Question: Assuming I define a trivial task to list files on a remote server: from fabric.api import run, env env.use_ssh_config = True def list_files(): run(‘ls’) And I execute it with: fab -H server list_files How can I specify the working directory for the command I’m …

Total answers: 2

Easy way to suppress output of fabric run?

Easy way to suppress output of fabric run? Question: I am running a command on the remote machine: remote_output = run(‘mysqldump –no-data –user=username –password={0} database’.format(password)) I would like to capture the output, but not have it all printed to the screen. What’s the easiest way to do this? Asked By: Ben McCann || Source Answers: …

Total answers: 6

Pass parameter to fabric task

Pass parameter to fabric task Question: How can I pass a parameter to a fabric task when calling “fab” from the command line? For example: def task(something=”): print “You said %s” % something $ fab task “hello” You said hello Done. Is it possible to do this without prompting with fabric.operations.prompt? Asked By: Donovan || …

Total answers: 5

How to start a background process with nohup using Fabric?

How to start a background process with nohup using Fabric? Question: Through Fabric, I am trying to start a celerycam process using the below nohup command. Unfortunately, nothing is happening. Manually using the same command, I could start the process but not through Fabric. Any advice on how can I solve this? def start_celerycam(): ”’Start …

Total answers: 10

How to git commit nothing without an error?

How to git commit nothing without an error? Question: I’m trying to write a fabric script that does a git commit; however, if there is nothing to commit, git exits with a status of 1. The deploy script takes that as unsuccessful, and quits. I do want to detect actual failures-to-commit, so I can’t just …

Total answers: 7

How to ForwardAgent yes using fabric?

How to ForwardAgent yes using fabric? Question: I am successfully run()ning commands on remote server with my private key pair. However, I’d like to do git clone ssh://private/repo on remote server using my local key (or using local ssh agent I’m in). How to do it using fabric? Asked By: Almad || Source Answers: The …

Total answers: 2

Fabric put command gives fatal error: 'No such file' exception

Fabric put command gives fatal error: 'No such file' exception Question: I’m using Fabric 1.01, and in my fabfile I’m using the put command. The line is: put(‘file.tar.gz’, ‘~/file.tar.gz’) The server is in the env.hosts list. file.tar.gz is in the same directory as the fabfile, and i’m running the code from this directory. When I …

Total answers: 3

Fabric's cd context manager does not work

Fabric's cd context manager does not work Question: I have set up my development environment on a new PC and seems I am having strange error with Fabric. Its ‘cd’ context manager seems does not change the current directory, and thus a lot of my commands don’t work. I have written the test and it …

Total answers: 1