GithubHelp home page GithubHelp logo

sous-chefs / maven Goto Github PK

View Code? Open in Web Editor NEW
36.0 36.0 153.0 304 KB

Development repository for the maven cookbook

Home Page: https://supermarket.chef.io/cookbooks/maven

License: Apache License 2.0

Ruby 99.51% HTML 0.49%
chef chef-cookbook chef-resource hacktoberfest managed-by-terraform maven

maven's Introduction

maven Cookbook

Cookbook Version CI State OpenCollective OpenCollective License

Install and configure Apache Maven from the binaries provided by the Maven project.

Provides the maven resource for pulling a maven artifact from a maven repository and placing it in an arbitrary location.

Note: This cookbook does not handle the installation of Java but does require it to be installed. This can be done either using the Java cookbook or your own cookbook. Check the Maven website for more information about explicit Java requirements.

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • Fedora
  • Windows

Chef

  • Chef 13+

Cookbooks

  • ark - used to unpack the maven tarball

Attributes

  • node['maven']['version'] - specifies the version of maven to install.
  • node['maven']['m2_home'] - defaults to '/usr/local/maven/'
  • node['maven']['url'] - the download url for maven
  • node['maven']['checksum'] - the checksum, which you will have to recalculate if you change the download url using shasum -a 256 FILENAME
  • node['maven']['repositories'] - an array of maven repositories to use; must be specified as an array. Used in the maven LWRP.
  • node['maven']['setup_bin'] - whether or not to put mvn on your system path, defaults to false
  • node['maven']['mavenrc']['opts'] - value of MAVEN_OPTS environment variable exported via /etc/mavenrc template, defaults to -Dmaven.repo.local=$HOME/.m2/repository -Xmx384m
  • node['maven']['user'] - User to own Maven install, defaults to root or Administrator depending on platform.
  • node['maven']['group'] - Group to own Maven install, defaults to root or Administrators depending on platform.

Recipes

default

Installs maven according to the version specified by the node['maven']['version'] attribute.

settings

Installs gems required to parse settings.xml to ruby and hash and back to xml

Usage

Install a version of Java JRE (Oracle or OpenJDK) that is at minimum the version of Java required by the maven release you are installing. This can be done either using the Java cookbook or your own cookbook.

Include the recipe where you want Apache Maven installed.

The maven lwrp has two actions, :install and :put. They are essentially the same accept that the install action will name the the downloaded file artifact_id-version.packaging. For example, the mysql jar would be named mysql-5.1.19.jar.

Use the put action when you want to explicitly control the name of the downloaded file. This is useful when you download an artifact and then want to have Chef resources act on files within that the artifact. The put action will creat a file named name.packaging where name corresponds to the name attribute.

Providers/Resources

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website https://opencollective.com/sous-chefs/sponsor/1/website https://opencollective.com/sous-chefs/sponsor/2/website https://opencollective.com/sous-chefs/sponsor/3/website https://opencollective.com/sous-chefs/sponsor/4/website https://opencollective.com/sous-chefs/sponsor/5/website https://opencollective.com/sous-chefs/sponsor/6/website https://opencollective.com/sous-chefs/sponsor/7/website https://opencollective.com/sous-chefs/sponsor/8/website https://opencollective.com/sous-chefs/sponsor/9/website

maven's People

Contributors

alexanderdavidpan avatar bdols avatar bryanwb avatar cevou avatar damacus avatar dchosen avatar dluchinienoc avatar dysinger avatar erichelgeson avatar fapiko avatar gildegoma avatar iandelahorne avatar iennae avatar jamietanna avatar jlandahl avatar kitchen-porter avatar maoo avatar martinei avatar namtzigla avatar nathenharvey avatar ramereth avatar renovate[bot] avatar schisamo avatar sethvargo avatar tas50 avatar tophercullen avatar treyhyde avatar xorima avatar xorimabot avatar zamedic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maven's Issues

Ability to modify settings.xml

Cookbook currently provides no way of modifying settings.xml file. e.g. changing proxies, adding repositories, mirrors etc.

Recipe not able to create a symlink

Cookbook version

5.0.1

Chef-client version

13.3.42

Platform Details

Ubuntu: 14.04LTS

Scenario:

Trying to Install Maven.

Steps to Reproduce:

  1. Knife site the cookbook
  2. Upload the cookbook to the server
  3. Configure the run-list to run Maven
  4. Run the Chef-Client

Expected Result:

Maven to be installed on the given System

