Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

More convenient way to find the current host #32

Closed
bkad opened this Issue Jun 6, 2012 · 2 comments

Comments

Projects
None yet
3 participants
Contributor

bkad commented Jun 6, 2012

This is to track the conversation we had today about making Fezzik easier to use.

There needs to be a convenient way to find out in a task the environment variables set for the current host deployed to. As far as I can tell, the only way of doing this is the following:

Fezzik.environments[target_host.split("@")[1]]

And that only works for remote tasks. So non-remote tasks (like the ones that write out the environment.rb/sh files) won't be able to reliably figure out which is the current target host.

The workaround for this seems to be making tasks that need to know about the current target host to be remote and include the above code snippet to fetch that host's environment.

Collaborator

cespare commented Jun 6, 2012

There is no such thing as the "current target host" for non-remote tasks. These are only executed once, not once per target host, like remote tasks are.

Edit: That's why tasks like the one that writes out the environment files have to iterate through every target host.

Edit 2: I agree, though, that it would be nice to have one-word methods to get the current target host (for remote tasks) and the list of hosts (for regular tasks) that is guaranteed to either have or not have the user@ portion, regardless of how domain was set.

Contributor

bkad commented Jun 6, 2012

Ah, I see. I guess it felt weird writing remote tasks that don't run any remote commands. Fair enough.

A small Fezzik way to get the current environment still might be nice, I think it would make things clearer.

@dmac dmac closed this Nov 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment