Class: Chef::Resource::ChefDataBagItem

Inherits:
Cheffish::BaseResource show all
Defined in:
lib/chef/resource/chef_data_bag_item.rb

Constant Summary

Constants included from Cheffish::BaseProperties

Cheffish::BaseProperties::ArrayType

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ChefDataBagItem

Returns a new instance of ChefDataBagItem.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/chef/resource/chef_data_bag_item.rb', line 12

def initialize(*args)
  super
  if !property_is_set?(:data_bag) && run_context.cheffish.current_data_bag
    data_bag run_context.cheffish.current_data_bag
  end
  encryption = run_context.cheffish.current_data_bag_item_encryption
  if encryption
    encrypt true if encryption[:encrypt_all]
    secret encryption[:secret] if encryption[:secret]
    secret_path encryption[:secret_path] || run_context.config[:encrypted_data_bag_secret] if encryption[:secret_path] || run_context.config[:encrypted_data_bag_secret]
    encryption_cipher encryption[:encryption_cipher] if encryption[:encryption_cipher]
    encryption_version encryption[:encryption_version] || run_context.config[:data_bag_encrypt_version] if encryption[:encryption_version] || run_context.config[:data_bag_encrypt_version]
    old_secret encryption[:old_secret] if encryption[:old_secret]
    old_secret_path encryption[:old_secret_path] if encryption[:old_secret_path]
  end
end

Instance Attribute Details

#raw_data_modifiersObject (readonly)

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

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

end value ‘ip_address’, :delete



61
62
63
# File 'lib/chef/resource/chef_data_bag_item.rb', line 61

def raw_data_modifiers
  @raw_data_modifiers
end

Instance Method Details

#value(raw_data_path, value = NOT_PASSED, &block) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/chef/resource/chef_data_bag_item.rb', line 62

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