Tow to tell if chef-solo or hosted chef


#1

Hi,

How can I tell from a recipe if using chef-solo or hosted chef?

Is there an env variable somewhere?

Thanks


#2

You can test for chef-solo via the following construct:

if Chef::Config[:solo]
else
end

I know others are testing for hosted vs. private vs. osc by checking the hostname of the chef server.

Joe

On Jul 11, 2013, at 10:51 AM, David Montgomery wrote:

Hi,

How can I tell from a recipe if using chef-solo or hosted chef?

Is there an env variable somewhere?

Thanks


#3

Chef::Config[:solo] <- Boolean

On Thu, Jul 11, 2013 at 1:51 PM, David Montgomery <davidmontgomery@gmail.com

wrote:

Hi,

How can I tell from a recipe if using chef-solo or hosted chef?

Is there an env variable somewhere?

Thanks


#4

if Chef::Config[:chef_server_url].nil?

solo baby

elsif URI.parse(Chef::Config[:chef_server_url]).host == ‘api.opscode.com

im hosted

else

private or foss

end

On Thu, Jul 11, 2013 at 10:59 AM, Andrew Gross andrew@yipit.com wrote:

Chef::Config[:solo] <- Boolean

On Thu, Jul 11, 2013 at 1:51 PM, David Montgomery <
davidmontgomery@gmail.com> wrote:

Hi,

How can I tell from a recipe if using chef-solo or hosted chef?

Is there an env variable somewhere?

Thanks