Determining if running omnibus or system ruby


#1

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?


#2

I’ve seen things like in https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/service.rb#L27-39 in several cookbooks.

  • Dan

On Aug 15, 2012, at 11:35 AM, Mike wrote:

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?


#3

Oops, I answered a question that wasn’t yours, sorry.

  • Dan

On Aug 15, 2012, at 11:37 AM, Dan Crosta wrote:

I’ve seen things like in https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/service.rb#L27-39 in several cookbooks.

  • Dan

On Aug 15, 2012, at 11:35 AM, Mike wrote:

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?


#4

Yeah, thanks. I was confused by that response.
Anyone else?

On Wed, Aug 15, 2012 at 11:38 AM, Dan Crosta dcrosta@late.am wrote:

Oops, I answered a question that wasn’t yours, sorry.

  • Dan

On Aug 15, 2012, at 11:37 AM, Dan Crosta wrote:

I’ve seen things like in https://github.com/opscode-cookbooks/chef-client/blob/master/recipes/service.rb#L27-39 in several cookbooks.

  • Dan

On Aug 15, 2012, at 11:35 AM, Mike wrote:

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?


#5

On Wed, Aug 15, 2012 at 11:35 AM, Mike miketheman@gmail.com wrote:

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?

The current definitive method is
Chef::Provider::package::Rubygems::AlternateGemEnvironment.is_omnibus?

We’ve talked about wanting to upfactor that to a more common place,
maybe a mixin and then you could include that in recipes too.

What are you trying to do by the way?

Bryan


#6

Thanks for pointing that out.

The need I have is in a handler’s run, I need to include some
prerequisites like ruby-devel, before the handler is installed.

Figuring out whether to use the system’s package manager to install
these, or if they are already there in the omnibus install would make
the environment cleaner, as less extras would be installed.

Does that make sense?

On Wed, Aug 15, 2012 at 11:43 AM, Bryan McLellan btm@loftninjas.org wrote:

On Wed, Aug 15, 2012 at 11:35 AM, Mike miketheman@gmail.com wrote:

Has anyone come up with a ‘standard’ for handling determining whether
chef is installed via omnibus (with embedded ruby) or another method
with a different ruby?

The current definitive method is
Chef::Provider::package::Rubygems::AlternateGemEnvironment.is_omnibus?

We’ve talked about wanting to upfactor that to a more common place,
maybe a mixin and then you could include that in recipes too.

What are you trying to do by the way?

Bryan


#7

On Wed, Aug 15, 2012 at 12:10 PM, Mike miketheman@gmail.com wrote:

Does that make sense?

Yeah, I’m just sad that we have to write cookbooks that have to
diverge on Omnibus.

Filed http://tickets.opscode.com/browse/CHEF-3365 to track the upfactor.

Bryan


#8

Agreed. But until there is One True Way to install things, then there
will be divergence.
Case and point, value_for_platform and package names across distros.

It would be nice to have this method available, so thanks for filing the ticket.

On Wed, Aug 15, 2012 at 12:17 PM, Bryan McLellan btm@loftninjas.org wrote:

On Wed, Aug 15, 2012 at 12:10 PM, Mike miketheman@gmail.com wrote:

Does that make sense?

Yeah, I’m just sad that we have to write cookbooks that have to
diverge on Omnibus.

Filed http://tickets.opscode.com/browse/CHEF-3365 to track the upfactor.

Bryan


#9

Well, Ohai has information about where is Chef installed.

You could do something like this:

node[‘chef_packages’][‘chef’][‘chef_root’] =~ /embedded/

It’s not a nice standard method, but I guess there is not (yet).

Good luck :slight_smile:

On Wed, Aug 15, 2012 at 5:28 PM, Mike miketheman@gmail.com wrote:

Agreed. But until there is One True Way to install things, then there
will be divergence.
Case and point, value_for_platform and package names across distros.

