Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support defining multiple Capistrano roles with the same host list #18

Merged
merged 5 commits into from Mar 8, 2013

Conversation

relistan
Copy link
Contributor

@relistan relistan commented Mar 5, 2013

This adds the ability to define multiple Capistrano roles with a single search when the host lists would be identical. This is desirable when for example :web and :app are the same hosts in your environment. It saves running the same Chef search multiple times with the same result. Tests and README update included.

@@ -42,6 +42,12 @@ This defines the same roles using Chef's [search feature](http://wiki.opscode.co

The `limit` attribute of the options hash will make it so only that the given number of items will be returned from a search.

You can also define multiple roles at the same time if the host list is identical. Instead of running multiple searches to the Chef server, you can pass an Array to `chef_role`:

chef_role [:web, :app], 'roles:web', :attribute => Proc.new do |n|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd take the block off of this as it complicates what you're trying to say. Maybe just: chef_role [:web, :app], 'roles:web'

@smith
Copy link
Contributor

smith commented Mar 6, 2013

Thanks so much for contributing this! You can't even do this in regular capistrano, but the API makes a lot of sense.

I had a couple of minor comments, but let me know if you disagree. If you want to make the changes you can, otherwise I'll get this merged and bump the version.

@relistan
Copy link
Contributor Author

relistan commented Mar 7, 2013

Yep, you're right that you can't do it in regular Capistrano. I looked at patching Cap but decided it was better to do it in your plugin as it really doesn't have as much advantage in Cap itself since you are not making a round trip to a remote server on each invocation. Glad you are happy with it.

Thanks for the nice plugin.

@smith
Copy link
Contributor

smith commented Mar 8, 2013

Beautiful! Thanks again.

smith added a commit that referenced this pull request Mar 8, 2013
Support defining multiple Capistrano roles with the same host list
@smith smith merged commit 1b5b8c6 into gofullstack:master Mar 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants