On Thursday 16 Dec 2010 15:09:06 Carlton Gibson wrote: [...] > getting Fabric to use it. What I do want to be able to do is specify > rememberable/readable shortcut names for hosts in the fabfile and on the > command line rather than opaque IP address & port number combinations. > > So, on the command line I'd like something like: > > $ fab -H my_site deploy > > and in @hosts decorators I'd like something like: > > @hosts('my_site') > > Even if the actual hostname is more like: > > carl...@123.456.789.0:1234 > [...]
You could use roledefs for that. A role is a list of hosts but nothing stops you from having roles with just 1 host. > config = SSHConfig() > config.parse(config_file) > keys = [config.lookup(host).get('identityfile', None) > for host in env.hosts] > env.key_filename = [expanduser(key) for key in keys if key is not > None] env.hosts = [hostinfo(host, config) for host in env.hosts] Since hosts specifies which hosts the task is supposed to run on, I don't think this will do what you want (this would mean to run the tasks on all hosts in your config file if I'm reading it correctly). But as mentioned above, if instead you populate env.roledefs like env.roledefs[nick] = [host_str] you could then use `fab -R nick ...` on command line. -- Michael Gliwinski Henderson Group Information Services 9-11 Hightown Avenue, Newtownabby, BT36 4RT Phone: 028 9034 3319 ********************************************************************************************** The information in this email is confidential and may be legally privileged. It is intended solely for the addressee and access to the email by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed in the governing client engagement leter or contract. If you have received this email in error please notify supp...@henderson-group.com John Henderson (Holdings) Ltd Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT. Registered in Northern Ireland Registration Number NI010588 Vat No.: 814 6399 12 ********************************************************************************* _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user