Actual Result:

Starting Chef Client, version 13.3.42
resolving cookbooks for run list: ["maven"]
Synchronizing Cookbooks:

  • maven (5.0.1)
  • ark (3.1.0)
  • build-essential (8.0.3)
  • seven_zip (2.0.2)
  • windows (3.1.2)
  • ohai (5.2.0)
  • mingw (2.0.1)
  • java (1.50.0)
  • apt (6.1.4)
  • homebrew (4.2.0)
    Installing Cookbook Gems:
    Compiling Cookbooks...
    Converging 3 resources
    Recipe: ark::default
  • apt_package[libtool, autoconf, make, unzip, rsync, gcc, autogen, shtool, pkg-config] action install (up to date)
    Recipe: maven::default

  • ark[maven] action install

    • directory[/usr/local/maven-3.5.0] action create (up to date)

    • remote_file[/var/chef/cache/maven-3.5.0.tar.gz] action create (up to date)

    • execute[unpack /var/chef/cache/maven-3.5.0.tar.gz] action nothing (skipped due to action :nothing)

    • execute[set owner on /usr/local/maven-3.5.0] action nothing (skipped due to action :nothing)

    • link[/usr/local/maven] action create

      ================================================================================
      Error executing action create on resource 'link[/usr/local/maven]'

      Errno::EISDIR

      Is a directory @ unlink_internal - /usr/local/maven

      Resource Declaration:

      In /var/chef/cache/cookbooks/ark/resources/default.rb

      96: link new_resource.home_dir do
      97: to new_resource.path
      98: end
      99:

      Compiled Resource:

      Declared in /var/chef/cache/cookbooks/ark/resources/default.rb:96:in `block in class_from_file'

      link("/usr/local/maven") do
      action [:create]
      default_guard_interpreter :default
      to "/usr/local/maven-3.5.0"
      link_type :symbolic
      target_file "/usr/local/maven"
      declared_type :link
      cookbook_name "maven"
      owner nil
      group nil
      end

      System Info:

      chef_version=13.3.42
      platform=ubuntu
      platform_version=14.04
      ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
      program_name=chef-client worker: ppid=5016;start=14:53:02;
      executable=/opt/chef/bin/chef-client

    ================================================================================
    Error executing action install on resource 'ark[maven]'

    Errno::EISDIR

    link[/usr/local/maven] (/var/chef/cache/cookbooks/ark/resources/default.rb line 96) had an error: Errno::EISDIR: Is a directory @ unlink_internal - /usr/local/maven

    Resource Declaration:

    In /var/chef/cache/cookbooks/maven/recipes/default.rb

    26: ark 'maven' do
    27: version node['maven']['version']
    28: url node['maven']['url']
    29: checksum node['maven']['checksum']
    30: home_dir node['maven']['m2_home']
    31: win_install_dir node['maven']['m2_home']
    32: append_env_path node['maven']['setup_bin']
    33: end
    34:

    Compiled Resource:

    Declared in /var/chef/cache/cookbooks/maven/recipes/default.rb:26:in `from_file'

    ark("maven") do
    action [:install]
    default_guard_interpreter :default
    declared_type :ark
    cookbook_name "maven"
    recipe_name "default"
    version "3.5.0"
    url "http://apache.mirrors.tds.net/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz"
    checksum "beb91419245395bd69a4a6edad5ca3ec1a8b64e41457672dc687c173a495f034"
    home_dir "/usr/local/maven"
    win_install_dir "/usr/local/maven"
    append_env_path true
    extension "tar.gz"
    prefix_bin "/usr/local/bin"
    prefix_root "/usr/local"
    owner "root"
    path "/usr/local/maven-3.5.0"
    release_file "/var/chef/cache/maven-3.5.0.tar.gz"
    end

    System Info:

    chef_version=13.3.42
    platform=ubuntu
    platform_version=14.04
    ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
    program_name=chef-client worker: ppid=5016;start=14:53:02;
    executable=/opt/chef/bin/chef-client

Running handlers:
[2017-09-04T14:53:03+05:30] ERROR: Running exception handlers
Running handlers complete
[2017-09-04T14:53:03+05:30] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2017-09-04T14:53:03+05:30] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2017-09-04T14:53:03+05:30] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-09-04T14:53:03+05:30] ERROR: ark[maven] (maven::default line 26) had an error: Errno::EISDIR: link[/usr/local/maven] (/var/chef/cache/cookbooks/ark/resources/default.rb line 96) had an error: Errno::EISDIR: Is a directory @ unlink_internal - /usr/local/maven
[2017-09-04T14:53:03+05:30] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Idempotent

