Created
February 1, 2013 17:43
-
-
Save pcn/4692840 to your computer and use it in GitHub Desktop.
Something is failing in overriding node data. The answer: use node.override instead of node.set
This file contains hidden or 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
| { | |
| "override_attributes": { | |
| "nagios": { | |
| "virtual_hosts": { | |
| "recrec": { | |
| "elb_health": { | |
| "name": "", | |
| "pagerduty": { | |
| "path": "non-critical" | |
| } | |
| }, | |
| "stack_name": "Tim-RecRec", | |
| "elb_count": { | |
| "name": "", | |
| "pagerduty": { | |
| "path": "non-critical" | |
| }, | |
| "count": "1" | |
| }, | |
| "elb_http": { | |
| "address": "", | |
| "expect": "404", | |
| "pagerduty": { | |
| "path": "non-critical" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or 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
| p "Finalizing and setting everything in the node data" | |
| node['nagios']['virtual_hosts'].each do |virt_key, virt_val| | |
| virt_val.each do |stack_key, stack_val| | |
| if stack_key.start_with?('elb_') | |
| p stack_val | |
| stack_name = virt_val['stack_name'] | |
| stack_val.each do |k, v| | |
| if k == "name" | |
| p "It is a name, so trying #{elb_mapping[stack_name][0]}" | |
| p "#{virt_key} #{stack_key} #{k}" | |
| node.override['nagios']['virtual_hosts'][virt_key][stack_key][k] = elb_mapping[stack_name][0] | |
| p node['nagios']['virtual_hosts'][virt_key][stack_key][k] | |
| elsif k == "address" | |
| p "It is an address, so trying #{elb_dns_mapping["elb_name"]}" | |
| p "#{virt_key} #{stack_key} #{k}" | |
| elb_name = elb_mapping[stack_name] | |
| node.override['nagios']['virtual_hosts'][virt_key][stack_key][k] = elb_dns_mapping[elb_name] | |
| p node['nagios']['virtual_hosts'][virt_key][stack_key][k] | |
| # stack_val[k] = elb_dns_mapping[elb_name] | |
| end | |
| p "After: k: #{k} v: #{v}" | |
| end | |
| p stack_val | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment