Netuitive / chef-netuitive

Installs Native Netuitive Agent
MIT License
4 stars 6 forks source link

Need to specify cookbook name in template in #26

Closed majormoses closed 8 years ago

majormoses commented 8 years ago

By not specifying this it will assume this is in the wrapper cookbook which is not correct.

Here is an example of a failure:

   * template[/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf] action create[2016-05-20T19:49:17+00:00] INFO: Processing template[/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf] action create (/var/chef/cache/cookbooks/netuitive/libraries/provider_custom_collector.rb line 21)

      ================================================================================
      Error executing action `create` on resource 'template[/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf]'
      ================================================================================

      Chef::Exceptions::FileNotFound
      ------------------------------
      Cookbook 'cc_netuitive' (0.4.0) does not contain a file at any of these locations:
        templates/ubuntu-14.04/collector_generic.conf.erb
        templates/ubuntu/collector_generic.conf.erb
        templates/default/collector_generic.conf.erb
        templates/collector_generic.conf.erb

      Resource Declaration:
      ---------------------
      # In /var/chef/cache/cookbooks/netuitive/libraries/provider_custom_collector.rb

       21:       template "#{new_resource.collectors_dir}/#{collector}.conf" do
       22:         source 'collector_generic.conf.erb'
       23:         owner 'root'
       24:         group 'root'
       25:         mode 00744
       26:         variables(
       27:           options: options
       28:         )
       29:       end
       30:     end

      Compiled Resource:
      ------------------
      # Declared in /var/chef/cache/cookbooks/netuitive/libraries/provider_custom_collector.rb:21:in `block (2 levels) in <class:NetuitiveCustomCollectorProvider>'

      template("/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf") do
        action [:create]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        source "collector_generic.conf.erb"
        variables {:options=>{"enabled"=>"True", "host"=>"127.0.0.1:27017", "metrics_blacklist"=>".*databases.*|.*metrics.repl.executor.shuttingDown.*|.*storageEngine.*|.*writeBacksQueued.*|.*mem.supported.*|.*tcmallocformattedString.*", "simple"=>"True"}}
        declared_type :template
        cookbook_name "cc_netuitive"
        owner "root"
        group "root"
        mode 484
        path "/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf"
      end

[2016-05-20T19:49:17+00:00] INFO: Running queued delayed notifications before re-raising exception

    ================================================================================
    Error executing action `create` on resource 'netuitive_collector[netuitive]'
    ================================================================================

    Chef::Exceptions::FileNotFound
    ------------------------------
    template[/opt/netuitive-agent/conf/collectors/MongoDBCollector.conf] (/var/chef/cache/cookbooks/netuitive/libraries/provider_custom_collector.rb line 21) had an error: Chef::Exceptions::FileNotFound: Cookbook 'cc_netuitive' (0.4.0) does not contain a file at any of these locations:
      templates/ubuntu-14.04/collector_generic.conf.erb
      templates/ubuntu/collector_generic.conf.erb
      templates/default/collector_generic.conf.erb
      templates/collector_generic.conf.erb

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/cc_netuitive/recipes/setup.rb

     21: netuitive_collector 'netuitive' do
     22:   custom_collectors node['netuitive']['custom_collectors']
     23: end

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/cc_netuitive/recipes/setup.rb:21:in `from_file'

    netuitive_collector("netuitive") do
      action [:create]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :netuitive_collector
      cookbook_name "cc_netuitive"
      recipe_name "setup"
      custom_collectors {"MongoDBCollector"=>{"enabled"=>"True", "host"=>"127.0.0.1:27017", "metrics_blacklist"=>".*databases.*|.*metrics.repl.executor.shuttingDown.*|.*storageEngine.*|.*writeBacksQueued.*|.*mem.supported.*|.*tcmallocformattedString.*", "simple"=>"True"}}
      collectors_dir "/opt/netuitive-agent/conf/collectors"
    end

[2016-05-20T19:49:17+00:00] INFO: Running queued delayed notifications before re-raising exception