I guess I can just not use templates and output a file with ruby that contains the values I want and that way I don’t have to worry about chef funkiness.
My environment file has a config section with name, value pairs in it. I am trying to output a template of those name, value pairs by putting the below code into my erb file in chef:
<% @config.each do |setting| -%>
<%= setting[0] %>=<%= setting[1] %>
<%end-%>
This works great the first time as it creates a property file with my name value pairs.
The problem is when the config section changes. I get a Permission denied error, but if I rerun the recipe then everything works and the new value is in the property file.
How can I create dynamic property files from the environment json file?
Thanks,
Will
Could you show the code for the recipe or at least the template resource
which is creating the file? Can you also give the stacktrace to the
permission denied error?
The permission denied error makes me think something is wrong with the chef
installation or you are using chef incorrectly.
You should be able to do something like,
template "/path/to/my.properties" do
variables(
:config => node[:myEnvironmentConfig]
)
end
On Mon, May 7, 2012 at 3:50 PM, Soula, William wsoula@mobicorp.com wrote:
I guess I can just not use templates and output a file with ruby that
contains the values I want and that way I don't have to worry about chef
funkiness.
My environment file has a config section with name, value pairs in it. I
am trying to output a template of those name, value pairs by putting the
below code into my erb file in chef:
<% @config.each do |setting| -%>
<%= setting[0] %>=<%= setting[1] %>
<%end-%>
This works great the first time as it creates a property file with my name
value pairs.
The problem is when the config section changes. I get a Permission denied
error, but if I rerun the recipe then everything works and the new value is
in the property file.
How can I create dynamic property files from the environment json file?
Thanks,
Will
--
-Bryan