Well for starters I'd try accessing the attribute as an attribute instead of a method#{location_attrib['path']}--On Wed, Jun 17, 2015 at 1:05 AM, Sachin Gupta < " target="_blank"> > wrote:Hi All,
I am writing OHS cookbooks for my project and created a role file as,
"locations": {
"Gateway": {
"path": "/p1",
"weblogic_host": "somefqdn1.com",
"weblogic_port": "8001",
"set_handler": "weblogic-handler"
},
"Analytics": {
"path": "/p2",
"weblogic_cluster": "somefqdn2.com:8101,somefqdn3.com:8101",
"set_handler": "weblogic-handler",
"wl_proxy_ssl_pass_through": "ON",
"wl_proxy_ssl": "ON"
}
}
with these attribute values, I would like to populate my mod_wl_ohs.conf something like this
#Gateway
<path /p1>
SetHandler weblogic-handler
weblogic_host somefqdn1.com
weblogic_port 8001
</Location>
#Analytics
<path /p2>
SetHandler weblogic-handler
weblogic_cluster somefqdn2.com:8001,somefqdn3.com:8001
wl_proxy_ssl_pass_through ON
wl_proxy_ssl ON
</Location>
# Compress ouput from server before being sent to client side network
# DeflateBufferSize 20000
</IfModule>
In my OHS install recipe, I have added the code to iterate over locations as
node[:oc_ohs][:locations].each do |location, location_attrib|
Chef::Log.info "the different locations are #{location}"
Chef::Log.info "the app path is is #{location_attrib.path}"
end
I am able to get two locations as Gateway and Analytics and there paths as /p1 and p2 respectively.
but when I tried to get attributes values for weblogic_host and weblogic_port, getting error as
[2015-06-17T07:53:01+00:00] ERROR: Undefined method or attribute `weblogic_host' on `node'
this may be because weblogic_host and weblogic_port are not defined in second location Analytics
so how to get different attribute values of location instances. and how to dynamically create mod_wl_ohs.conf from these attribute values.
Any idea would be helpful.
Thanks & Regards,
Sachin Gupta
Archive powered by MHonArc 2.6.16.