Cookbook version

3.5.0

Chef-client version

14.8.12

Platform Details

Ubuntu 16.04.6

Scenario:

It appears that the cookbook is not idempotent when during the default recipe. The ruby block which tries to /usr/local/maven-3.5.2/bin' to chef-client ENV['PATH'] possibly due to the ark cookbook.

Steps to Reproduce:

I've created a simple wrapper cookbook with include_recipe 'maven::default' as the only line. I've also checked for idempotency in the .kitchen.yaml.

$ git clone https://github.com/jlosito/maven-test.git
$ cd maven-test
$ kitchen converge

Expected Result:

The cookbook to be idempotent.

Actual Result:

$ kitchen converge
-----> Starting Kitchen (v1.24.0)
-----> Creating <default-ubuntu-1604>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'bento/ubuntu-16.04'...
==> default: Matching MAC address for NAT networking...
       ==> default: Checking if box 'bento/ubuntu-16.04' is up to date...
       ==> default: Setting the name of the VM: kitchen-maven-test-default-ubuntu-1604
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 (guest) => 2222 (host) (adapter 1)
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 127.0.0.1:2222
           default: SSH username: vagrant
           default: SSH auth method: private key
           default: 
           default: Vagrant insecure key detected. Vagrant will automatically replace
           default: this with a newly generated keypair for better security.
           default: 
           default: Inserting generated public key within guest...
           default: Removing insecure key from the guest if it's present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
           default: The guest additions on this VM do not match the installed version of
           default: VirtualBox! In most cases this is fine, but in rare cases it can
           default: prevent things such as shared folders from working properly. If you see
           default: shared folder errors, please make sure the guest additions within the
           default: virtual machine match the version of VirtualBox you have installed on
           default: your host and reload your VM.
           default: 
           default: Guest Additions Version: 6.1.0
           default: VirtualBox Version: 5.2
       ==> default: Setting hostname...
       ==> default: Mounting shared folders...
           default: /tmp/omnibus/cache => /home/jlosito/.kitchen/cache
       ==> default: Machine not provisioned because `--no-provision` is specified.
       [SSH] Established
       Vagrant instance <default-ubuntu-1604> created.
       Finished creating <default-ubuntu-1604> (0m38.38s).
-----> Converging <default-ubuntu-1604>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 7.0.7...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
       ubuntu 16.04 x86_64
       Getting information for chef stable 14.8.12 for ubuntu...
       downloading https://omnitruck.chef.io/stable/chef/metadata?v=14.8.12&p=ubuntu&pv=16.04&m=x86_64
         to file /tmp/install.sh.1637/metadata.txt
       trying wget...
       sha1	27aa243ab6a05b70115357ea1e552a381a65dd85
       sha256	cb1f032bc9d0031e12464d7b394901fe340d8e8ef6fe4413e125b9e803b3aaf5
       url	https://packages.chef.io/files/stable/chef/14.8.12/ubuntu/16.04/chef_14.8.12-1_amd64.deb
       version	14.8.12
       downloaded metadata file looks valid...
       /tmp/omnibus/cache/chef_14.8.12-1_amd64.deb exists
       Comparing checksum with sha256sum...
       Installing chef 14.8.12
       installing with dpkg...
       Selecting previously unselected package chef.
