Git Product home page Git Product logo

kitchen-puppet's Introduction

Kitchen Puppet

Gem Version Gem Downloads Build Status

kitchen-puppet

A Test Kitchen Provisioner for Puppet

The providers supports both puppet apply and puppet agent clients and puppet bolt.

The PuppetApply provider works by passing the puppet repository based on attributes in .kitchen.yml & calling puppet apply.

The PuppetAgent provider works by passing the puppetmaster and other attributes in .kitchen.yml & calling puppet agent.

The PuppetBolt provider works by passing the puppet bolt commands based on attributes in .kitchen.yml & calling puppet bolt.

This provider has been tested against the Ubuntu 1604 and Centos 7 boxes running in docker and vagrant/virtualbox.

Template

Template project for using kitchen for puppet development:

https://github.com/scoopex/puppet-kitchen_template

Resources

Install

  1. install the latest Ruby on your workstations (for windows see https://rubyinstaller.org/downloads/)

  2. From a Command prompt:

  • gem install librarian-puppet
  • gem install test-kitchen (or gem install test-kitchen -v 1.16.0 if using ruby version less than 2.3)
  • gem install kitchen-puppet

Requirements

It is recommended to have a metadata.json file of your puppet module. It is used by kitchen-puppet to configure the module path. The puppet docs describe (https://docs.puppetlabs.com/puppet/latest/reference/modules_publishing.html#write-a-metadatajson-file) how to create one.

You'll need a driver box without a chef installation so puppet can be installed. Puppet have one at http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box or http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box.

For PuppetAgent a server with a puppet master is required that can resolve the hostname ip address of the server. The server must also be able to resolve the hostname ip address of the puppet master.

You can also use the PuppetApply driver with a docker container, provided the necessary box requirements to install puppet are included inside the container. The easiest way to do this is to supply Kitchen-Docker with a custom dockerfile to install the needed dependencies for puppet installation.

Windows Support

There is windows/winrm support, currently not all functionality is supported.

  • require_chef_for_busser: false (it is possible to call rspec over winrm to run the tests)
  • resolve_with_librarian_puppet: false (librarian-puppet is not working on windows server)

Sample Puppet Repositories

Using Environments

In the root directory for your puppet repository:

Create a .kitchen.yml, much like one the described above:

    ---
    driver:
      name: vagrant

    provisioner:
      name: puppet_apply
      puppet_environment: dev
# the puppet environmnt files can be in this repository
      puppet_environment_config_path: environment/dev/environment.conf
      manifests_path:  environment/dev/manifests
      modules_path: environment/dev/modules_mycompany
# or external to this repository as long as they are accessible
#     puppet_environment_config_path: /my_environments/dev/environment.conf
#     manifests_path:                 /my_environments/dev/manifests
#     modules_path:                   /my_environments/dev/modules_mycompany
      hiera_data_path: /repository/puppet_repo/hieradata

    platforms:
    - name: nocm_ubuntu-12.04
      driver_plugin: vagrant
      driver_config:
        box: nocm_ubuntu-12.04
        box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box

    suites:
     - name: default

Sample Puppet Repositories

Test-Kitchen Serverspec

To run the verify step with the test-kitchen serverspec setup your puppet repository as follows:

In the root directory for your puppet repository:

Create a .kitchen.yml, much like one the described above:

    ---
    driver:
      name: vagrant

    provisioner:
      name: puppet_apply
      manifests_path: /repository/puppet_repo/manifests
      modules_path: /repository/puppet_repo/modules-mycompany
      hiera_data_path: /repository/puppet_repo/hieradata

    platforms:
    - name: nocm_ubuntu-12.04
      driver_plugin: vagrant
      driver_config:
        box: nocm_ubuntu-12.04
        box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box

    suites:
     - name: default

Then for serverspec:

  mkdir -p test/integration/default/serverspec/localhost
  echo "require 'serverspec'" >> test/integration/default/serverspec/spec_helper.rb
  echo "set :backend, :exec" >> test/integration/default/serverspec/spec_helper.rb

Create your serverspec tests in test/integration/default/serverspec/localhost/xxxxxx_spec.rb:

  require 'spec_helper'

  if os[:family] == 'ubuntu'
        describe '/etc/lsb-release' do
          it "exists" do
              expect(file('/etc/lsb-release')).to be_file
          end
        end
  end

  if os[:family] == 'redhat'
    describe '/etc/redhat-release' do
      it "exists" do
          expect(file('/etc/redhat-release')).to be_file
      end
    end
  end

Test-Kitchen Beaker

test-kitchen normally uses tests setup in test/integration/.... directory. Beaker format puts the tests with the spec/acceptance directory in the puppet repository and the spec_helper.rb under the spec directory which is more logical.

For examples see:

To implement this with test-kitchen setup the puppet repository with:

  • the spec files with the spec/acceptance directory.

  • the spec_helper in the spec folder.

  • install kitchen-verifier-serverspec on your workstation i.e. 'gem install kitchen-verifier-serverspec'

See examples:

.
+-- spec
¦   +-- acceptance
¦   ¦   +-- mariadb_spec.rb
¦   ¦   +-- nginx_spec.rb
¦   ¦
    +-- spec_helper.rb

In the root directory for your puppet repository create a .kitchen.yml with

  • a verifier of 'serverspec'
  • a pattern parameter with the spec tests to run
verifier:
  name: serverspec

suites:
  - name: base
    verifier:
      patterns:
      - modules/mycompany_base/spec/acceptance/base_spec.rb

See kitchen-verifier-serverspec

hiera_writer_files option

Allows creation of arbitrary YAML files in the target instance's hieradata/ dir in test-kitchen configuration (eg kitchen.yml). Like setting chef attributes in kitchen.yml, except for Hiera YAML files.

set hiera_writer_files in kitchen.yml

---
driver:
  name: vagrant

provisioner:
  name: puppet_apply
  manifests_path: /repository/puppet_repo/manifests
  modules_path: /repository/puppet_repo/modules-mycompany
  hiera_data_path: /repository/puppet_repo/hieradata
  hiera_writer_files:
    - datacenter/vagrant.yaml:
        logstash_servers: []
        hosts:
          10.1.2.3:
          - puppet
          - puppetdb

platforms:
- name: nocm_ubuntu-12.04
  driver_plugin: vagrant
  driver_config:
    box: nocm_ubuntu-12.04
    box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box

suites:
 - name: default

The above configuration will result in the creation of a file on the guest named ${hieradata}/datacenter/vagrant.yaml containing:

---
logstash_servers: []
  hosts:
    10.1.2.3:
    - puppet
    - puppetdb

It will overwrite any existing Hiera YAML files with the same name (on the guest), not merge.

Provisioner Options

Please see the Provisioner Options (https://github.com/neillturner/kitchen-puppet/blob/master/provisioner_options.md).

Contributing

To contribute to the repository, please follow the Fork / PR model:

  1. Fork The Repository
  2. Work on epic changes
  3. Write tests for your changes, see TESTING
  4. Update Documentation
  5. Commit
  6. Push
  7. Create PR
  8. Profit(?)

kitchen-puppet's People

Contributors

balous avatar benlangfeld avatar ccope avatar cgetzen avatar chrislundquist avatar clambertus avatar dlerch-transporeon avatar ehaselwanter avatar elconas avatar grubernaut avatar gsandie avatar jake-minted avatar jlyheden avatar jniesen avatar jrwesolo avatar jtopjian avatar legal90 avatar logicminds avatar looztra avatar ltamm avatar madandroid avatar neillturner avatar nicolasvan avatar nmaludy avatar nvtkaszpir avatar pesimon avatar peterabbott avatar pietervogelaar avatar shoddyguard avatar troyready 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  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  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

kitchen-puppet's Issues

Kitchen: Message: Failed to complete #converge action: [undefined local variable or method `modules_path' for

Seems like 0.0.29 release is broken:

E, [2015-07-24T12:50:03.996708 #25439] ERROR -- Kitchen: Class: Kitchen::ActionFailed
E, [2015-07-24T12:50:03.996737 #25439] ERROR -- Kitchen: Message: Failed to complete #converge action: [undefined local variable or method `modules_path' for #<Kitchen::Provisioner::PuppetApply:0x007f913e1752d8>]
E, [2015-07-24T12:50:03.996765 #25439] ERROR -- Kitchen: ---Nested Exception---
E, [2015-07-24T12:50:03.996839 #25439] ERROR -- Kitchen: Class: NameError
E, [2015-07-24T12:50:03.996889 #25439] ERROR -- Kitchen: Message: undefined local variable or method `modules_path' for #<Kitchen::Provisioner::PuppetApply:0x007f913e1752d8>
E, [2015-07-24T12:50:03.996921 #25439] ERROR -- Kitchen: ------Backtrace-------
E, [2015-07-24T12:50:03.996949 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/kitchen-puppet-0.0.29/lib/kitchen/provisioner/puppet_apply.rb:535:in `modules'
E, [2015-07-24T12:50:03.996977 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/kitchen-puppet-0.0.29/lib/kitchen/provisioner/puppet_apply.rb:814:in `prepare_modules'
E, [2015-07-24T12:50:03.997006 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/kitchen-puppet-0.0.29/lib/kitchen/provisioner/puppet_apply.rb:361:in `create_sandbox'
E, [2015-07-24T12:50:03.997032 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/provisioner/base.rb:61:in `call'
E, [2015-07-24T12:50:03.997061 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:366:in `block in converge_action'
E, [2015-07-24T12:50:03.997089 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:488:in `call'
E, [2015-07-24T12:50:03.997117 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:488:in `synchronize_or_call'
E, [2015-07-24T12:50:03.997144 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:453:in `block in action'
E, [2015-07-24T12:50:03.997169 #25439] ERROR -- Kitchen: /opt/rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
E, [2015-07-24T12:50:03.997196 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:452:in `action'
E, [2015-07-24T12:50:03.997224 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:362:in `converge_action'
E, [2015-07-24T12:50:03.997254 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:341:in `block in transition_to'
E, [2015-07-24T12:50:03.997330 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:340:in `each'
E, [2015-07-24T12:50:03.997363 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:340:in `transition_to'
E, [2015-07-24T12:50:03.997390 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:160:in `verify'
E, [2015-07-24T12:50:03.997416 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:189:in `block in test'
E, [2015-07-24T12:50:03.997442 #25439] ERROR -- Kitchen: /opt/rbenv/versions/2.1.6/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
E, [2015-07-24T12:50:03.997470 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/instance.rb:185:in `test'
E, [2015-07-24T12:50:03.997504 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/command.rb:176:in `public_send'
E, [2015-07-24T12:50:03.997531 #25439] ERROR -- Kitchen: /my/user/home/.bundle/gems/test-kitchen-1.4.1/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'

PR #77 now makes modules_path mandatory

PR #77 introduces breaking changes when not specifying modules_path

'''
Kitchen::ActionFailed: Failed to complete #converge action: [undefined method include?' for nil:NilClass] /u01/jenkins/.gem/ruby/2.0/gems/kitchen-puppet-1.40.0/lib/kitchen/provisioner/puppet_apply.rb:968:inprepare_modules'
/u01/jenkins/.gem/ruby/2.0/gems/kitchen-puppet-1.40.0/lib/kitchen/provisioner/puppet_apply.rb:426:in create_sandbox' /u01/jenkins/.gem/ruby/2.0/gems/test-kitchen-1.7.3/lib/kitchen/provisioner/base.rb:63:incall
'''

Support for multiple paths for modules

Feature request.

As described in Puppet documentation you can use --modulepath=path/foo:/bar/baz to select multiple directories to search for modules https://docs.puppetlabs.com/puppet/3.6/reference/dirs_modulepath.html (not to mention that windows formatting differs).

This means that config should accept Array of the directories, then it would have to trigger uploads and merge list into a line and update command to execute puppet.

Right now custom puppet command is possible, but not sure how to tell test-kitchen to upload given directories to the specific folders.

Default Puppetlabs Ubuntu deb version is too old (precise)

Problem

In puppet_apply.rb, we see that the default Puppet APT repo is very old (Ubuntu precise)

default_config :puppet_apt_repo, 'http://apt.puppetlabs.com/puppetlabs-release-precise.deb'

When using a Vagrant + Kitchen setup like this:

 platforms:
   - name: ubuntu-14.04

It fails to detect that '14.04' and sticks with the 'precise' URL. This breaks installation, because the puppet and hiera-puppet packages in this repo have broken dependencies:

The following packages have unmet dependencies:
        hiera-puppet : Depends: puppet but it is not going to be installed
       E: Unable to correct problems, you have held broken packages.

Fix

Therefore it might be a good plan to update this default config to at least point at the trusty package.

Workaround

In the meantime, this kitchen.yml setup seems to get past this problem stage:

provisioner:
  name: puppet_apply
  require_chef_for_busser: false
  puppet_apt_repo: http://apt.puppetlabs.com/puppetlabs-release-trusty.deb

platforms:
  - name: ubuntu-14.04

Support for Puppet ENC

If using shell script ENC, we would like to specify the ENC script for puppet for the puppet apply provisioner:

provisioner:
puppet_enc: enc/puppet_enc.sh

This should copy enc/puppet_enc.sh to /tmp/kitchen/enc and add the following option to puppet apply:

--node_terminus=exec --external_nodes=/tmp/kitchen/enc

The file /tmp/kitchen/files/enc should be chmod "755" after copying.

platform name regression

#68 brought regression

in form of platform config collision

If I have in my .kitchen.yml platform entry like

  platforms:
  - name: fake

then converge will fail with

    >>>>>> Unsupported Platform - fake
    >>>>>> Unsupported Platform - fake
    >>>>>> ------Exception-------
    >>>>>> Class: Kitchen::ActionFailed
    >>>>>> Message: Failed to complete #converge action: [undefined method
    >>>>>> `split' for true:TrueClass]

kitchen-sshtar expects directories, fails on hiera.yaml file (not a directory)

When trying to use kitchen-transport-sshtar (0.1.1) as a transport, it fails with error message that hiera.yaml is not a directory

.kitchen.local.yaml transport section

transport:
 name: sshtar # supports only passwordless logins

Of course hiera_config_path: parameter in provisioner section does not change the error output.

output log


kitchen converge basenode-debian7awswawfra


-----> Starting Kitchen (v1.4.2)
-----> Converging <basenode-debian7awswawfra>...
       Preparing files for transfer
       Preparing modules
       Preparing manifests
       Preparing files
       nothing to do for files
       Preparing hiera
       Preparing hiera data
       Finished Preparing files for transfer
       Installing puppet on debian
       Transferring files to <basenode-debian7awswawfra>
tar: /tmp/basenode-debian7awswawfra-sandbox-20150911-9124-1ni1wnh/hiera.yaml: Cannot open: Not a directory
tar: Error is not recoverable: exiting now
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
       [SSH-TAR] Time taken to upload /tmp/basenode-debian7awswawfra-sandbox-20150911-9124-1ni1wnh/hiera.yaml to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}>:/tmp/kitchen/hiera.yaml: 0.23 sec
       [SSH-TAR] Time taken to upload /tmp/basenode-debian7awswawfra-sandbox-20150911-9124-1ni1wnh/manifests to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}>:/tmp/kitchen/manifests: 0.33 sec
       [SSH-TAR] Time taken to upload /tmp/basenode-debian7awswawfra-sandbox-20150911-9124-1ni1wnh/modules to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}>:/tmp/kitchen/modules: 5.62 sec
       [SSH-TAR] Time taken to upload /tmp/basenode-debian7awswawfra-sandbox-20150911-9124-1ni1wnh/hiera to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}>:/tmp/kitchen/hiera: 0.25 sec
       cp: cannot stat `/tmp/kitchen/hiera.yaml': No such file or directory
>>>>>> Converge failed on instance <basenode-debian7awswawfra>.
>>>>>> Please see .kitchen/logs/basenode-debian7awswawfra.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sudo -E cp /tmp/kitchen/hiera.yaml /etc/ && sudo -E cp /tmp/kitchen/hiera.yaml /etc/puppet && sudo -E cp -r /tmp/kitchen/hiera /var/lib/]
>>>>>> ----------------------

Running with -l debug option, just plasting top lines till enrror occurs

-----> Starting Kitchen (v1.4.2)
D      [Vagrant command] BEGIN (vagrant --version)
D      [Vagrant command] END (0m0.29s)
-----> Converging <basenode-debian7awswawfra>...
       Preparing files for transfer
D      Creating local sandbox in /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw
D      Creating local sandbox in /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw
       Preparing modules
D      Copying modules from puppet/modules to /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/modules
       Preparing manifests
D      Using manifests from puppet/manifests
       Preparing files
       nothing to do for files
       Preparing hiera
D      Using hiera from puppet/hiera.kitchen.yaml
       Preparing hiera data
D      Copying hiera data from puppet/hiera to /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/hiera
       Finished Preparing files for transfer
       Installing puppet on debian
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"]}> (              if [ ! $(which puppet) ]; then
                sudo -E apt-get -y install wget
                sudo -E wget  http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
                sudo -E dpkg -i puppetlabs-release-wheezy.deb
                sudo -E apt-get update
                sudo -E apt-get -y install facter
                sudo -E apt-get -y install puppet-common
                sudo -E apt-get -y install puppet

              fi


                        # Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
  if command -v $1 >/dev/null 2>&1
  then
    return 0
  else
    return 1
  fi
}

# do_wget URL FILENAME
do_wget() {
  echo "trying wget..."
  wget -O "$2" "$1" 2>/tmp/stderr
  # check for bad return status
  test $? -ne 0 && return 1
  # check for 404 or empty file
  grep "ERROR 404" /tmp/stderr 2>&1 >/dev/null
  if test $? -eq 0 || test ! -s "$2"; then
    return 1
  fi
  return 0
}

# do_curl URL FILENAME
do_curl() {
  echo "trying curl..."
  curl -L "$1" > "$2"
  # check for bad return status
  [ $? -ne 0 ] && return 1
  # check for bad output or empty file
  grep "The specified key does not exist." "$2" 2>&1 >/dev/null
  if test $? -eq 0 || test ! -s "$2"; then
    return 1
  fi
  return 0
}

# do_fetch URL FILENAME
do_fetch() {
  echo "trying fetch..."
  fetch -o "$2" "$1" 2>/tmp/stderr
  # check for bad return status
  test $? -ne 0 && return 1
  return 0
}

# do_perl URL FILENAME
do_perl() {
  echo "trying perl..."
  perl -e "use LWP::Simple; getprint($ARGV[0]);" "$1" > "$2"
  # check for bad return status
  test $? -ne 0 && return 1
  # check for bad output or empty file
  # grep "The specified key does not exist." "$2" 2>&1 >/dev/null
  # if test $? -eq 0 || test ! -s "$2"; then
  #   unable_to_retrieve_package
  # fi
  return 0
}

# do_python URL FILENAME
do_python() {
  echo "trying python..."
  python -c "import sys,urllib2 ; sys.stdout.write(urllib2.urlopen(sys.argv[1]).read())" "$1" > "$2"
  # check for bad return status
  test $? -ne 0 && return 1
  # check for bad output or empty file
  #grep "The specified key does not exist." "$2" 2>&1 >/dev/null
  #if test $? -eq 0 || test ! -s "$2"; then
  #  unable_to_retrieve_package
  #fi
  return 0
}

# do_download URL FILENAME
do_download() {
  PATH=/opt/local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  export PATH

  echo "downloading $1"
  echo "  to file $2"

  # we try all of these until we get success.
  # perl, in particular may be present but LWP::Simple may not be installed

  if exists wget; then
    do_wget $1 $2 && return 0
  fi

  if exists curl; then
    do_curl $1 $2 && return 0
  fi

  if exists fetch; then
    do_fetch $1 $2 && return 0
  fi

  if exists perl; then
    do_perl $1 $2 && return 0
  fi

  if exists python; then
    do_python $1 $2 && return 0
  fi

  echo ">>>>>> wget, curl, fetch, perl or python not found on this instance."
  return 16
}

          # install chef omnibus so that busser works as this is needed to run tests :(
          # TODO: work out how to install enough ruby
          # and set busser: { :ruby_bindir => '/usr/bin/ruby' } so that we dont need the
          # whole chef client
          if [ ! -d "/opt/chef" ]
          then
            echo '-----> Installing Chef Omnibus to install busser to run tests'
            do_download https://www.getchef.com/chef/install.sh /tmp/install.sh
            sudo -E sh /tmp/install.sh
          fi



)
D      [SSH] opening connection to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"]}>
D      sudo -E rm -rf /tmp/kitchen/modules /tmp/kitchen/manifests /tmp/kitchen/files /tmp/kitchen/hiera /tmp/kitchen/hiera.yaml /tmp/kitchen/spec /var/lib/hiera               /etc/hiera.yaml /etc/puppet/hiera.yaml               /etc/puppet/spec               /etc/puppet/fileserver.conf; mkdir -p /tmp/kitchen; sudo -E mkdir -p /etc/puppet
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}> (sudo -E rm -rf /tmp/kitchen/modules /tmp/kitchen/manifests /tmp/kitchen/files /tmp/kitchen/hiera /tmp/kitchen/hiera.yaml /tmp/kitchen/spec /var/lib/hiera               /etc/hiera.yaml /etc/puppet/hiera.yaml               /etc/puppet/spec               /etc/puppet/fileserver.conf; mkdir -p /tmp/kitchen; sudo -E mkdir -p /etc/puppet)
       Transferring files to <basenode-debian7awswawfra>
D      [SSH-TAR] Running ssh-tar command: tar -C /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/hiera.yaml -cvf - ./ | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -o LogLevel=VERBOSE -i /home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem -p 22 [email protected] 'tar  -C /tmp/kitchen/hiera.yaml -xvf -'
tar: /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/hiera.yaml: Cannot open: Not a directory
tar: Error is not recoverable: exiting now
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
       [SSH-TAR] Time taken to upload /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/hiera.yaml to [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}>:/tmp/kitchen/hiera.yaml: 0.17 sec
D      [SSH] [email protected]<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :port=>22, :compression=>"[email protected]", :compression_level=>9, :keepalive=>true, :keepalive_interval=>60, :timeout=>15, :keys_only=>true, :keys=>["/home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem"], :auth_methods=>["publickey"], :user=>"admin"}> (mkdir -p /tmp/kitchen/manifests)
D      [SSH-TAR] Running ssh-tar command: tar -C /tmp/basenode-debian7awswawfra-sandbox-20150911-5889-1v72lfw/manifests -cvf - ./ | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -o LogLevel=VERBOSE -i /home/kaszpir/.ssh/xstreamwaw-eu-central-1.pem -p 22 [email protected] 'tar  -C /tmp/kitchen/manifests -xvf -'
./
./jenkins-node.pp
...
...

Any way to control the ruby version for puppet apply?

I am not sure if what I am asking for can be achieved easily. The problem I have is that during the Puppet run and during the test run I require functionality from Ruby that is not available on those versions that come preinstalled on most platforms I would like to support.

Is there any way to specify a ruby version which would then get installed and applied to the puppet apply execution? Thanks!

hiradata doesn't have any effect

I've the following scenario :
in .kitchen.yaml :


driver:
name: docker

provisioner:
name: puppet_apply
puppet_version: 3.8.1
mainfests_path: manifests
modules_path: modules
hiera_config_path: hiera.yaml
hiera_data_path: hiradata

platforms:
name: centos-6.6

suites:
name: default
manifest: site.pp
provisioner:
custom_facts:
opscenter_eni_ip: "10.0.0.254"

The opscenter_eni_ip facter can be retrieved, easily, however this fact should be passed to a hiera variable in common.yaml hiradata file, and unfortunately the hieradata variable is empty ?!

any ideas what is going wrong ?

omnibus puppet script

it would be good to create an omnibus puppet install shell script like we have done for kitchen_ansible.

hiera package name

Hiera package in Debian Jessie is called just hiera and not hiera-puppet.

I got this error:

Reading state information... Done
E: Unable to locate package hiera-puppet

not able to install puppet

I am trying to install puppet 3.x on ubuntu 14.04. But no luck yet. Also, in puppet installation step this error is coming

       Installing Puppet Collections, will try to determine platform os
       bash: line 111: [: too many arguments

Here is my Kitchen.yml

---
driver:
  name: vagrant

provisioner:
    name: puppet_apply 
    manifests_path: manifests
    modules_path: modules
    hiera_data_path: hieradata
    require_chef_for_busser: true
    puppet_debug: true
    puppet_verbose: true
    require_puppet_repo: true
    puppet_apt_repo: "https://apt.puppetlabs.com/puppetlabs-release-trusty.deb"
    puppet_version: 3.8
    require_puppet_collections: true
    install_hiera: true


platforms:
    - name: ubuntu_trusty64
      driver_plugin: vagrant
      driver_config:
        box: ubuntu/trusty64

suites:
  - name: shift
    provisioner:
      manifest: site.pp

Run log:

  shift kitchen converge
-----> Starting Kitchen (v1.7.3)
-----> Converging <shift-ubuntu-trusty64>...
       Preparing files for transfer
       Preparing modules
       Resolving module dependencies with Librarian-Puppet 2.2.3...
       Preparing manifests
       Preparing files
       nothing to do for files
       Preparing hiera data
       Preparing spec files
       Finished Preparing files for transfer
       Installing Puppet Collections, will try to determine platform os
       bash: line 111: [: too many arguments
Reading package lists... Done
Building dependency tree
Reading state information... Done
       wget is already the newest version.
       The following packages were automatically installed and are no longer required:
         chef-zero erubis ohai ruby-diff-lcs ruby-erubis ruby-hashie ruby-highline
         ruby-ipaddress ruby-mime-types ruby-mixlib-authentication ruby-mixlib-cli
         ruby-mixlib-config ruby-mixlib-log ruby-mixlib-shellout ruby-net-ssh
         ruby-net-ssh-gateway ruby-net-ssh-multi ruby-rack ruby-rest-client
         ruby-sigar ruby-systemu ruby-yajl
       Use 'apt-get autoremove' to remove them.
       0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
       --2016-04-27 07:26:08--  http://apt.puppetlabs.com/puppetlabs-release-pc1-wheezy.deb
       Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d
       Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:80... connected.
       HTTP request sent, awaiting response... 200 OK
       Length: 2646 (2.6K) [application/x-debian-package]
       Saving to: ‘puppetlabs-release-pc1-wheezy.deb.1’

100%[======================================>] 2,646       --.-K/s   in 0s

       2016-04-27 07:26:09 (168 MB/s) - ‘puppetlabs-release-pc1-wheezy.deb.1’ saved [2646/2646]

(Reading database ... 78064 files and directories currently installed.)
       Preparing to unpack puppetlabs-release-pc1-wheezy.deb ...
       Unpacking puppetlabs-release-pc1 (0.9.2-1wheezy) over (0.9.2-1wheezy) ...
       Setting up puppetlabs-release-pc1 (0.9.2-1wheezy) ...
Hit http://security.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty InRelease
Ign http://apt.puppetlabs.com wheezy InRelease
Hit http://archive.ubuntu.com trusty-updates InRelease
Hit http://security.ubuntu.com trusty-security/main Sources
Hit http://apt.puppetlabs.com wheezy Release.gpg
Hit http://archive.ubuntu.com trusty-backports InRelease
Hit http://security.ubuntu.com trusty-security/universe Sources
Hit http://apt.puppetlabs.com wheezy Release
Hit http://archive.ubuntu.com trusty Release.gpg
Hit http://security.ubuntu.com trusty-security/main amd64 Packages
Hit http://apt.puppetlabs.com wheezy/PC1 Sources
Hit http://archive.ubuntu.com trusty-updates/main Sources
Hit http://security.ubuntu.com trusty-security/universe amd64 Packages
Hit http://apt.puppetlabs.com wheezy/PC1 amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/restricted Sources
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/universe Sources
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://archive.ubuntu.com trusty-updates/multiverse Sources
Hit http://archive.ubuntu.com trusty-updates/main amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty-updates/main Translation-en
Hit http://archive.ubuntu.com trusty-updates/multiverse Translation-en
Hit http://archive.ubuntu.com trusty-updates/restricted Translation-en
Hit http://archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://apt.puppetlabs.com wheezy/PC1 Translation-en_US
Hit http://archive.ubuntu.com trusty-backports/main Sources
Ign http://apt.puppetlabs.com wheezy/PC1 Translation-en
Hit http://archive.ubuntu.com trusty-backports/restricted Sources
Hit http://archive.ubuntu.com trusty-backports/universe Sources
Hit http://archive.ubuntu.com trusty-backports/multiverse Sources
Hit http://archive.ubuntu.com trusty-backports/main amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/universe amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty-backports/main Translation-en
Hit http://archive.ubuntu.com trusty-backports/multiverse Translation-en
Hit http://archive.ubuntu.com trusty-backports/restricted Translation-en
Hit http://archive.ubuntu.com trusty-backports/universe Translation-en
Hit http://archive.ubuntu.com trusty Release
Hit http://archive.ubuntu.com trusty/main Sources
Hit http://archive.ubuntu.com trusty/restricted Sources
Hit http://archive.ubuntu.com trusty/universe Sources
Hit http://archive.ubuntu.com trusty/multiverse Sources
Hit http://archive.ubuntu.com trusty/main amd64 Packages
Hit http://archive.ubuntu.com trusty/restricted amd64 Packages
Hit http://archive.ubuntu.com trusty/universe amd64 Packages
Hit http://archive.ubuntu.com trusty/multiverse amd64 Packages
Hit http://archive.ubuntu.com trusty/main Translation-en
Hit http://archive.ubuntu.com trusty/multiverse Translation-en
Hit http://archive.ubuntu.com trusty/restricted Translation-en
Hit http://archive.ubuntu.com trusty/universe Translation-en
Ign http://archive.ubuntu.com trusty/main Translation-en_US
Ign http://archive.ubuntu.com trusty/multiverse Translation-en_US
Ign http://archive.ubuntu.com trusty/restricted Translation-en_US
Ign http://archive.ubuntu.com trusty/universe Translation-en_US
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
       E: Version '3.8' for 'puppet-agent' was not found
       Transferring files to <shift-ubuntu-trusty64>

       Going to invoke puppet apply with:    sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp --modulepath=/tmp/kitchen/modules --fileserverconfig=/tmp/kitchen/fileserver.conf     -v -d
       sudo: /opt/puppetlabs/bin/puppet: command not found
>>>>>> Converge failed on instance <shift-ubuntu-trusty64>.
>>>>>> Please see .kitchen/logs/shift-ubuntu-trusty64.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [   sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp --modulepath=/tmp/kitchen/modules --fileserverconfig=/tmp/kitchen/fileserver.conf     -v -d  ]
>>>>>> ----------------------
zlib(finalizer): the stream was freed prematurely.

Any help here would be great. Still trying to get my hello world puppet working :-(

Gem Dependency busser-hieradata is missing?

When running a kitchen-puppet test after defining hiera_data_path: hieradata I am encountering an error in running serverspec tests: the kitchen verify step wants to install a gem called busser-hieradata, which is failing:

Fetching: busser-0.7.1.gem (100%)
       Successfully installed busser-0.7.1
       2 gems installed
       Installing Busser plugins: busser-hieradata busser-serverspec
       /opt/chef/embedded/lib/ruby/site_ruby/2.1.0/rubygems/resolver/installer_set.rb:71:in `add_always_install': Unable to resolve dependency: user requested 'busser-hieradata (>= 0)' (Gem::UnsatisfiableDependencyError)

... and upon verification (both doing a local gem install as well as a sanity check on rubygems.org) - there does not appear to be a busser-hieradata gem. Is this simply a mis-configuration?

I'm using testkitchen 1.9.0, kitchen-puppet version 1.41.1.

Thank you!

Request for enhancement: add custom puppet config settings

In one of my usecase I need to specify the option stringify_facts to the puppet apply command line.

There are 2 ways to do that for the moment:

  • provide a custom puppet.conf file
  • use puppet_apply_command

I personnaly find these 2 solutions too heavy for what I need to do (especially the override of puppet_apply_command because I need to rebuild the full command line, see https://github.com/neillturner/kitchen-puppet/blob/master/lib/kitchen/provisioner/puppet_apply.rb#L521-L539).

My proposal would be to provide an extra param that would allow the user to specify the extra args to the command line.

Could be something like puppet_extra_conf_settings, and in my case I would value it to --no-stringify_facts.

what do you think about it?

If that seems ok for you I can submit a PR.

Unsupported Platform - windows

Hi,

I am trying to use test-kitchen to test windows modules, but getting different errors. Could you please guide me how to fix this, I am new to using test-kitchen.
When I ran kitchen converge looks like its trying to install puppet, is there a way to skip that? Since our vagrant boxes are already shipped with puppet. Also would it possible to install puppet on windows using kitchen commands ?

This is my .kitchen.yml file..

driver:
name: vagrant

provisioner:
name: puppet_apply
manifests_path: manifests
modules_path: modules
puppet_debug: true
puppet_verbose: true

platforms:

  • name: windows-2012R2
    driver:
    username: _puppet
    password: vagrant
    guest: windows
    box: win2012r2-virtualbox
    transport:
    name: ssh

suites:

  • name: default
    provisioner:
    manifest: site.pp

I tried kitchen converge first fails with
STDERR: Vagrant is configured to generate a random keypair and insert it
onto the guest machine, but it appears Vagrant doesn't know how to do
this with your guest OS. Please disable key insertion by setting
config.ssh.insert_key = false in the Vagrantfile.

I tried to run it again..this time It asks me to enter password, after entering it fails with unsupported platform error. I am using test-kitchen 1.4.2 version, kitchen-puppet 1.0.34 version, kitchen-vagrant 0.19.0.

Below are the detailed errors,

First

https://gist.github.com/lucky27/8a819668fc6e835700b6

https://gist.github.com/lucky27/4188275ac66679466878

Question: Working with proxies

Sorry to keep asking questions.

I have been battling to get test-kitchen + kitchen-puppet + kitchen-docker working behind a proxy. I have hit this issue that was on the ansible forum that @neillturner commented on (neillturner/kitchen-ansible#7).

To get kitchen-docker working I need to add http_proxy to the driver_config. This allows me to create a container, but installing puppet on the container fails. If I remove http_proxy after create but before converge I get passed the initial puppet install but fails on installing Chef (to run the tests). It appears that the do_download task from test-kitchen is not honouring proxy settings defined in the config -https://github.com/neillturner/kitchen-puppet/blob/master/lib/kitchen/provisioner/puppet_apply.rb#L326 and https://github.com/test-kitchen/test-kitchen/blob/master/support/download_helpers.sh

Is this something anybody might have seen before?

My current thought is to disable the chef installer and have docker update ruby version from 1.8 during the provision phase. Having written my thoughts out, I think that might actually be the nicest solution, just curious if anybody else has seen this kind of thing.

Happy to close this if you don't have any thoughts/comments on the question.

Best Practices

Opening an issue for best practices for continued development of this gem.

Thoughts for discussion:

  • Commits should not be merged directly into master. This prevents any form of discussion from taking place
  • PR's should not be merged without proper rspec tests covering the change. (I'm just as guilty of this one)
  • Propose to nominate @ytsarev as a second Collaborator. They have a thorough knowledge of this gem and the code involved.
  • If @ytsarev accepts nomination of Collaborator, we should not merge any PR's unless there are at least two 👍's on the PR. More eyes will help us to hopefully never again push a broken version of this gem to RubyGems.

Thoughts, Concerns?

Unsupported Platform Error with Cumulus VX

I have a development environment configured with test-kitchen, vagrant, and puppet. One of the scenarios I'm using this environment for is deploying 5 instances of Cumulus VX (virtualized switch OS), and provisioning them with Puppet.

I am on version 0.0.24 since I set my environment up a while back, and when a co-worker tried to set up his environment he installed the latest (version 1.0.33) and got an error from the gem that said Cumulus VX is not a platform that Puppet can be installed on. The error was resolved by uninstalling that version and manually selecting version 0.0.24 to match the version that it's working on my machine using.

Any idea where the breaking change for Cumulus VX platform might be, and any chance that this behaviour could be restored for the Cumulus VX platform in the more recent versions?

Thanks,
Raymond

Problem with [pre|post]run etckeeper

I got this error:

Could not run command from prerun_command: Execution of '/etc/puppet/etckeeper-commit-pre' returned 1
Could not run command from prerun_command: Execution of '/etc/puppet/etckeeper-commit-post' returned 1

My box has these files, but something in kitchen provision remove that file. How can I fix it?

Ignore fixtures path

Ended up with this amazing stack trace:
screenshot 2016-02-25 23 47 25

We should probably ignore the spec/fixtures/ directory, as it recursively refers to itself...

enable the per suite manifest

test suites need input matching the test. consider two test suits testing different settings. for this to work the manifest must come from the test suite like with roles/data_bags in in chef. this data is part of the suite (test/integration/default/roles for instance)

  • make it so that we can leverage a test/integration/default/manifests folder

Request for enhancement: support structured facts

Puppet now has support for structured facts

The way the support for facts (through custom_facts or facter_file) is implemented in kitchen puppet, structured facts cannot be handled because it uses the environment variable path (FACTER_xxx).

My proposal would be to drop the environment vars and simply use facts files.

We would also need to deal with the stringify_facts config setting so that it work as expected (see #87 for instance).

What's your pov about that?

I can propose a MR if it's ok for you

manifest file will not converge

When I try to setup kitchen with kitchen-puppet to test my manifests it will install Puppet, but it will not converge the manifest files.

I have created https://github.com/dpnl87/kitchen-puppet-issue to easily simulate the error. I expect the notice command to show up on the output run but nothing happens.

If you need any additional information please let me know.

`puppetfile_path` does not correctly install Puppet Modules

Hi there,

As an example, I'm using the following Puppetfile:

forge 'https://forgeapi.puppetlabs.com'

mod 'puppetlabs/stdlib'
mod 'elasticsearch/logstash',
  :git => '[email protected]:elastic/puppet-logstash.git',
  :ref => '0.5.1'

to define a dependency to my module. My .kitchen.yml:

---
driver:
  name: vagrant

provisioner:
  name: puppet_apply
  manifests_path: test/integration
  puppetfile_path: spec/fixtures/Puppetfile
  manifest: default/init.pp
  modules_path: modules
  require_chef_for_busser: false

This setup is giving me the following error:

       Resolving module dependencies with Librarian-Puppet 2.2.1...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #converge action: [Could not checkout [email protected]:elastic/puppet-logstash.git: fatal: Not a git repository: 'spec/fixtures/.tmp/librarian/cache/source/git/a546444c477b9bef/.git'
]
>>>>>> ----------------------

I tried with https as well, with the same results.
Here's the backtrace:

ERROR -- Kitchen: ------Backtrace-------
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarian-puppet-2.2.1/lib/librarian/puppet/source/git.rb:37:in `rescue in cache!'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarian-puppet-2.2.1/lib/librarian/puppet/source/git.rb:34:in `cache!'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/source/local.rb:22:in `manifest_search_paths'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/source/local.rb:31:in `found_path'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarian-puppet-2.2.1/lib/librarian/puppet/source/local.rb:15:in `install!'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/manifest.rb:73:in `install!'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/action/install.rb:49:in `block in install_manifests'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/action/install.rb:48:in `each'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/action/install.rb:48:in `install_manifests'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/action/install.rb:39:in `perform_installation'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/librarianp-0.6.3/lib/librarian/action/install.rb:12:in `run'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet/librarian.rb:50:in `resolve'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet_apply.rb:968:in `block in resolve_with_librarian'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet_apply.rb:966:in `synchronize'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet_apply.rb:966:in `resolve_with_librarian'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet_apply.rb:880:in `prepare_modules'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/kitchen-puppet-1.0.32/lib/kitchen/provisioner/puppet_apply.rb:398:in `create_sandbox'
ERROR -- Kitchen: ~/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/test-kitchen-1.4.2/lib/kitchen/provisioner/base.rb:61:in `call'

If I explicitly install with librarian-puppet at spec/fixtures, it's working just fine.

So am I doing something wrong, or is it a bug?

cheers

Windows Support

Add support for running puppet on Windows hosts. Currently, this provisioner only works on unix host.

Tag new release?

I was interested in using the latest merge request that supports hiera data when using puppet collections. Is a new release imminent by any chance?

Support CLI options to enable Puppet 4+ syntax

One can pass '--parser future' to puppet apply to enable support for Puppet 4+ syntax, which is essential for the new looping constructs. However, because rebuilding the full puppet apply command is annoying, it would be nice if we could specify this argument separately.

On a related note, Puppet Labs decided to move a bunch of things around in Puppet 4, like packaging and executable locations - any indication on when kitchen-puppet will be upgraded to support the changes?

Feature: Self as Module

Hi,

First of all: Thank you @neillturner for running ahead with this very valuable plugin. We (http://telekomlabs.github.io) started to use it and definitely want to give it some love, or help push it into test-kitchen core.

To get parity I would love to see something like

puppet:
  self_as_module: true

which puts the repo itself as a module on the target node and just copies the specified manifest to run to the target manifest folder.

What do you think? Is there another option to accomplish this?

git: command not found

I'm trying to use the following puppet apply provisioner parameters,

  • puppet_git_init
  • puppet_git_pr

with docker driver

but in converge step I got the following error which is basically means that git isn't installed :

  sudo: git: command not found

Converge failed on instance .
Please see .kitchen/logs/default-centos-66.log for more details
------Exception-------
Class: Kitchen::ActionFailed

Message: SSH exited (1) for command: [sudo -E rm -rf /etc/puppet && sudo -E git clone https://github.com/EslamElHusseiny/puppet-java.git /etc/puppet && sudo -E git --git-dir=/etc/puppet/.git/ fetch -f origin pull/22/head:pr_22 && sudo -E git --git-dir=/etc/puppet/.git/ --work-tree=/etc/puppet/ checkout pr_22]

centos 7 support is broken using docker driver

right puppetlabs repo is not being created
I presume because of incorrect check in https://github.com/neillturner/kitchen-puppet/blob/master/lib/kitchen/provisioner/puppet_apply.rb#L309
while provisioning it says:

Installing puppet, will try to determine platform os
       which: no puppet in (/usr/local/bin:/usr/bin)
       grep: 7: No such file or directory

because that code is rendered to

rhelversion=$(cat /etc/redhat-release | grep release 7)

losing backslash

steps to reproduce:

git clone https://github.com/kostyrevaa/puppet-opendkim.git /tmp/test
Cloning into '/tmp/test'...
cd /tmp/test
kitchen setup default-centos-7

using puppet_git_init, puppet_git_pr causes errors in puppet apply step

I'm trying to use both variables :

  • puppet_git_init
  • puppet_git_pr
    so as to test certain pull requests before merging, the issue is that kitchen-puppet pulls the content of git repo under /etc/puppet directly not /tmp/kitchen/modules which kitchen-puppet uses for for puppet apply command, plus the puppet module dependencies won't be triggered.
    Do I miss anything in using puppet_git_init and puppet_git_pr ?!

Puppet installation failed with proxy

When the host running kitchen-puppet has proxy settings, the command 'kitchen converge' failed with the following stack trace:

>>>>>> Converge failed on instance <default-centos-7>.
>>>>>> Please see .kitchen/logs/default-centos-7.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [env http_proxy=http://my_proxy:3128 https_proxy=http://my_proxy:3128 ftp_proxy= no_proxy=localhost,127.0.0.1               if [ ! $(which puppet) ]; then
                          rhelversion=$(cat /etc/redhat-release | grep 'release 7')
          # For CentOS7/RHEL7 the rdo release contains puppetlabs repo, creating conflict. Create temp-repo
          sudo -E curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
          if [ -n "$rhelversion" ]; then
          echo '[puppettemp-products]
          name=Puppet Labs Products - $basearch
          baseurl=http://yum.puppetlabs.com/el/7/products/$basearch
...
>>>>>> ----------------------

I did a quick fix in the Pull request #121.

Add Spec tests

Gem should have some unit tests written and fully documented to ensure gem functionality between updates.

This should also come with a Contributing.MD file, that documents guidelines for contributing to the repo.

Add Hosts and Tests to integration testing

Hosts we should add to integration testing:

  • Ubuntu 12.04
  • Ubuntu 14.04
  • Ubuntu 15.04
  • Centos - 7
  • RHEL (multiple versions probably)
  • Fedora

Should add in more resources to our test manifest as well. File, Service, Package, etc

On mac: Could not load the 'puppet_apply'

Hi, i'm trying to use 'kitchen.ci' with puppet provisioner. Though it worked find if chef_solo is used. But with provisioner puppet_apply it throw following errors:

➜  practo-router-puppet kitchen create
-----> Starting Kitchen (v1.7.3)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ClientError
>>>>>> Message: Could not load the 'puppet_apply' provisioner from the load path. Please ensure that your provisioner is installed as a gem or included in your Gemfile if using Bundler.
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Any help here would be great. I am in dire need of an angel.

Here is my Gemfile

# A sample Gemfile
source "https://rubygems.org"

# gem "rails"
gem "test-kitchen"
gem "kitchen-puppet"
gem "kitchen-vagrant"
gem "puppet"
gem "librarian-puppet"

Here is the .kitchen.yml file.

---
driver:
  name: vagrant

provisioner:
    name: puppet_apply 
    puppet_version: 4.4.1
    manifests_path: manifests
    modules_path: modules
    hiera_data_path: hieradata
    require_chef_for_busser: true


platforms:
    - name: nocm_ubuntu-12.04
      driver_plugin: vagrant
      driver_config:
        box: nocm_ubuntu-12.04
        box_url: http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box

suites:
  - name: default
    provisioner:
      manifest: site.pp

Ability to exclude resources during converge

It would be nice to have an "ignores" file to prevent particular directories/files from being copied to the target container during converge stage. It would be something like the chefignore file in the Chef world.

A use case is, when you don't have gem's installed globally (ie. a CI environment) and use bundler to execute the kitchen commands. By default the gem's get installed into ./vendor/bundle so they end up adding a lot of time to the testing when the get copied. One option is to remember to install to a path outside the project space, but it would just be easier to be able to certain files not to be copied.

I scanned the open issues and didn't see anything matching. I might have a go at adding this but wanted to pose the question in case it is being looked at already or it is there and I am just blind :)

Error: Could not autoload provider

Hi, just playing around with kitchen-puppet and puppet v4.2.1 and receive the following error when testing against my manifests:

Error: Could not autoload puppet/provider/dynatrace_installer/tar: cannot load such file -- puppet/provider/dynatrace_installer

where provider/dynatrace_installer/tar is derived from provider/dynatrace_installer(.rb).

Here are some facts that show that all files are in place:

$ ls /tmp/kitchen/modules/dynatrace/lib/puppet/provider/dynatrace_installer/tar.rb 
/tmp/kitchen/modules/dynatrace/lib/puppet/provider/dynatrace_installer/tar.rb

$ ls /tmp/kitchen/modules/dynatrace/lib/puppet/provider/dynatrace_installer.rb 
/tmp/kitchen/modules/dynatrace/lib/puppet/provider/dynatrace_installer.rb

I have not seen this issue before. Any clues?

Resolution of Module Under Development from CWD

I'm fairly new to puppet and librarian and can't seem to align the kitchen/puppet/libraian planets.

I gather my inexperience is leading me down an incorrect path, but is there a way for kitchen/puppet/librarian to

  1. Resolve,install, and run the current working directly as a module in my kitchen/vagrant/vitualBox VM
  2. Install the module dependencies from PuppetFile into my kitchen/vagrant/vitualBox VM
  3. Have puppet invoke a main entry manifest from my working dir that is not residing in my project roots top level manifest directory . I want ./manifests directory prestine, having just init.pp class (any any other module class definitions) without having to include the puppet entry manifest in the same directory (i.e I don't want a site.pp in my modules manifest dir, or any class "declarations" for that matter...just the module class "definitions")

No matter what I try, I can't seem to get these requirements to jive. My bag of tricks is empty. Does installation of a module under development from the CWD even supported in kitchen/puppet or do I have to package up my module and install it via some other mechanism? Any help, much appreciated.

manifest setting not honored

with

suites:
  - name: default
    manifest: init.pp
Error: Could not run: Could not find file /tmp/kitchen/manifests/site.pp

Headsup: Doesn't work with Test Kitchen 1.7.0

I got caught out today because I was updating some gem depdencies and during the update I pulled in the new version of Test Kitchen.

There is an issue with the script block that checks that Puppet and its dependencies are installed. When I run the script block it complains about it runs fine, it appears to be the way we execute a command. If I roll back to 1.6 for test kitchen everything runs fine. Still looking at exactly what has changed to see if I can fix it.

Ran against Vagrant and Docker to rule out the platform provider.

Just wanted to let other know incase the get caught out and waste a morning arguing with the keyboard as to why something just stopped working :)

Test best practice

I don't know what best place to ask that. Sorry if I am place in wrong place.

What is the best practice to organize kitchen puppet tests?

I am creating one suite test per profile, but I don't know the best practice to config this in kitchen.yml file. How do you configure your tests? Do you use more than one suites? Do you configure one per module, profile or roles? How do you organize that in kitchen.yml file?

Sorry again if there is a better place to ask this :)

Feature Request: Be able to run the current repo as a module

I did not find an easy way to run the current repo as a module in itself.

       Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class os_hardening at /tmp/kitchen/manifests/site_test.pp:1 on node default-ubuntu-1204

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.