hit counter

Timeline

My development logbook

Kitchen Converge Creates Two VMs

It is because in .kitchen.yml, it contains these two lines:

    platforms:
      - name: ubuntu-12.04
      - name: centos-6.5 

I can either specify the partform every time I use the kitchen command or simply remove the platform that I do not need.

Error Running the Motd Example of the Chef Book

I am following the chapter “Your First Cookbook: Message of the Day” from Learning Chef by Mischa Taylor

When I run kitchen converge, I got these error messages:

               ================================================================================
               Error executing action `create` on resource 'cookbook_file[/etc/motd]'
               ================================================================================

               Chef::Exceptions::FileNotFound
               ------------------------------
               Cookbook 'motd' (0.1.0) does not contain a file at any of these locations:
                 files/ubuntu-12.04/motd
                 files/ubuntu/motd
                 files/default/motd
                 files/motd

               Resource Declaration:
               ---------------------
               # In /tmp/kitchen/cookbooks/motd/recipes/default.rb

                 9: cookbook_file "/etc/motd" do
                10:   source "motd"
                11:   mode "0644"
                12: end

               Compiled Resource:
               ------------------
               # Declared in /tmp/kitchen/cookbooks/motd/recipes/default.rb:9:in `from_file'

               cookbook_file("/etc/motd") do
                 provider Chef::Provider::CookbookFile
                 action "create"
                 retries 0
                 retry_delay 2
                 default_guard_interpreter :default
                 path "/etc/motd"
                 backup 5
                 atomic_update true
                 source "motd"
                 declared_type :cookbook_file
                 cookbook_name :motd
                 recipe_name "default"
                 mode "0644"
               end


           Running handlers:
           [2015-02-14T04:22:29+00:00] ERROR: Running exception handlers
           Running handlers complete
           [2015-02-14T04:22:29+00:00] ERROR: Exception handlers complete
           [2015-02-14T04:22:29+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
           Chef Client failed. 0 resources updated in 11.010074864 seconds
           [2015-02-14T04:22:29+00:00] ERROR: cookbook_file[/etc/motd] (motd::default line 9) had an error: Chef::Exceptions::FileNotFound: Cookbook 'motd' (0.1.0) does not contain a file at any of these locations:
             files/ubuntu-12.04/motd
             files/ubuntu/motd
             files/default/motd
      1 Hello, world
             files/motd
           [2015-02-14T04:22:29+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

It is because I forgot to create the file files/default/motd

Kitchen Converge Problem 2

Trying the kitchen command again, and I am still getting error messages

    $ kitchen converge
    -----> Starting Kitchen (v1.3.1)
    -----> Creating <default-ubuntu-1204>...
           Bringing machine 'default' up with 'virtualbox' provider...
           The following berks command failed to execute:

               /Users/antkong/.rvm/gems/ruby-2.2.0/bin/berks --version --format json

           The stdout and stderr are shown below:

I probably have installed chefdk when the system ruby is active.

So rvm use system works for me

A Successful Run of Kitchen Init

    $ kitchen init --gem-file
       identical  .kitchen.yml
    Successfully installed kitchen-vagrant-0.15.0
    Parsing documentation for kitchen-vagrant-0.15.0
    Installing ri documentation for kitchen-vagrant-0.15.0
    Done installing documentation for kitchen-vagrant after 0 seconds
    1 gem installed

Berkshelf Problem With Kitchen Converge

My kitchen converge throws a lot of error message

    $ kitchen converge
    -----> Starting Kitchen (v1.3.1)

    ....

    >>>>>> ------Exception-------
    >>>>>> Class: Kitchen::ActionFailed
    >>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
    ---- Begin output of vagrant up --no-provision --provider=virtualbox ----
    STDOUT: Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Box 'opscode-ubuntu-12.04' could not be found. Attempting to find and install...
        default: Box Provider: virtualbox
        default: Box Version: >= 0
    ==> default: Adding box 'opscode-ubuntu-12.04' (v0) for provider: virtualbox
        default: Downloading: https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box
    ==> default: Successfully added box 'opscode-ubuntu-12.04' (v0) for 'virtualbox'!
    STDERR: The following berks command failed to execute:

        /Users/antkong/.rvm/gems/ruby-2.2.0/bin/berks --version --format json

    The stdout and stderr are shown below:

        stdout:
        stderr: /Users/antkong/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'berkshelf' (>= 0) among 122 total gem(s) (Gem::LoadError)
    Checked in 'GEM_PATH=/Users/antkong/.vagrant.d/gems:/opt/vagrant/bin/../embedded/gems', execute `gem env` for more information
      from /Users/antkong/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
      from /Users/antkong/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
      from /Users/antkong/.rvm/gems/ruby-2.2.0/bin/berks:22:in `<main>'


    It appears that you are not using the ChefDK. Please note that Vagrant Berkshelf
    works best when used with the ChefDK, and other installation methods are not
    officially supported.

    Please download and install the latest version of the ChefDK from:

        https://downloads.getchef.com/chef-dk

    and follow the installation instructions. Do not forget to add the ChefDK to
    your PATH.
    ---- End output of vagrant up --no-provision --provider=virtualbox ----
    Ran vagrant up --no-provision --provider=virtualbox returned 1]
    >>>>>> ----------------------
    >>>>>> Please see .kitchen/logs/kitchen.log for more details
    >>>>>> Also try running `kitchen diagnose --all` for configuration

It is related to the active rvm. Once I run rvm use system, the problem is resolved.