(Reading database ... 38555 files and directories currently installed.)
       Preparing to unpack .../cache/chef_14.8.12-1_amd64.deb ...
       Unpacking chef (14.8.12-1) ...
       Setting up chef (14.8.12-1) ...
       Thank you for installing Chef!
       Transferring files to <default-ubuntu-1604>
       Starting Chef Client, version 14.8.12
       Creating a new client identity for default-ubuntu-1604 using the validator key.
       resolving cookbooks for run list: ["maven-test::default"]
       Synchronizing Cookbooks:
         - maven-test (0.1.0)
         - ark (5.0.0)
         - maven (5.3.0)
         - seven_zip (3.1.2)
         - windows (6.0.1)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 5 resources
       Recipe: ark::default
         * apt_package[libtool, autoconf, make, unzip, rsync, gcc, autogen, shtool, pkg-config] action install
           - install version 2.4.6-0.1 of package libtool
           - install version 2.69-9 of package autoconf
           - install version 6.0-20ubuntu1 of package unzip
           - install version 1:5.18.7-3 of package autogen
           - install version 2.0.8-8 of package shtool
           - install version 0.29.1-0ubuntu1 of package pkg-config
       Recipe: maven::default
         * group[create the group for Maven] action create (skipped due to not_if)
         * linux_user[create the user for Maven] action create (skipped due to not_if)
         * ark[maven] action install
           * directory[/usr/local/maven-3.5.2] action create
             - create new directory /usr/local/maven-3.5.2
           * remote_file[/tmp/kitchen/cache/maven-3.5.2.tar.gz] action create
             - create new file /tmp/kitchen/cache/maven-3.5.2.tar.gz
             - update content in file /tmp/kitchen/cache/maven-3.5.2.tar.gz from none to 707b1f
             (new content is binary, diff output suppressed)
           * execute[unpack /tmp/kitchen/cache/maven-3.5.2.tar.gz] action nothing (skipped due to action :nothing)
           * execute[set owner on /usr/local/maven-3.5.2] action nothing (skipped due to action :nothing)
           * link[/usr/local/maven] action create
             - create symlink at /usr/local/maven to /usr/local/maven-3.5.2
           * template[/etc/profile.d/maven.sh] action create
             - create new file /etc/profile.d/maven.sh
             - update content in file /etc/profile.d/maven.sh from none to f704c7
             --- /etc/profile.d/maven.sh	2020-01-04 03:12:47.357657006 +0000
             +++ /etc/profile.d/.chef-maven20200104-1721-116sycf.sh	2020-01-04 03:12:47.353655006 +0000
             @@ -1 +1,2 @@
             +export PATH=/usr/local/maven-3.5.2/bin:$PATH
             - change mode from '' to '0755'
             - change owner from '' to 'root'
             - change group from '' to 'root'
           * ruby_block[adding '/usr/local/maven-3.5.2/bin' to chef-client ENV['PATH']] action run
             - execute the ruby block adding '/usr/local/maven-3.5.2/bin' to chef-client ENV['PATH']
           * execute[unpack /tmp/kitchen/cache/maven-3.5.2.tar.gz] action run
             - execute /bin/tar xzf /tmp/kitchen/cache/maven-3.5.2.tar.gz --strip-components=1
           * execute[set owner on /usr/local/maven-3.5.2] action run
             - execute chown -R root:root /usr/local/maven-3.5.2
         
         * template[/etc/mavenrc] action create
           - create new file /etc/mavenrc
           - update content in file /etc/mavenrc from none to 4687e1
           --- /etc/mavenrc	2020-01-04 03:12:47.533744999 +0000
           +++ /etc/.chef-mavenrc20200104-1721-1q0v8bu	2020-01-04 03:12:47.533744999 +0000
           @@ -1 +1,3 @@
           +export M2_HOME=/usr/local/maven
           +export MAVEN_OPTS="-Dmaven.repo.local=$HOME/.m2/repository -Xmx384m"
           - change mode from '' to '0755'
       
       Running handlers:
       Running handlers complete
       Chef Client finished, 10/14 resources updated in 25 seconds
       Starting Chef Client, version 14.8.12
       resolving cookbooks for run list: ["maven-test::default"]
       Synchronizing Cookbooks:
         - maven-test (0.1.0)
         - ark (5.0.0)
         - windows (6.0.1)
         - maven (5.3.0)
         - seven_zip (3.1.2)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 5 resources
       Recipe: ark::default
         * apt_package[libtool, autoconf, make, unzip, rsync, gcc, autogen, shtool, pkg-config] action install (up to date)
       Recipe: maven::default
         * group[create the group for Maven] action create (skipped due to not_if)
         * linux_user[create the user for Maven] action create (skipped due to not_if)
         * ark[maven] action install
           * directory[/usr/local/maven-3.5.2] action create (up to date)
           * remote_file[/tmp/kitchen/cache/maven-3.5.2.tar.gz] action create (up to date)
           * execute[unpack /tmp/kitchen/cache/maven-3.5.2.tar.gz] action nothing (skipped due to action :nothing)
           * execute[set owner on /usr/local/maven-3.5.2] action nothing (skipped due to action :nothing)
           * link[/usr/local/maven] action create (up to date)
           * template[/etc/profile.d/maven.sh] action create (up to date)
           * ruby_block[adding '/usr/local/maven-3.5.2/bin' to chef-client ENV['PATH']] action run
             - execute the ruby block adding '/usr/local/maven-3.5.2/bin' to chef-client ENV['PATH']
         
         * template[/etc/mavenrc] action create (up to date)
       
       Running handlers:
       First chef run should have reached a converged state.
       Resources updated in a second chef-client run:
       - ark[maven]
       Killed
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <default-ubuntu-1604>.  Please see .kitchen/logs/default-ubuntu-1604.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

maven LWRP always reports updated_by_last_action(true)

At line 72 of the provider code, you can see that the provider always reports it was updated, which can result in undesirable behavior (e.g., restart a service via a subscribes on an instance of the LWRP, which will restart the service on every Chef run).

You can see a great example with the cron_d cookbook in the Chef docs.

Wondering how this might be modified to improve this behavior, and be more idempotent (i.e., not report updated if nothing happened).

Cannot include multiple maven_settings resources

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)

Ark version upgrade

Hi, the ark cookbook has been updated to v1.0. It would be great if the metadata.rb were to be updated to reflect this change.

Setting maven group on mac downgrades admin users

Cookbook version

5.2.0

Chef-client version

14.6.47

Platform Details

mac-os-x

Scenario:

There is no root group on MacOSX. So the ark install fails. If you set the attribute['maven']['group'] = 'admin' on the mac node, the user that had admin before gets reverted to a standard user.

I end up booting down to the single-user mode, removing the .AppleSetupDone to create a new admin user, then reset my user.

The chef client output shows

 * group[create the group for Maven] action create[2018-12-05T15:31:59-06:00] INFO: Processing group[create the group for Maven] action create (maven::default line 25)
[2018-12-05T15:31:59-06:00] INFO: group[create the group for Maven] altered

    - alter group admin
    - replace group members with new list of members

Steps to Reproduce:

Set ['maven']['group'] = 'admin' on the mac node, run chef client. Any of your users that existed on the system who where admins get downgraded to standard users.

Expected Result:

Install maven and not loose admin privileges

Actual Result:

Install maven and keep admin privileges for the users that had admin.

Add support for maven-dependency-plugin 3.0.0, add version range support

Cookbook version

All

Chef-client version

12.2.1

Platform Details

Centos 6.7, Amazon EC2

Scenario:

I would like to be able to specify an artifact version range as [1.0.0,1.0.5] and also specify a target file name, and have the plugin automatically download the latest version in that range and call it that name. Maven Dependency Plugin version 3.0.0 added this support to the "get" goal, but the current cookbook uses version 2.4 of the plugin, and it still expects the version number to match what ends up in the filename. The above version range likely should not end up in a filename.

Steps to Reproduce:

Specify a version number like [1.0.0,1.0.5]

Expected Result:

Downloads the latest version in the range, setting the filename to the attribute specified

Actual Result:

The initial fetch fails, because dependency plugin 2.4 does not support a range

Exposing maven's install path and ownership

These things can be delegated to the ark LWRP. I opened a PR at #61 to start discussing the issue. I tried opening a ticket at tickets.opscode.com as per your CONTRIBUTE.md guide but it eventually led me back to opening an issue on github.

I just signed the contributing license agreement, let me know if I need to do anything else.

/cc @ericfode

Thanks!

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • sous-chefs/.github 3.0.0
  • actions/checkout v4
  • actionshub/chef-install 2.0.4
  • actionshub/test-kitchen 2.1.0
.github/workflows/stale.yml
  • actions/stale v8

  • Check this box to trigger a request for Renovate to run again on this repository

Notifications are triggered even when artifact hasn't changed

Issue: When installing an artifact from maven repository, a notification is triggered even if the artifact hasn't changed.
Reason:

  1. The scope of the converge_by includes the checksum comparison condition, instead of first running the test and then converging.
  2. whyrun isn't properly implemented.

default resource changes mode of dest directory

Cookbook version

4.0.1, 2.2.0

Chef-client version

12.17.44

Platform Details

CentOS 6.8; test kitchen vagrant box

Scenario:

When using the default resource and you use '/tmp' as the dest it'll change your /tmp directory permissions to sadtimes aka 0755.

Steps to Reproduce:

Use the default 'maven' resource with dest '/tmp'.

Expected Result:

The resource is downloaded.

Actual Result:

The resource is downloaded but also the dir that 'dest' is set to has its mode changed to 0755.

Unable to override single option in mavenrc

In some situations multiple versions of Maven could be setup on an environment. The mavenrc file overrides the M2_HOME and MAVEN_OPTS in all cases. This makes it hard to override. Adding a check to set only when on already would be useful.

Update default maven version, url, and checksum.

Cookbook version

v5.0.3

Chef-client version

v12.16.42

Platform Details

AWS

Scenario:

When trying to install Maven, the default maven url for cookbook version 3.5.0 returns a 404 status code and chef complains that there was an "Error executing action install on resource 'ark[maven]'".

Steps to Reproduce:

Try installing maven via the maven cookbook.

Expected Result:

I expected maven to be installed in my EC2 instance without error.

Actual Result:

module.ec2_jenkins.aws_instance.ec2_instance (chef):     ================================================================================
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Error executing action `install` on resource 'ark[maven]'
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ================================================================================

module.ec2_jenkins.aws_instance.ec2_instance (chef):     Chef::Exceptions::MultipleFailures
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ----------------------------------
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Multiple failures occurred:
module.ec2_jenkins.aws_instance.ec2_instance (chef):     * Net::HTTPServerException occurred in chef run: remote_file[/var/chef/cache/maven-3.5.0.tar.gz] (/var/chef/cache/cookbooks/ark/resources/default.rb line 62) had an error: Net::HTTPServerException: 404 "Not Found"
module.ec2_jenkins.aws_instance.ec2_instance (chef):     * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[unpack /var/chef/cache/maven-3.5.0.tar.gz] (/var/chef/cache/cookbooks/ark/resources/default.rb line 72) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ---- Begin output of /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 ----
module.ec2_jenkins.aws_instance.ec2_instance (chef):     STDOUT:
module.ec2_jenkins.aws_instance.ec2_instance (chef):     STDERR: tar (child): /var/chef/cache/maven-3.5.0.tar.gz: Cannot open: No such file or directory
module.ec2_jenkins.aws_instance.ec2_instance (chef):     tar (child): Error is not recoverable: exiting now
module.ec2_jenkins.aws_instance.ec2_instance (chef):     /bin/tar: Child returned status 2
module.ec2_jenkins.aws_instance.ec2_instance (chef):     /bin/tar: Error is not recoverable: exiting now
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ---- End output of /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 ----
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Ran /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 returned 2
module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Resource Declaration:
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ---------------------
module.ec2_jenkins.aws_instance.ec2_instance (chef):     # In /var/chef/cache/cookbooks/maven/recipes/default.rb
module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef):      26: ark 'maven' do
module.ec2_jenkins.aws_instance.ec2_instance (chef):      27:   version node['maven']['version']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      28:   url node['maven']['url']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      29:   checksum node['maven']['checksum']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      30:   home_dir node['maven']['m2_home']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      31:   win_install_dir node['maven']['m2_home']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      32:   append_env_path node['maven']['setup_bin']
module.ec2_jenkins.aws_instance.ec2_instance (chef):      33: end
module.ec2_jenkins.aws_instance.ec2_instance (chef):      34:
module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Compiled Resource:
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ------------------
module.ec2_jenkins.aws_instance.ec2_instance (chef):     # Declared in /var/chef/cache/cookbooks/maven/recipes/default.rb:26:in `from_file'
module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ark("maven") do
module.ec2_jenkins.aws_instance.ec2_instance (chef):       action [:install]
module.ec2_jenkins.aws_instance.ec2_instance (chef):       updated true
module.ec2_jenkins.aws_instance.ec2_instance (chef):       updated_by_last_action true
module.ec2_jenkins.aws_instance.ec2_instance (chef):       retries 0
module.ec2_jenkins.aws_instance.ec2_instance (chef):       retry_delay 2
module.ec2_jenkins.aws_instance.ec2_instance (chef):       default_guard_interpreter :default
module.ec2_jenkins.aws_instance.ec2_instance (chef):       declared_type :ark
module.ec2_jenkins.aws_instance.ec2_instance (chef):       cookbook_name "maven"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       recipe_name "default"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       version "3.5.0"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       url "http://apache.mirrors.tds.net/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       checksum "beb91419245395bd69a4a6edad5ca3ec1a8b64e41457672dc687c173a495f034"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       home_dir "/usr/local/maven"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       win_install_dir "/usr/local/maven"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       append_env_path true
module.ec2_jenkins.aws_instance.ec2_instance (chef):       extension "tar.gz"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       prefix_bin "/usr/local/bin"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       prefix_root "/usr/local"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       owner "root"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       path "/usr/local/maven-3.5.0"
module.ec2_jenkins.aws_instance.ec2_instance (chef):       release_file "/var/chef/cache/maven-3.5.0.tar.gz"
module.ec2_jenkins.aws_instance.ec2_instance (chef):     end
module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef):     Platform:
module.ec2_jenkins.aws_instance.ec2_instance (chef):     ---------
module.ec2_jenkins.aws_instance.ec2_instance (chef):     x86_64-linux

