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

Update default maven version, url, and checksum. #92

Closed alexanderdavidpan closed 6 years ago

alexanderdavidpan commented 6 years ago

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.
iennae commented 6 years ago

Your PR is fine, but wanted to comment on this issue. It looks like you have the url defined using the mirror "http://apache.mirrors.tds.net/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz" which archives off older releases. Your PR takes it to latest version which is available, but this will continue to pop up as an issue each time. I wanted to make sure to comment here so folks in the future who run into a similar issue understand what is going on. The solution is to override the version attribute to what is available on the mirror in use OR to update the url attribute to a repository that has the version you're trying to install.

iennae commented 6 years ago

Release 5.1.0 updates the version and checksum to latest release.