evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.
https://supermarket.chef.io/cookbooks/zookeeper
Apache License 2.0
81 stars 119 forks source link

Updates to use lazy evaluation of attributes #153

Closed Maniacal closed 8 years ago

Maniacal commented 8 years ago

Reference: https://github.com/SimpleFinance/chef-zookeeper/issues/151

jeffbyrnes commented 8 years ago

@Maniacal thanks for your contribution! A few things:

Maniacal commented 8 years ago

There may be something up with my dev box but I can't get default-ubuntu-1404 to converge locally without putting default['apt']['compile_time_update'] = true in the default attributes. I have validated that node['platform_family'] comes back as 'debian'. I think maybe apt is getting compiled before the attribute can is set so it's not happening.

I'm using ChefDK:

± chef -v
Chef Development Kit Version: 0.9.0
chef-client version: 12.5.1
berks version: 4.0.1
kitchen version: 1.4.2

Here's the result of my run:

± kitchen converge default-ubuntu-1404
-----> Starting Kitchen (v1.4.2)
-----> Creating <default-ubuntu-1404>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'opscode-ubuntu-14.04'...
==> default: Matching MAC address for NAT networking...
       ==> default: Setting the name of the VM: kitchen-chef-zookeeper-default-ubuntu-1404_default_1450729895647_70107
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 => 2222 (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: Warning: Connection timeout. Retrying...
           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 its present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
       ==> default: Setting hostname...
       ==> default: Machine not provisioning because `--no-provision` is specified.
       [SSH] Established
       Vagrant instance <default-ubuntu-1404> created.
       Finished creating <default-ubuntu-1404> (0m38.50s).
-----> Converging <default-ubuntu-1404>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.0.1...
       Removing non-cookbook files before transfer
       Preparing solo.rb
-----> Installing Chef Omnibus (11.8)
       Downloading https://www.chef.io/chef/install.sh to file /tmp/install.sh
       Trying wget...
       Download complete.
       Getting information for chef stable 11.8 for ubuntu...
       downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=11.8&p=ubuntu&pv=14.04&m=x86_64
         to file /tmp/install.sh.1344/metadata.txt
       trying wget...
       url  https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.8.2-1.ubuntu.13.04_amd64.deb
       md5  7330b13d6aa17dad8b9e9ae6a018aef7
       sha256   dd9bdb08db56cd44c556b3ff59a63d2500954215ec9bec6ed60c939d1991b354
       version  11.8.2downloaded metadata file looks valid...
       downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.8.2-1.ubuntu.13.04_amd64.deb
         to file /tmp/install.sh.1344/chef_11.8.2-1.ubuntu.13.04_amd64.deb
       trying wget...
       Comparing checksum with sha256sum...
       Installing chef 11.8
       installing with dpkg...
       Selecting previously unselected package chef.
(Reading database ... 32400 files and directories currently installed.)
       Preparing to unpack .../chef_11.8.2-1.ubuntu.13.04_amd64.deb ...
       Unpacking chef (11.8.2-1.ubuntu.13.04) ...
       Setting up chef (11.8.2-1.ubuntu.13.04) ...
       Thank you for installing Chef!
       Transferring files to <default-ubuntu-1404>
       Starting Chef Client, version 11.8.2
       Compiling Cookbooks...
       [2015-12-21T20:32:36+00:00] WARN: Using java::default instead is recommended.
       Recipe: build-essential::_debian
         * package[autoconf] action install
           - install version 2.69-6 of package autoconf
         * package[binutils-doc] action install
           - install version 2.24-5ubuntu3 of package binutils-doc
         * package[bison] action install
           - install version 2:3.0.2.dfsg-2 of package bison
         * package[build-essential] action install
       ================================================================================
       Error executing action `install` on resource 'package[build-essential]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '100'
       ---- Begin output of apt-get -q -y install build-essential=11.6ubuntu6 ----
       STDOUT: Reading package lists...
       Building dependency tree...
       Reading state information...
       The following extra packages will be installed:
         cpp dpkg-dev fakeroot g++ g++-4.8 gcc libalgorithm-diff-perl
         libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libfakeroot
         libfile-fcntllock-perl libstdc++-4.8-dev patch
       Suggested packages:
         cpp-doc debian-keyring g++-multilib g++-4.8-multilib gcc-4.8-doc
         libstdc++6-4.8-dbg gcc-multilib manpages-dev automake1.9 libtool flex gdb
         gcc-doc libstdc++-4.8-doc diffutils-doc
       The following NEW packages will be installed:
         build-essential cpp dpkg-dev fakeroot g++ g++-4.8 gcc libalgorithm-diff-perl
         libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libfakeroot
         libfile-fcntllock-perl libstdc++-4.8-dev patch
       0 upgraded, 15 newly installed, 0 to remove and 1 not upgraded.
       Need to get 9,288 kB of archives.
       After this operation, 34.1 MB of additional disk space will be used.
       Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main cpp amd64 4:4.8.2-1ubuntu6 [27.5 kB]
       Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main gcc amd64 4:4.8.2-1ubuntu6 [5,098 B]
       Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main libstdc++-4.8-dev amd64 4.8.2-19ubuntu1 [1,050 kB]
<---- snip ---->

As you can see from that output it runs build-essential without running the apt update first. Which bombs out.

I rolled the version number update back

jeffbyrnes commented 8 years ago

Brought this in with 6750ea8c11a6dd7ef1c0f76ac8c61b71a172fb80, thanks @Maniacal! Tests well, too, on Ubuntu 12.04 & 14.04.