HELP: about how to use template


#1

Hi,

I am trying to creat a simple cookbook to produce network config files but
get a error as below:
http://pastebin.com/rJcpLmVz

It looks like chef-client try to use Chef::Mixin::Template instead of
Chef::Provider::File::Template, I am wondering how to assign the template
coming from Chef::Provider::File::Template instead of Chef::Mixin::Template
in my cookbook?

Much appreciated for any help.

Thanks,
Sam


#2

Hi Sam,
error log says that you aren’t correctly using mac variable.
Please, try with
HWADDR=<%= @mac %>
in your template and so on for every other variable.
Cheers,
Marco
Il 09/feb/2014 09:18 “Sam Su” sam.debian@gmail.com ha scritto:

Hi,

I am trying to creat a simple cookbook to produce network config files but
get a error as below:
http://pastebin.com/rJcpLmVz

It looks like chef-client try to use Chef::Mixin::Template instead of
Chef::Provider::File::Template, I am wondering how to assign the template
coming from Chef::Provider::File::Template instead of Chef::Mixin::Template
in my cookbook?

Much appreciated for any help.

Thanks,
Sam


#3

Hi Marco,

Thank you so much to point it out.

It works like a charm now. Could you or someone else explain a little bit
what is the difference between “HWADDR=<%= @mac %>” and "HWADDR=<%= mac %>"
in the template file?

Thanks,
Sam

On Sun, Feb 9, 2014 at 12:25 AM, Marco Betti m.betti@gmail.com wrote:

Hi Sam,
error log says that you aren’t correctly using mac variable.
Please, try with
HWADDR=<%= @mac %>
in your template and so on for every other variable.
Cheers,
Marco
Il 09/feb/2014 09:18 “Sam Su” sam.debian@gmail.com ha scritto:

Hi,

I am trying to creat a simple cookbook to produce network config files
but get a error as below:
http://pastebin.com/rJcpLmVz

It looks like chef-client try to use Chef::Mixin::Template instead of
Chef::Provider::File::Template, I am wondering how to assign the template
coming from Chef::Provider::File::Template instead of Chef::Mixin::Template
in my cookbook?

Much appreciated for any help.

Thanks,
Sam


#4

Hi Sam,
it is simply the way Erubis works.
http://docs.opscode.com/essentials_cookbook_templates.html
Cheers,
Marco
Il 09/feb/2014 17:58 “Sam Su” sam.debian@gmail.com ha scritto:

Hi Marco,

Thank you so much to point it out.

It works like a charm now. Could you or someone else explain a little bit
what is the difference between “HWADDR=<%= @mac %>” and “HWADDR=<%= mac
%>” in the template file?

Thanks,
Sam

On Sun, Feb 9, 2014 at 12:25 AM, Marco Betti m.betti@gmail.com wrote:

Hi Sam,
error log says that you aren’t correctly using mac variable.
Please, try with
HWADDR=<%= @mac %>
in your template and so on for every other variable.
Cheers,
Marco
Il 09/feb/2014 09:18 “Sam Su” sam.debian@gmail.com ha scritto:

Hi,

I am trying to creat a simple cookbook to produce network config files
but get a error as below:
http://pastebin.com/rJcpLmVz

It looks like chef-client try to use Chef::Mixin::Template instead of
Chef::Provider::File::Template, I am wondering how to assign the template
coming from Chef::Provider::File::Template instead of Chef::Mixin::Template
in my cookbook?

Much appreciated for any help.

Thanks,
Sam


#5

Thank you so much.
I cannot wait to read it.

Sam Su

Sent from my iPhone

On Feb 9, 2014, at 9:05 AM, Marco Betti m.betti@gmail.com wrote:

Hi Sam,
it is simply the way Erubis works.
http://docs.opscode.com/essentials_cookbook_templates.html
Cheers,
Marco

Il 09/feb/2014 17:58 “Sam Su” sam.debian@gmail.com ha scritto:

Hi Marco,

Thank you so much to point it out.

It works like a charm now. Could you or someone else explain a little bit what is the difference between “HWADDR=<%= @mac %>” and “HWADDR=<%= mac %>” in the template file?

Thanks,
Sam

On Sun, Feb 9, 2014 at 12:25 AM, Marco Betti m.betti@gmail.com wrote:
Hi Sam,
error log says that you aren’t correctly using mac variable.
Please, try with
HWADDR=<%= @mac %>
in your template and so on for every other variable.
Cheers,
Marco
Il 09/feb/2014 09:18 “Sam Su” sam.debian@gmail.com ha scritto:

Hi,

I am trying to creat a simple cookbook to produce network config files but get a error as below:
http://pastebin.com/rJcpLmVz

It looks like chef-client try to use Chef::Mixin::Template instead of Chef::Provider::File::Template, I am wondering how to assign the template coming from Chef::Provider::File::Template instead of Chef::Mixin::Template in my cookbook?

Much appreciated for any help.

Thanks,
Sam