Sha256: 4af93d9cc4f4ed5f6ee6167de4c341acc07663583d66feb34bd0b1916034a8b0

Contents?: true

Size: 1005 Bytes

Versions: 28

Compression:

Stored size: 1005 Bytes

Contents

# This action tests that embedded Resources have access to the enclosing Provider's
# lexical scope (as demonstrated by the call to new_resource) and that all parameters
# are passed properly (as demonstrated by the call to generate_new_name).
attr_reader :enclosed_resource

def without_deprecation_warnings(&block)
  old_treat_deprecation_warnings_as_errors = Chef::Config[:treat_deprecation_warnings_as_errors]
  Chef::Config[:treat_deprecation_warnings_as_errors] = false
  begin
    block.call
  ensure
    Chef::Config[:treat_deprecation_warnings_as_errors] = old_treat_deprecation_warnings_as_errors
  end
end

def action_twiddle_thumbs
  @enclosed_resource = lwrp_foo :foo do
    monkey generate_new_name(new_resource.monkey){ 'the monkey' }
    # We know there will be a deprecation error here; head it off
    without_deprecation_warnings do
      provider :lwrp_monkey_name_printer
    end
  end
end

def generate_new_name(str, &block)
  "#{str}, #{block.call}"
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
chef-14.13.11-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-15.0.300-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-15.0.298-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-15.0.293-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.12.9-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.12.3-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.12.14-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.11.21-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.10.9-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.9.13-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.8.12-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.7.17-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.12.3-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.6.47-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.11.3-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.5.33-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.10.4-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-14.3.37-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.10.0-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-13.9.4-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb