Skip to content

mzupan/fabric_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages