fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] skipping editor while executing the remote command


From: Brandon Whaley
Subject: Re: [Fab-user] skipping editor while executing the remote command
Date: Thu, 23 Feb 2017 21:21:27 +0000

I would use execute to call my task to run git pull, then have the task return the output to the parent task and write it to a log file for viewing in nano.  For example:

from fabric.api import run, cd, execute, task, local

@task
def git_pull():
    with cd('/home/myuser/mygitrepo'):
        return run('git pull')

@task
def bulk_pull():
    results = execute(git_pull, hosts=['host1', 'host2'])
    with open('gitpull.log', 'w') as f:
        for host, output in results.iteritems():
            f.write("%s\n====\n%s\n\n" % (host, output))
    local('nano gitpull.log')



Note that you are no longer able to specify hosts via command line with this method, since bulk_pull should only target one host.  Run via "fab bulk_pull"

On Thu, Feb 23, 2017 at 4:03 PM Roshan Shetty <address@hidden> wrote:
Hi guys,

We are manually doing git pull on 20+ servers.

once the git pull gets completed, it will open some log message in nano editor.

I'm trying to automate the above process.

But the problem is with log messages opening in editor.

Is there any way to skip that part using fabric ?



Regards,
Roshan


The only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it.” - Steve Jobs
_______________________________________________
Fab-user mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user

reply via email to

[Prev in Thread] Current Thread [Next in Thread]