Sha256: 776be488628d4f8819e3aa4cb97044ab95668b5cd7933d41eeed93e492244c36

Contents?: true

Size: 972 Bytes

Versions: 154

Compression:

Stored size: 972 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
    yield
  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

154 entries across 154 versions & 2 rubygems

Version Path
chef-17.10.68-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.2.7-x64-mingw-ucrt spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.2.7 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.1.29 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.1.29-x64-mingw-ucrt spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-16.18.30-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-16.18.30 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
knife-18.1.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.1.0-x64-mingw-ucrt spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.1.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.0.185-x64-mingw-ucrt spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.0.185 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.0.169-x64-mingw-ucrt spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-18.0.169 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
knife-17.10.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-16.18.0-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-16.18.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-17.10.0-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-17.10.0 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb
chef-17.9.52-universal-mingw32 spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb