forked from logicalclocks/ndb-chef
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HOPSWORKS-1063] Cleanup ndb-chef (logicalclocks#30)
- Loading branch information
Showing
53 changed files
with
317 additions
and
2,037 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ Platform | |
|
||
|
||
Tested on: | ||
* Ubuntu 12.04-14.04 | ||
* Ubuntu 16.04 | ||
* centos 7.0+ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module NDB | ||
module Helpers | ||
# TODO(Fabio): this method was moved from a recipe. Check if the ID thing actually works. | ||
def find_service_id(service, base_id) | ||
found_id = -1 | ||
my_ip = my_private_ip() | ||
id = base_id | ||
|
||
if node.attribute?(:ndb) && node['ndb'].attribute?(service) && node['ndb'][service].attribute?(:ips_ids) && !node['ndb'][service]['ips_ids'].empty? | ||
for srv in node['ndb'][service]['ips_ids'] | ||
theNode = srv.split(":") | ||
if my_ip.eql? theNode[0] | ||
found_id = theNode[1] | ||
break | ||
end | ||
end | ||
else | ||
for api in node['ndb'][service]['private_ips'] | ||
if my_ip.eql? api | ||
Chef::Log.info "Found matching IP address in the list of #{service} nodes: #{api} . ID= #{id}" | ||
found_id = id | ||
end | ||
id += 1 | ||
end | ||
end | ||
|
||
if found_id == -1 | ||
Chef::Log.fatal "Could not find matching IP address in list of #{service}." | ||
end | ||
|
||
return found_id | ||
end | ||
end | ||
end | ||
|
||
Chef::Recipe.send(:include, NDB::Helpers) | ||
Chef::Resource.send(:include, NDB::Helpers) |
Oops, something went wrong.