Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A small library for running local and remote shell commands
branch: master

This branch is 45 commits behind oremj:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
commander
scripts
.gitignore
README.markdown
setup.py

README.markdown

Commander

Commander is two things:

  1. A deployment library modeled after fabric
  2. A remote command runner

Deployment Libary

A simple deployment example

from commander.deploy import hosts

@hosts(["host1", "host2", "host3"])
def hostname(ctx):
    ctx.remote("hostname")

And then from the commandline

# commander -l example.py 
Available commands:

    hostname

# commander example.py hostname
Running 'hostname'
[host1] run: hostname
[host1] out: host1
[host2] run: hostname
[host2] out: host2
[host3] run: hostname
[host3] out: host3

Your deployment definitions can also be called directly from another python script

from example import hostname
hostname()

And then

# python2.6 example2.py
[host1] run: hostname
[host1] out: host1
[host2] run: hostname
[host2] out: host2
[host3] run: hostname
[host3] out: host3

Remote Command Runner

After defining a dictionary of hosts in /etc/commanderconfig.py e.g.,

hostgroups = {
    'hostgroup1': ['host1', 'host2', 'host3'],
}

From the commandline

# issue-multi-command hostgroup1 hostname
[host1] run: hostname
[host1] out: host1
[host2] run: hostname
[host2] out: host2
[host3] run: hostname
[host3] out: host3
Something went wrong with that request. Please try again.