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

Finding the Consul executable #311

Closed
gdavison opened this issue May 2, 2016 · 5 comments
Closed

Finding the Consul executable #311

gdavison opened this issue May 2, 2016 · 5 comments

Comments

@gdavison
Copy link
Contributor

gdavison commented May 2, 2016

With the changes in version 2, the Consul executable will be at /opt/consul/<version>/consul if installed using binary,/usr/local/src/consul/bin/consulif installed via git, or/usr/local/bin/consulin installed using a package manager ./optis not typically in thePATH`.

I have a downstream cookbook that needs to reference the Consul executable. I used to be able to reference it using consul and it would find it on the path. I could re-create the path to consul myself, but that requires knowledge of the internal workings of this cookbook, which could potentially change.

I'd suggest either symlinking all Consul executables to a single location, such as /usr/local/bin, or "publishing" the location using node attributes or the run_state.

Thoughts?

@johnbellone
Copy link
Contributor

What does your wrapper cookbook look like? There are a few ways we could go about this. Adding in an optional symlink is okay, but not always preferable if there needs to be multiple versions.

@Ginja
Copy link
Contributor

Ginja commented May 3, 2016

I always found managing symlinks for this type of stuff to be a pain in the providers. Since we're auto-generating the scripts that run these services (consul, vault, consul template). It's easier to just reference the direct path of the versioning we're managing.

@johnbellone
Copy link
Contributor

johnbellone commented May 3, 2016

It is also worth nothing that you can grab the resource object and get the path to the executable. I think that this syntax is correct.

include_recipe 'consul::default'
consul = node.run_context.resource_collection.find('consul_installation[0.6.4]')
puts consul.consul_program

You would probably want to do this within a ruby block so that its done at convergence time instead of compile time. I'm not sure if that's lazily evaluated.

@gdavison
Copy link
Contributor Author

gdavison commented May 3, 2016

Thanks, that does the trick! I didn't know you could do that. It doesn't appear to need to be in a ruby block, but I'll do some more testing.

It's actually an application cookbook for consul-replicate.

@gdavison gdavison closed this as completed May 3, 2016
@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants