Dynatrace / Dynatrace-AppMon-Chef

Installs the Dynatrace Application Monitoring solution using Chef.
MIT License
12 stars 15 forks source link

Recipe Compile Error - undefined local variable or method `use_inline_resources' (/resources/s3_file.rb:22) #34

Open Dan-JoeLopez opened 6 years ago

Dan-JoeLopez commented 6 years ago

I tried to run this cookbook's server profile via kitchen on openstack, and was met with the following response:

       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/dynatrace-appmon/resources/s3_file.rb
       ================================================================================

       NameError
       ---------
       undefined local variable or method `use_inline_resources' for #<Class:0x0000000004d011b0>

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/dynatrace-appmon/resources/s3_file.rb:22:in `class_from_file'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/dynatrace-appmon/resources/s3_file.rb:

        15:  property :region, String
        16:  property :access_key_id, String
        17:  property :secret_access_key, String
        18:  property :owner, String
        19:  property :group, String
        20:  property :mode, String
        21:
        22>> use_inline_resources
        23:
        24:  action :create do
        25:    require 'aws-sdk'
        26:
        27:    # Detecting if we want to upload or download from S3
        28:    upload_to_s3 = false
        29:    if source.start_with?('s3://')
        30:      s3_url = source.dup
        31:    elsif target.start_with?('s3://')

       System Info:
       ------------
       chef_version=12.22.5
       platform=redhat
       platform_version=7.5
       ruby=ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]
       program_name=chef-client worker: ppid=2141;start=22:02:05;
       executable=/opt/chef/bin/chef-client

I tried with Chef client 12, 13, and 14. 13 and 14 gave other errors that I was able to work around. the resource names cannot be set to type string with a default of nil. A type mismatch error is returned, as the default type must match the defined type for the property.

Also, the kitchen files that you provide reference recipe[dynatrace::server] but the cookbook name (in the metadata.rb) is dynatrace-appmon, so the runlist in the .kitchen.yml does not seem to be valid.

Dan-JoeLopez commented 6 years ago

@PiotrMejer @metmajer - It looks like the two of you were active contributors on this cookbook. Can you advise if I am doing something wrong?

AUTplayed commented 6 years ago

This issue can be solved by replacing the line use_inline_resources with

use_inline_resources if defined?(use_inline_resources)

Let me know if you can get the recipe to run, as I'm struggling to do so myself right now