module ChefConfig::Mixin::ChefCloud

def cloud_config?

def cloud_config?
  File.file?(CHEF_CLOUD_CLIENT_CONFIG)
end

def load_cloud_config

Returns:
  • (void) -

Other tags:
    Api: - internal
def load_cloud_config
  Config.merge!(Hash[parse_cloud_config.map { |k, v| [k.to_sym, v] }])
end

def parse_cloud_config(path)

def parse_cloud_config(path)
  return nil unless cloud_config?
  begin
    plist_cmd = Mixlib::ShellOut.new("plutil -convert json '" + CHEF_CLOUD_CLIENT_CONFIG + "' -o -")
    plist_cmd.run_command
    plist_cmd.error!
    JSON.parse(plist_cmd.stdout)
  rescue => e
    # TOML's error messages are mostly rubbish, so we'll just give a generic one
    message = "Unable to parse chef client cloud config.\n"
    message << e.message
    raise ChefConfig::ConfigurationError, message
  end
end