It would be nice to have this method available, so thanks for filing the ticket.

On Wed, Aug 15, 2012 at 12:17 PM, Bryan McLellan btm@loftninjas.org wrote:

On Wed, Aug 15, 2012 at 12:10 PM, Mike miketheman@gmail.com wrote:

Does that make sense?

Yeah, I’m just sad that we have to write cookbooks that have to
diverge on Omnibus.

Filed http://tickets.opscode.com/browse/CHEF-3365 to track the upfactor.

Bryan


Juanje


#10

I’d advise against that because we reserve the right to change those
paths at some point and wouldn’t want reusable content getting broken
by install specifics.
-C

On Thu, Aug 16, 2012 at 2:37 AM, Juanje Ojeda Croissier
juanje.ojeda@gmail.com wrote:

Well, Ohai has information about where is Chef installed.

You could do something like this:

node[‘chef_packages’][‘chef’][‘chef_root’] =~ /embedded/

It’s not a nice standard method, but I guess there is not (yet).

Good luck :slight_smile:

On Wed, Aug 15, 2012 at 5:28 PM, Mike miketheman@gmail.com wrote:

Agreed. But until there is One True Way to install things, then there
will be divergence.
Case and point, value_for_platform and package names across distros.

It would be nice to have this method available, so thanks for filing the ticket.

On Wed, Aug 15, 2012 at 12:17 PM, Bryan McLellan btm@loftninjas.org wrote:

On Wed, Aug 15, 2012 at 12:10 PM, Mike miketheman@gmail.com wrote:

Does that make sense?

Yeah, I’m just sad that we have to write cookbooks that have to
diverge on Omnibus.

Filed http://tickets.opscode.com/browse/CHEF-3365 to track the upfactor.

Bryan


Juanje

http://about.me/juanje


Christopher Brown, Chief Technical Officer, Opscode, Inc.
T: (425) 502-5522, E: cb@opscode.com
IRC, Github: skeptomai
Twitter: @skeptomai


#11

How many paths have been used?
I came across this segment today:
https://github.com/heavywater/chef-chef_gem/blob/master/libraries/chef_gem.rb#L43-60

Can Opscode choose something and stick with it for a while? :slight_smile:

Also, everyone go upvote and fix
http://tickets.opscode.com/browse/CHEF-3365 - I don’t know the
upfactor process.

-M

On Thu, Aug 16, 2012 at 1:33 PM, Christopher Brown cb@opscode.com wrote:

I’d advise against that because we reserve the right to change those
paths at some point and wouldn’t want reusable content getting broken
by install specifics.
-C

On Thu, Aug 16, 2012 at 2:37 AM, Juanje Ojeda Croissier
juanje.ojeda@gmail.com wrote:

Well, Ohai has information about where is Chef installed.

You could do something like this:

node[‘chef_packages’][‘chef’][‘chef_root’] =~ /embedded/

It’s not a nice standard method, but I guess there is not (yet).

Good luck :slight_smile:

On Wed, Aug 15, 2012 at 5:28 PM, Mike miketheman@gmail.com wrote:

Agreed. But until there is One True Way to install things, then there
will be divergence.
Case and point, value_for_platform and package names across distros.

It would be nice to have this method available, so thanks for filing the ticket.

On Wed, Aug 15, 2012 at 12:17 PM, Bryan McLellan btm@loftninjas.org wrote:

On Wed, Aug 15, 2012 at 12:10 PM, Mike miketheman@gmail.com wrote:

Does that make sense?

Yeah, I’m just sad that we have to write cookbooks that have to
diverge on Omnibus.

Filed http://tickets.opscode.com/browse/CHEF-3365 to track the upfactor.

Bryan


Juanje

http://about.me/juanje


Christopher Brown, Chief Technical Officer, Opscode, Inc.
T: (425) 502-5522, E: cb@opscode.com
IRC, Github: skeptomai
Twitter: @skeptomai