Class: Chef::Resource::ChefEnvironment

Inherits:
LWRPBase
  • Object
show all
Defined in:
lib/chef/resource/chef_environment.rb

Constant Summary collapse

NOT_PASSED =
Object.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ChefEnvironment

Returns a new instance of ChefEnvironment.



11
12
13
14
# File 'lib/chef/resource/chef_environment.rb', line 11

def initialize(*args)
  super
  chef_server run_context.cheffish.current_chef_server
end

Instance Attribute Details

#default_attribute_modifiersObject (readonly)

default ‘ip_address’, ‘127.0.0.1’ default [ ‘pushy’, ‘port’ ], ‘9000’ default ‘ip_addresses’ do |existing_value|

(existing_value || []) + [ '127.0.0.1' ]

end default ‘ip_address’, :delete



39
40
41
# File 'lib/chef/resource/chef_environment.rb', line 39

def default_attribute_modifiers
  @default_attribute_modifiers
end

#override_attribute_modifiersObject (readonly)

override ‘ip_address’, ‘127.0.0.1’ override [ ‘pushy’, ‘port’ ], ‘9000’ override ‘ip_addresses’ do |existing_value|

(existing_value || []) + [ '127.0.0.1' ]

end override ‘ip_address’, :delete



57
58
59
# File 'lib/chef/resource/chef_environment.rb', line 57

def override_attribute_modifiers
  @override_attribute_modifiers
end

Instance Method Details

#default(attribute_path, value = NOT_PASSED, &block) ⇒ Object Also known as: attribute



40
41
42
43
44
45
46
47
48
49
# File 'lib/chef/resource/chef_environment.rb', line 40

def default(attribute_path, value=NOT_PASSED, &block)
  @default_attribute_modifiers ||= []
  if value != NOT_PASSED
    @default_attribute_modifiers << [ attribute_path, value ]
  elsif block
    @default_attribute_modifiers << [ attribute_path, block ]
  else
    raise "default requires either a value or a block"
  end
end

#override(attribute_path, value = NOT_PASSED, &block) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/chef/resource/chef_environment.rb', line 58

def override(attribute_path, value=NOT_PASSED, &block)
  @override_attribute_modifiers ||= []
  if value != NOT_PASSED
    @override_attribute_modifiers << [ attribute_path, value ]
  elsif block
    @override_attribute_modifiers << [ attribute_path, block ]
  else
    raise "override requires either a value or a block"
  end
end