module.ec2_jenkins.aws_instance.ec2_instance (chef):
module.ec2_jenkins.aws_instance.ec2_instance (chef): Running handlers:
module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:49-05:00] ERROR: Running exception handlers
module.ec2_jenkins.aws_instance.ec2_instance (chef): Running handlers complete
module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:49-05:00] ERROR: Exception handlers complete
module.ec2_jenkins.aws_instance.ec2_instance (chef): Chef Client failed. 2 resources updated in 30 seconds
module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:50-05:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:50-05:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:50-05:00] ERROR: ark[maven] (maven::default line 26) had an error: Chef::Exceptions::MultipleFailures: Multiple failures occurred:
module.ec2_jenkins.aws_instance.ec2_instance (chef): * Net::HTTPServerException occurred in chef run: remote_file[/var/chef/cache/maven-3.5.0.tar.gz] (/var/chef/cache/cookbooks/ark/resources/default.rb line 62) had an error: Net::HTTPServerException: 404 "Not Found"
module.ec2_jenkins.aws_instance.ec2_instance (chef): * Mixlib::ShellOut::ShellCommandFailed occurred in delayed notification: execute[unpack /var/chef/cache/maven-3.5.0.tar.gz] (/var/chef/cache/cookbooks/ark/resources/default.rb line 72) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '2'
module.ec2_jenkins.aws_instance.ec2_instance (chef): ---- Begin output of /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 ----
module.ec2_jenkins.aws_instance.ec2_instance (chef): STDOUT:
module.ec2_jenkins.aws_instance.ec2_instance (chef): STDERR: tar (child): /var/chef/cache/maven-3.5.0.tar.gz: Cannot open: No such file or directory
module.ec2_jenkins.aws_instance.ec2_instance (chef): tar (child): Error is not recoverable: exiting now
module.ec2_jenkins.aws_instance.ec2_instance (chef): /bin/tar: Child returned status 2
module.ec2_jenkins.aws_instance.ec2_instance (chef): /bin/tar: Error is not recoverable: exiting now
module.ec2_jenkins.aws_instance.ec2_instance (chef): ---- End output of /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 ----
module.ec2_jenkins.aws_instance.ec2_instance (chef): Ran /bin/tar xzf /var/chef/cache/maven-3.5.0.tar.gz --strip-components=1 returned 2

