Skip to content

Instantly share code, notes, and snippets.

@filler
Created February 16, 2015 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filler/ca900f53ae55592039e2 to your computer and use it in GitHub Desktop.
Save filler/ca900f53ae55592039e2 to your computer and use it in GitHub Desktop.
-----> Installing Chef Omnibus (11.16.4)
downloading https://www.chef.io/chef/install.sh
to file /tmp/install.sh
trying wget...
Downloading Chef 11.16.4 for ubuntu...
downloading https://www.chef.io/chef/metadata?v=11.16.4&prerelease=false&nightlies=false&p=ubuntu&pv=14.04&m=x86_64
to file /tmp/install.sh.1583/metadata.txt
trying wget...
url https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.16.4-1_amd64.deb
a9965ce5811ddd75af1b587e40cca934
0b98b310afc2c0b066648e550e7b59a5e39faf60dc4fd9b4792035d0553c27c3
downloaded metadata file looks valid...
downloading https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.16.4-1_amd64.deb
to file /tmp/install.sh.1583/chef_11.16.4-1_amd64.deb
trying wget...
trying perl...
trying python...
Unable to retrieve a valid package!
Version: 11.16.4
Please file a Bug Report at https://github.com/opscode/opscode-omnitruck/issues/new
Alternatively, feel free to open a Support Ticket at https://www.getchef.com/support/tickets
More Chef support resources can be found at https://www.getchef.com/support
Please include as many details about the problem as possible i.e., how to reproduce
the problem (if possible), type of the Operating System and its version, etc.,
and any other relevant details that might help us with troubleshooting.
Metadata URL: https://www.chef.io/chef/metadata?v=11.16.4&prerelease=false&nightlies=false&p=ubuntu&pv=14.04&m=x86_64
Download URL: https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.16.4-1_amd64.deb
DEBUG OUTPUT FOLLOWS:
STDERR from perl:
Can't locate LWP/Simple.pm in @INC (you may need to install the LWP::Simple module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/urllib2.py", line 404, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
>>>>>> Converge failed on instance <proxy-ubuntu-1404>.
>>>>>> Please see .kitchen/logs/proxy-ubuntu-1404.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (1) for command: [sh -c '
# 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
}
# @param $1 the omnibus root directory
# @param $2 the requested version of omnibus package
# @return 0 if omnibus needs to be installed, non-zero otherwise
should_update_chef() {
if test ! -d "$1" ; then return 0
elif test "$2" = "true" ; then return 1
elif test "$2" = "latest" ; then return 0
fi
local version="`$1/bin/chef-solo -v | cut -d " " -f 2`"
if echo "$version" | grep "^$2" 2>&1 >/dev/null; then
return 1
else
return 0
fi
}
if should_update_chef "/opt/chef" "11.16.4" ; then
echo "-----> Installing Chef Omnibus (11.16.4)"
do_download https://www.chef.io/chef/install.sh /tmp/install.sh
sudo -E sh /tmp/install.sh -v 11.16.4
else
echo "-----> Chef Omnibus installation detected (11.16.4)"
fi
']
>>>>>> ----------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment