chris-piekarski / python-fabric-shell

A simple shell for fabric

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WIP Fork. Don't use yet.

import rshell

rshell.shell('host name')

or rshell.isuue('ls /etc/', 'host_name')


Was forked from https://github.com/mzupan/fabric_shell.git.

Original Readme:

A very simple function to get a fabric shell. More to come when I have time for it. 

Example usage if shell.py is in the same directory as your fabfile.py

    from fabric.api import *
    from fabric.decorators import hosts
     
    import shell
    
    env.hosts = [
         'host1.domain.com',
         'host2.domain.com'
    ]

    @hosts('')
    def cmd():
        shell.shell()
    

The @hosts('') is just so we don't run the shell two times since we have two hosts listed. 

Right now if you enter a command it will run it on the server and if you run .sudo it will run the command as root. So for example

    $ fab cmd
    [] Executing task 'cmd'
    fabric::> id
    [host1.domain.com] run: id
    [host1.domain.com] out: uid=1020(mzupan) gid=1020(mzupan) groups=1020(mzupan)
    [host1.domain.com] out: 
    [host2.domain.com] run: id
    [host2.domain.com] out: uid=1020(mzupan) gid=1020(mzupan) groups=1020(mzupan)
    [host2.domain.com] out: 
    fabric::> .sudo id
    [host1.domain.com] sudo:  id
    [host1.domain.com] out: sudo password: 
    [host1.domain.com] out: 
    [host1.domain.com] out: uid=0(root) gid=0(root) groups=0(root)
    [host1.domain.com] out: 
    [host2.domain.com] sudo:  id
    [host2.domain.com] out: sudo password:
    [host2.domain.com] out: uid=0(root) gid=0(root) groups=0(root)
    [host2.domain.com] out: 
    fabric::> 

About

A simple shell for fabric


Languages

Language:Python 100.0%