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

Idempotent #100

Closed jlosito closed 3 years ago

jlosito commented 4 years ago

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
github-actions[bot] commented 3 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] commented 3 years ago

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.