Hello,
I’m trying to set up an ifcfg file using a template.
HWADDR=<%= node[:network][:interfaces][:eth1][:addresses].keys %>
The MAC address populates the file but the entry is surrounded by brackets like
below.
HWADDR=[“00:00:00:00:00:00”]
How can I get to - HWADDR=00:00:00:00:00:00
or is there a more efficent way to build the file?
Thanks for the help.
Mike
2
You could try passing the keys to .first - that will select the first
element in the array and return a string.
Like so:
HWADDR=<%= node[:network][:interfaces][:eth1][:addresses].keys.first %>
But I don't think this is exactly right, since there may be multiple
entries in the array.
Hope this helps,
-M
On Tue, Oct 1, 2013 at 9:00 PM, staticprop@gmail.com wrote:
Hello,
I'm trying to set up an ifcfg file using a template.
HWADDR=<%= node[:network][:interfaces][:eth1][:addresses].keys %>
The MAC address populates the file but the entry is surrounded by brackets
like
below.
HWADDR=["00:00:00:00:00:00"]
How can I get to - HWADDR=00:00:00:00:00:00
or is there a more efficent way to build the file?
Thanks for the help.
Works perfect for my configuration.
Thanks for the help.
On Oct 1, 2013, at 11:32 PM, Mike miketheman@gmail.com wrote:
You could try passing the keys to .first - that will select the first element in the array and return a string.
Like so:
HWADDR=<%= node[:network][:interfaces][:eth1][:addresses].keys.first %>
But I don't think this is exactly right, since there may be multiple entries in the array.
Hope this helps,
-M
On Tue, Oct 1, 2013 at 9:00 PM, staticprop@gmail.com wrote:
Hello,
I'm trying to set up an ifcfg file using a template.
HWADDR=<%= node[:network][:interfaces][:eth1][:addresses].keys %>
The MAC address populates the file but the entry is surrounded by brackets like
below.
HWADDR=["00:00:00:00:00:00"]
How can I get to - HWADDR=00:00:00:00:00:00
or is there a more efficent way to build the file?
Thanks for the help.