Skip to content

Instantly share code, notes, and snippets.

@goutham27
Created November 19, 2015 15:39
Show Gist options
  • Save goutham27/27141a1affadcf85d93d to your computer and use it in GitHub Desktop.
Save goutham27/27141a1affadcf85d93d to your computer and use it in GitHub Desktop.
C:\GIT\kitchen\puppet-module-git>kitchen converge
DL is deprecated, please use Fiddle
-----> Starting Kitchen (v1.4.2)
-----> Converging <default-windows>...
Preparing files for transfer
Preparing modules
Resolving module dependencies with Librarian-Puppet 2.2.1...
Preparing manifests
Preparing files
nothing to do for files
Preparing hiera
Preparing hiera data
Finished Preparing files for transfer
Installing puppet, will try to determine platform os
_puppet@127.0.0.1's password:
sh: which: command not found
sh: line 31: [: too many arguments
sh: line 61: apt-get: command not found
sh: line 62: wget: command not found
sh: line 63: dpkg: command not found
sh: line 64: apt-get: command not found
sh: line 65: apt-get: command not found
sh: line 66: apt-get: command not found
sh: line 67: apt-get: command not found
-----> Installing Chef Omnibus to install busser to run tests
downloading https://www.getchef.com/chef/install.sh
to file /tmp/install.sh
hon not found on this instance.
sh: /tmp/install.sh: No such file or directory
>>>>>> Converge failed on instance <default-windows>.
>>>>>> Please see .kitchen/logs/default-windows.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (127) for command: [ if [ ! $(which pupp
et) ]; then
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [
-f /etc/oracle-release ]; then
rhelversion=$(cat /etc/redhat-release | grep 'rele
ase 7')
# For CentOS7/RHEL7 the rdo release contains puppetlabs repo, creating
conflict. Create temp-repo
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
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppettemp-deps]
name=Puppet Labs Dependencies - $basearch
baseurl=http://yum.puppetlabs.com/el/7/dependencies/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1' | sudo tee /etc/yum.repos.d/puppettemp.repo > /dev/null
sudo sed -i 's/^[ ]*//' /etc/yum.repos.d/puppettemp.repo
yum makecache
yum -y --enablerepo=puppettemp-products --enablerepo=puppettemp-deps
install puppet
# Clean up temporary puppet repo
sudo rm -rf /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
sudo rm -rf /etc/yum.repos.d/puppettemp.repo
else
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.
rpm
yum makecache
yum -y install puppet
fi
else
if [ -f /etc/system-release ] || [ grep -q 'Amazon Linux' /etc
/system-release ]; then
rhelversion=$(cat /etc/redhat-release | grep 'rel
ease 7')
# For CentOS7/RHEL7 the rdo release contains puppetlabs repo, creating
conflict. Create temp-repo
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
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppettemp-deps]
name=Puppet Labs Dependencies - $basearch
baseurl=http://yum.puppetlabs.com/el/7/dependencies/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1' | sudo tee /etc/yum.repos.d/puppettemp.repo > /dev/null
sudo sed -i 's/^[ ]*//' /etc/yum.repos.d/puppettemp.repo
yum makecache
yum -y --enablerepo=puppettemp-products --enablerepo=puppettemp-deps
install puppet
# Clean up temporary puppet repo
sudo rm -rf /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
sudo rm -rf /etc/yum.repos.d/puppettemp.repo
else
rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.
rpm
yum makecache
yum -y install puppet
fi
else
apt-get -y install wget
wget false
dpkg -i
apt-get update
apt-get -y install facter
apt-get -y install puppet-common
apt-get -y install puppet
fi
fi
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/b
in
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 t
ests :(
# 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
sh /tmp/install.sh
fi
]
>>>>>> ----------------------
zlib(finalizer): the stream was freed prematurely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment