[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] Best way of making proposals for Fabric?
From: |
Rory Campbell-Lange |
Subject: |
[Fab-user] Best way of making proposals for Fabric? |
Date: |
Wed, 2 Mar 2011 19:41:58 +0000 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi.
I've been using Fabric for all of two days (part-time!), and I've
already found it useful in production. Thanks for the great software --
and I'm kicking myself that I didn't find it earlier.
I have some rather naive observations as a first-time user which I would
be grateful for some feedback on. I'm happy to work on them an provide
patches but I thought it might be useful to list them here and discern
if any of these issues are of interest to others, and also what the best
way of contributing patches might be (I'm not used to working with
Github or collaborating outside of a company).
I'm happy to add these thoughts to Redmine but I thought I should ask
about some of these issues in general terms first.
1. host aliases
I've got lots of hosts which are only resolvable by ip address
(indeed many will be referenced to 127.0.0.1:9001 or similar).
Because of this it would be very useful to have server aliasing, much
like the "Host" descriptor in .ssh/config
I'm thinking of
setting.hostalias = True
env.hosts = ['address@hidden:9000', 'address@hidden:9001', ...]
env.hostaliases = ['remhost1', 'remhost2']
if setting.hostalias:
# print env.hostalias by key rather than env.host
Doing this would be done more elegantly by making 'Hosts' and 'Host'
classes perhaps, rather than lists?
2. put file mode permissions
I stupidly didn't provide a number. I guess a number starting with 0
isn't really a number? Is a better error catcher better here?
In [8]: 0644 & 0700
Out[8]: 384
In [9]: '0644' & 0700
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/rory/<ipython console> in <module>()
TypeError: unsupported operand type(s) for &: 'str' and 'int'
3. setup and teardown
I have a situation where I have lots of hosts hidden behind a
gateway, so I have to connect to the gateway and then generate a lot
of port forwarding connections, one for each host.
As there doesn't appear to be a way of generating port forwarding
connections easily through Fabric (despite the promise of the port
forwarding patch in Paramiko mentioned here:
https://bugs.launchpad.net/paramiko/+bug/483697), I have to run an
ssh command to connect to the gateway and setup lots of portforwarded
connections to my localhost. I then read in a local ssh config file
designed to connect to 127.0.0.1:9001, 127.0.0.1:9002, etc.
Consequently it might be useful to have a "setup" and "teardown"
process that could help setup the environment required to run the
relevant fabfile, and similarly have a teardown to clean up the local
environment and namespace.
If hosts becomes a class Hosts composed of individual Host entities,
perhaps one could do setup() and teardown() on a Hosts basis.
datacentre1 = Hosts('ssh_config_dc1')
...setting up datacentre1 environment...
datacentre2 = Hosts('ssh_config_dc2')
...setting up datacentre2 environment...
hosts = datacentre1 | datacentre2 # set operations
for h in hosts:
# do something
...tearing down datacentre2 environment...
...tearing down datacentre1 environment...
Sorry -- this is something of a ramble. Please let me know if there are
any useful ideas in here.
Rory
- [Fab-user] Best way of making proposals for Fabric?,
Rory Campbell-Lange <=