diff --git a/cookbooks/mini-mon/metadata.rb b/cookbooks/mini-mon/metadata.rb index bd375da..53cbfa9 100644 --- a/cookbooks/mini-mon/metadata.rb +++ b/cookbooks/mini-mon/metadata.rb @@ -4,5 +4,5 @@ maintainer_email "hpcs-mon@hp.com" license "All rights reserved" description "Base setup for all vagrant boxes" long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.0.5" +version "0.0.6" depends "apt" diff --git a/cookbooks/mini-mon/recipes/keystone.rb b/cookbooks/mini-mon/recipes/keystone.rb index 34d9f9c..cacf3ae 100644 --- a/cookbooks/mini-mon/recipes/keystone.rb +++ b/cookbooks/mini-mon/recipes/keystone.rb @@ -14,10 +14,18 @@ end python 'make default keystone user' do action :run code <<-EOH +import keystoneclient from keystoneclient.v2_0 import client import sys -key = client.Client(token='ADMIN', endpoint='http://127.0.0.1:35357/v2.0/') -for user in key.users.list(): +try: + key = client.Client(token='ADMIN', endpoint='http://127.0.0.1:35357/v2.0/') + user_list = key.users.list() +except keystoneclient.exceptions: + time.sleep(2) # Sometimes chef is too fast and the service is not yet up + key = client.Client(token='ADMIN', endpoint='http://127.0.0.1:35357/v2.0/') + user_list = key.users.list() + +for user in user_list: if user.name == 'mini-mon': sys.exit(0)