module.ec2_jenkins.aws_instance.ec2_instance (chef): [2017-11-27T18:56:50-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Releasing state lock. This may take a few moments...

Error: Error applying plan:

1 error(s) occurred:

* module.ec2_jenkins.aws_instance.ec2_instance: 1 error(s) occurred:

* Command "sudo chef-client -j \"/etc/chef/first-boot.json\" -E \"uat\"" exited with non-zero exit status: 1

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

fails to run due to Ark error

Running this on Fedora 22, trying to just include the maven recipe to get it installed, fails with an Ark error:

================================================================================
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/gso-pipeline/recipes/jenkins_master.rb
================================================================================

   NoMethodError
   -------------
   undefined method `win_install_dir' for Chef::Resource::Ark

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/maven/recipes/default.rb:32:in `block in from_file'
     /tmp/kitchen/cache/cookbooks/maven/recipes/default.rb:28:in `from_file'
     /tmp/kitchen/cache/cookbooks/gso-pipeline/recipes/jenkins_master.rb:18:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/maven/recipes/default.rb:

    25:  
    26:  mvn_version = node['maven']['version'].to_s
    27:  
    28:  ark 'maven' do
    29:    url             node['maven'][mvn_version]['url']
    30:    checksum        node['maven'][mvn_version]['checksum']
    31:    home_dir        node['maven']['m2_home']
    32>>   win_install_dir node['maven']['m2_home']
    33:    version         node['maven'][mvn_version]['version']
    34:    append_env_path true
    35:  end
    36:  
    37:  if node['platform_family'] === 'windows'
    38:    env 'M2_HOME' do
    39:      value node['maven']['m2_home']
    40:      action :create
    41:    end

### Maven Version are been archived

Cookbook version

[Version of the cookbook where you are encountering the issue]

Chef-client version

[Version of chef-client in your environment]

Platform Details

[Operating system distribution and release version. Cloud provider if running in the cloud]

Scenario:

[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?]

Expected Result:

[What are you expecting to happen as the consequence of above reproduction steps?]

Actual Result:

[What actually happens after the reproduction steps? Include the error output or a link to a gist if possible.]

Build failing

Looking for a maven cookbook, I found this project and its build-failing badge. I'm double-checking--is this cookbook intended for use?

maven_settings does not flush/close file

Cookbook: 4.0.1
Chef: 12

The settings LWRP does not close (nor explicitly flush) the settings file that it is writing. So if you have a maven_settings followed immediately by maven resource the maven resource may fail because it reads an empty or partially written settings.xml.

m2_home/bin not added to PATH on windows

the maven resource fails on windows with
STDERR: 'mvn' is not recognized as an internal or external command,

saying:
windows_path ::File.join(node['maven']['m2_home'], 'bin')

right after -
include_recipe 'maven::default'

resolves the issue

Unable to Download Maven file apache-maven-3.5.0-bin.tar.gz

Cookbook version

maven (5.0.1)

Chef-client version

Chef: 12.17.44

Platform Details

OS: Linux Mint 18.1 Serena x86_64

Scenario:

Provision a bamboo agent with chef which uses the maven cookbook

Steps to Reproduce:

Attempt to use this cookbook

Expected Result:

Maven file will not be available at http://apache.mirrors.tds.net/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz

Actual Result:

Recipe: maven::default
* ark[maven] action install
* directory[/usr/local/maven-3.5.0] action create
- create new directory /usr/local/maven-3.5.0
* remote_file[/var/chef/cache/maven-3.5.0.tar.gz] action create[2017-11-13T00:16:25+00:00] WARN: remote_file[/var/chef/cache/maven-3.5.0.tar.gz] cannot be downloaded from http://apache.mirrors.tds.net/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz: 404 "Not Found"

Berksfile is not upto date

Berksfile is not upto date, e.g. it uses site instead of source.
Cookbook dependencies are not in sync with metadata.rb file

Add check and informative message that maven is installed on the node

When I try to execute a recipe like that:

maven 'spring-context' do
   group_id 'org.springframework'
   version  '4.0.4.RELEASE'
   dest     '/root'
   repositories ['http://repo.maven.apache.org/maven2/']
end

After executing from workstation:

knife bootstrap 192.168.1.37 -V --ssh-user root --ssh-password '123456' --sudo --use-sudo-password --node-name node-with-maven-run --run-list 'recipe[reference-app]'

I got an error:

No such file or directory - mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DgroupId=org.springframework -DartifactId=spring-context -Dversion=4.0.4.RELEASE -Dpackaging=jar  -Ddest=/tmp/chef_maven_lwrp20141212-27453-ocmoxb/spring-context-4.0.4.RELEASE.jar -DremoteRepositories=http://repo.maven.apache.org/maven2/ -Dtransitive=false

Which means that maven simply has not been installed on the node.

So it needs to check that it exists and print corresponding message.

UPDATED
As it tunrs out I did not include maven recipe, e.g. on the top there should be include_recipe "maven::default" none the less adding a message mvn command is not found, please check that maven is installed or check that you include maven::default recipe

Maven version 3.5.0 no longer in Apache mirrors

Cookbook version

5.0.1

Chef-client version

All

Platform Details

All Linux

Scenario:

Install maven with include_recipe 'maven'

Steps to Reproduce:

Attempt to converge

Expected Result:

Maven is installed

Actual Result:

Receive an error when remote_file attempts to retrieve the maven tar.gz file, as the resource is no longer hosted on the mirror.

Confirmed no 3.5.0 version at

http://apache.mirrors.tds.net/maven/maven-3/

looks like 'repositories' custom settings is ignored

I am tying to point to our local maven repo (Nexus) to pull the artifact, but I get an error complaining about not being able to connect to http://repo.maven.apache.org (connection refused) The machine I'm trying to run the recipe is behind the firewall.
I trying to run an example:

maven 'mysql-connector-java' do 
  group_id 'mysql' 
  version '5.1.19' 
  repositories ['http://company/local/repo']
  dest '/home/someuser/'
  owner 'someuser'
end

I get

[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-dependency-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused: Connection timed out -> [Help 1]

Is there any other way to point to the custom repo?
NOTE: Platform RHEL. Chef: 11.12.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.