« A week with the Palm Prē | Main | Novell's reaction »

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Joseph Turian

I found this tip useful.

Question: Is it possible to write your fabfile.py without specifying env.hosts? i.e. giving the hosts on the command-line?

markpasc

Thanks, Joseph!

Generally I think you want to specify the env.hosts anyway, since you'll only want a fabric script to try to connect to certain servers. So I haven't tried discovering the hosts myself.

Since the config rules can use wildcards, I don't think you could load all the hosts from the config in a meaningful way. However, I was looking around and found some scripts such as the paramiko example demo.py script, which will load the .ssh/known_hosts file so it can find all the known server keys. If all the hosts you care about are in there, you could generate the env.hosts list from your known_hosts file in a similar way if you like.

R1chardj0n3s

Thanks for posting this! I definitely found it helpful.

crccheck

Thanks, I modified it to handle hostnames and to do expanduser for the keyfiles too:

if 'hostname' in hive: host = hive['hostname']
env.key_filename = [expanduser(key) ...]

and put underscores in the imports so they don't show up as tasks

markpasc

Great suggestions, thanks! I pulled this out for a new project myself and had to add expanduser to key_filename too.

The comments to this entry are closed.