Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot include multiple maven_settings resources #77

Open
mattfirtion opened this issue Aug 25, 2016 · 2 comments
Open

Cannot include multiple maven_settings resources #77

mattfirtion opened this issue Aug 25, 2016 · 2 comments

Comments

@mattfirtion
Copy link

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:

  • A proxy setting would be configured
  • A server would be added

Actual 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
Copy link
Contributor

zamedic commented May 28, 2017

Can also confirm...

@zamedic
Copy link
Contributor

zamedic commented May 28, 2017

I have pushed a pull request to fix this
#84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants