Module: ChefAPI

Extended by:
Configurable
Defined in:
lib/chef-api/authentication.rb,
lib/chef-api.rb,
lib/chef-api/log.rb,
lib/chef-api/util.rb,
lib/chef-api/errors.rb,
lib/chef-api/schema.rb,
lib/chef-api/aclable.rb,
lib/chef-api/boolean.rb,
lib/chef-api/version.rb,
lib/chef-api/defaults.rb,
lib/chef-api/resource.rb,
lib/chef-api/multipart.rb,
lib/chef-api/validator.rb,
lib/chef-api/connection.rb,
lib/chef-api/configurable.rb,
lib/chef-api/resources/base.rb,
lib/chef-api/resources/node.rb,
lib/chef-api/resources/role.rb,
lib/chef-api/resources/user.rb,
lib/chef-api/resources/group.rb,
lib/chef-api/validators/base.rb,
lib/chef-api/validators/type.rb,
lib/chef-api/error_collection.rb,
lib/chef-api/resources/client.rb,
lib/chef-api/resources/search.rb,
lib/chef-api/resources/cookbook.rb,
lib/chef-api/resources/data_bag.rb,
lib/chef-api/resources/data_bag.rb,
lib/chef-api/resources/principal.rb,
lib/chef-api/validators/required.rb,
lib/chef-api/resources/environment.rb,
lib/chef-api/resources/organization.rb,
lib/chef-api/resources/data_bag_item.rb,
lib/chef-api/resources/partial_search.rb,
lib/chef-api/resources/collection_proxy.rb,
lib/chef-api/resources/cookbook_version.rb

Overview

DEBUG steps:

check .chomp

Defined Under Namespace

Modules: AclAble, Boolean, Configurable, Defaults, Error, Multipart, Resource, Util, Validator Classes: Authentication, Connection, ErrorCollection, Log, Schema

Constant Summary collapse

UNSET =
TODO:

Document this and why it's important

Object.new
VERSION =
"0.10.10".freeze

Class Method Summary collapse

Methods included from Configurable

configure, keys, reset!

Class Method Details

.connectionChefAPI::Connection

API connection object based off the configured options in Configurable.

Returns:


65
66
67
68
69
70
71
# File 'lib/chef-api.rb', line 65

def connection
  unless @connection && @connection.same_options?(options)
    @connection = ChefAPI::Connection.new(options)
  end

  @connection
end

.log_levelSymbol

Get the current log level.

Returns:

  • (Symbol)

46
47
48
# File 'lib/chef-api.rb', line 46

def log_level
  ChefAPI::Log.level
end

.log_level=(level) ⇒ Object

Set the log level.

Examples:

Set the log level to :info

ChefAPI.log_level = :info

Parameters:

  • level (Symbol)

    the log level to set


37
38
39
# File 'lib/chef-api.rb', line 37

def log_level=(level)
  ChefAPI::Log.level = level
end

.method_missing(m, *args, &block) ⇒ Object

Delegate all methods to the connection object, essentially making the module object behave like a Connection.


77
78
79
80
81
82
83
# File 'lib/chef-api.rb', line 77

def method_missing(m, *args, &block)
  if connection.respond_to?(m)
    connection.send(m, *args, &block)
  else
    super
  end
end

.respond_to_missing?(m, include_private = false) ⇒ Boolean

Delegating respond_to to the Connection.

Returns:


88
89
90
# File 'lib/chef-api.rb', line 88

def respond_to_missing?(m, include_private = false)
  connection.respond_to?(m) || super
end

.rootPathname

The source root of the ChefAPI gem. This is useful when requiring files that are relative to the root of the project.

Returns:

  • (Pathname)

56
57
58
# File 'lib/chef-api.rb', line 56

def root
  @root ||= Pathname.new(File.expand_path("../../", __FILE__))
end