sous-chefs / maven

Development repository for the maven cookbook
https://supermarket.chef.io/cookbooks/maven
Apache License 2.0
36 stars 153 forks source link

Cannot include multiple maven_settings resources #77

Open mattfirtion opened 8 years ago

mattfirtion commented 8 years ago

Cookbook version

v2.2.0

Chef-client version

12.13.37

Platform Details

CentOS Linux release 7.2.1511 (Core)

Scenario:

Add multiple configuration options to settings.xml using the maven_settings LWRP. [What you are trying to achieve and you can't?]

Steps to Reproduce:

[If you are filing an issue what are the things we need to do in order to repro your problem? How are you using this cookbook or any resources it includes?]

  1. Add multiple maven_settings resources to a recipe and include the recipe in your run list.
maven_settings "settings.proxies" do
  value "proxy" => {
    "active" => true,
    "protocaol" => "http",
    "host" => "proxy.myorg.com",
    "port" => 80,
    "nonProxyHosts" => ".myorg.com"
  }
end

maven_settings "settings.servers" do
  value "server" => {
    "id" => "central",
    "url" => "http://localhost:8081/nexus/content/repositories/public"
  }
end

Expected Result:

           ================================================================================
           Error executing action `update` on resource 'maven_settings[settings.servers]'
           ================================================================================

           KeyError
           --------
           key not found: "settings"

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/maven/providers/settings.rb:42:in `fetch'
           /tmp/kitchen/cache/cookbooks/maven/providers/settings.rb:42:in `each'
           /tmp/kitchen/cache/cookbooks/maven/providers/settings.rb:42:in `inject'
           /tmp/kitchen/cache/cookbooks/maven/providers/settings.rb:42:in `path_value_equals?'
           /tmp/kitchen/cache/cookbooks/maven/providers/settings.rb:30:in `block in class_from_file'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/maven/recipes/settings.rb

            42: maven_settings "settings.servers" do
            43:   value "server" => {
            44:     "id" => "central",
            45:     "url" => "http://localhost:8081/nexus/content/repositories/public"
            46:   }
            47: end

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/maven/recipes/settings.rb:42:in `from_file'

           maven_settings("settings.servers") do
             action [:update]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :maven_settings
             cookbook_name "maven"
             recipe_name "settings"
             value {"server"=>{"id"=>"central", "url"=>"http://localhost:8081/nexus/content/repositories/public"}}
             path "settings.servers"
           end

           Platform:
           ---------
           x86_64-linux

       Running handlers:
       [2016-08-25T19:15:39+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-08-25T19:15:39+00:00] ERROR: Exception handlers complete
       Chef Client failed. 17 resources updated in 02 minutes 06 seconds
       [2016-08-25T19:15:39+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2016-08-25T19:15:39+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2016-08-25T19:15:39+00:00] ERROR: maven_settings[settings.servers] (maven::settings line 42) had an error: KeyError: key not found: "settings"
       [2016-08-25T19:15:41+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
zamedic commented 7 years ago

Can also confirm...

zamedic commented 7 years ago

I have pushed a pull request to fix this https://github.com/chef-cookbooks/maven/pull/84