Create template from library method?


#1

Hey Chefs,

I have a method in a library (I know, I know, I need to convert it to an LWRP–one day) that creates a template. It looks like this:

When it gets run, I see "Giving [user] root access to MySQL server in the Chef log, but the template file never gets created.

When I run the same template block with a normal template resource in a recipe, it works.

Anyone know why it’s not creating the template?

Wes


#2

Since you are not using the template dsl and instead are creating a
template object I would imagine you would still need to tell it to run.

http://wiki.opscode.com/display/chef/Evaluate+and+Run+Resources+at+Compile+Time

On Wed, Aug 1, 2012 at 3:59 PM, Wes Morgan cap10morgan@gmail.com wrote:

Hey Chefs,

I have a method in a library (I know, I know, I need to convert it to an
LWRP–one day) that creates a template. It looks like this:

https://gist.github.com/3230347

When it gets run, I see "Giving [user] root access to MySQL server in the
Chef log, but the template file never gets created.

When I run the same template block with a normal template resource in a
recipe, it works.

Anyone know why it’s not creating the template?

Wes


-Bryan


#3

That makes an enormous amount of sense. Thanks!

Wes

On Aug 1, 2012, at 3:10 PM, Bryan Baugher bjbq4d@gmail.com wrote:

Since you are not using the template dsl and instead are creating a template object I would imagine you would still need to tell it to run.

http://wiki.opscode.com/display/chef/Evaluate+and+Run+Resources+at+Compile+Time

On Wed, Aug 1, 2012 at 3:59 PM, Wes Morgan cap10morgan@gmail.com wrote:
Hey Chefs,

I have a method in a library (I know, I know, I need to convert it to an LWRP–one day) that creates a template. It looks like this:

https://gist.github.com/3230347

When it gets run, I see "Giving [user] root access to MySQL server in the Chef log, but the template file never gets created.

When I run the same template block with a normal template resource in a recipe, it works.

Anyone know why it’s not creating the template?

Wes


-Bryan