Overriding attributes with Chef Solo

attributeschefchef-solocookbookmaven

I'm trying to install Maven 3 using Chef Solo and the following cookbook:

http://community.opscode.com/cookbooks/maven

The cookbook installs Maven 2 by default, and the first time I ran it, it installed Maven 2 as expected.

Later on I modified my solo.json file to look like this:

{
    "maven": {
        "version": "3"
    },
    "run_list": [
        "recipe[java]",
        "recipe[maven]"
    ]
}

But Chef isn't updating Maven to version 3. I don't know if this is because I'm incorrectly specifying the override attribute or if there's some other issue. I using this for reference:

http://wiki.opscode.com/display/chef/Chef+Solo#ChefSolo-JSON%2CAttributesandRecipes

Thanks.

Best Answer

Hmm. There should be chef output that indicates what's wrong.

Looking at the cookbook, I see that it's trying to download maven 3 as: http://www.apache.org/dist/maven/binaries/apache-maven-3.0.3-bin.tar.gz (as specified in maven/attributes/default.rb, as the maven.3.url attribute).

If you try to wget that URL, you'll get a 404. So, the cookbook is broken in an obvious way because of that. This should have shown up in the chef run log, though.

You can try modifying the cookbook, as it's out of date. You can also try setting the maven.3.url attribute for the node to something more up to date, so you don't touch the cookbook in that case, e.g.:

"maven": {
    "version": "3",
    "3": {
      "url": "http://www.apache.org/dist/maven/binaries/apache-maven-3.0.4-bin.tar.gz"
    }
},

or, if you want to continue using 3.0.3:

"maven": {
    "version": "3",
    "3": {
      "url": "http://archive.apache.org/dist/maven/binaries/apache-maven-3.0.3-bin.tar.gz"
    }
},
Related Topic