Allow compatibility with Berkshelf 2.x and 3.x

openstack cookbooks currently use Berkshelf 2.x and we are
moving to 3.x.  Berkshelf deprecated the "berks install --path" cli
in favor of "berks vendor <path>".   While we transition all the
cookbooks, need to support both versions of Berkshelf.

Change-Id: I82a203fdb9b0c2ec47daefecb361d22aca306afb
Addresses: blueprint update-berkshelf
This commit is contained in:
Mark Vanderwiel 2014-08-05 16:30:53 -05:00
parent 142410fc33
commit 36ce4b9fd1

View File

@ -130,7 +130,12 @@
builders:
- shell: |
mkdir -p .cookbooks
ruby1.9.1 /usr/bin/bundle exec berks install --path=.cookbooks
grep -E .*berkshelf.*3\.\d*\.\d*.* Gemfile
if [ $? -eq 0 ]; then
ruby1.9.1 /usr/bin/bundle exec berks vendor .cookbooks
else
ruby1.9.1 /usr/bin/bundle exec berks install --path=.cookbooks
fi
COOKBOOK=$(awk '/^name/ {print $NF}' metadata.rb |tr -d \"\')
if [ -z $COOKBOOK ]; then
echo "Cookbook name not defined in metadata.rb"