Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Merge "Add sleep to search_for function, so that node can be searched"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Dec 20, 2013
2 parents 3ca576b + 471b5a3 commit 4ddbe49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file is used to list changes made in each version of cookbook-openstack-common.

## 8.0.1:
### Bug
* Add sleep to search_for function, so that node can be searched

## 8.0.0:
* Upgrading to Havana
* Upgrading gems
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,13 @@ License and Author
| **Author** | Craig Tracey (<craigtracey@gmail.com>) |
| **Author** | Sean Gallagher (<sean.gallagher@att.com>) |
| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) |
| **Author** | Chen Zhiwei (<zhiwchen@cn.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. |
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
| **Copyright** | Copyright (c) 2013, Craig Tracey |
| **Copyright** | Copyright (c) 2013, SUSE Linux GmbH |
| **Copyright** | Copyright (c) 2013, IBM, Corp. |

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
12 changes: 10 additions & 2 deletions libraries/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,16 @@ def search_for r, &block
role_query = "(chef_environment:#{node.chef_environment} AND roles:#{r})"
recipe_query = "(chef_environment:#{node.chef_environment} AND recipes:#{r})".sub("::","\\:\\:")
query = "#{role_query} OR #{recipe_query}"

resp = search(:node, query, &block)
count = 1
sum = 7
while count < sum do
resp = search(:node, query, &block)
if resp != nil
break
end
sleep 2**count
count += 1
end
resp ? resp : []
end

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license "Apache 2.0"
description "Common OpenStack attributes, libraries and recipes."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "8.0.0"
version "8.0.1"

recipe "openstack-common", "Installs/Configures common recipes"
recipe "openstack-common::set_endpoints_by_interface", "Set endpoints by interface"
Expand Down

0 comments on commit 4ddbe49

Please sign in to comment.