Using @host.provision_interface gives nothing on 1.9

I try to write a template and locate my provision interface but foreman
can't figure it out :frowning:
I am following
TemplateWriting - Foreman and
writing <%= @host.provision_interface%>, I get http://pastie.org/10126609 :frowning:

Shouldn't it give me the ethX identifier? I am using
foreman-1.9.0-0.develop.201504270854git4e21396.el7.noarch

To be clear, @host.primary_interface gives me the hostname.

Solved on IRC, sending the outcome - it "gave nothing" because

&lt;%= @host.provision_interface %&gt; 

returns the interface object on which ERB calls to_s that equals to "DNS name
of that interface". Michael's DNS name of that interface was empty, that's why
it seemed as it does not return anything.

To get interface identifier the right snippet is

&lt;%= @host.provision_interface.identifier %&gt;

Similarly, one could get to other interface attributes, like IP, MAC, ā€¦

Ā·Ā·Ā· On Monday 04 of May 2015 00:18:56 Lev Michael wrote: > I try to write a template and locate my provision interface but foreman > can't figure it out :( > I am following > http://projects.theforeman.org/projects/foreman/wiki/templatewriting and > writing <%= @host.provision_interface%>, I get http://pastie.org/10126609 :( > > Shouldn't it give me the ethX identifier? I am using > foreman-1.9.0-0.develop.201504270854git4e21396.el7.noarch > > To be clear, @host.primary_interface gives me the hostname.

ā€“
Marek

Thanks a lot!
Is there a chance to elaborate on the wiki?

Ā·Ā·Ā· Sent from Type Mail

On May 4, 2015, 15:13, at 15:13, Marek Hulan mhulan@redhat.com wrote:

On Monday 04 of May 2015 00:18:56 Lev Michael wrote:

I try to write a template and locate my provision interface but
foreman
canā€™t figure it out :frowning:
I am following
TemplateWriting - Foreman
and
writing <%= @host.provision_interface%>, I get
http://pastie.org/10126609 :frowning:

Shouldnā€™t it give me the ethX identifier? I am using
foreman-1.9.0-0.develop.201504270854git4e21396.el7.noarch

To be clear, @host.primary_interface gives me the hostname.

Solved on IRC, sending the outcome - it ā€œgave nothingā€ because

<%= @host.provision_interface %>

returns the interface object on which ERB calls to_s that equals to
"DNS name
of that interface". Michaelā€™s DNS name of that interface was empty,
thatā€™s why
it seemed as it does not return anything.

To get interface identifier the right snippet is

<%= @host.provision_interface.identifier %>

Similarly, one could get to other interface attributes, like IP, MAC,
ā€¦

ā€“
Marek

ā€“
You received this message because you are subscribed to a topic in the
Google Groups ā€œForeman usersā€ group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/vvXvbzdP640/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Hello,

Please review my change that covers that

http://projects.theforeman.org/projects/foreman/wiki/TemplateWriting/diff?utf8=āœ“&version=74&version_from=73&commit=View+differences

Hope this helps

Ā·Ā·Ā· -- Marek

On Monday 04 of May 2015 23:17:24 Lev Michael wrote:

Thanks a lot!
Is there a chance to elaborate on the wiki?

Sent from Type Mail

On May 4, 2015, 15:13, at 15:13, Marek Hulan mhulan@redhat.com wrote:

On Monday 04 of May 2015 00:18:56 Lev Michael wrote:

I try to write a template and locate my provision interface but

foreman

canā€™t figure it out :frowning:
I am following
TemplateWriting - Foreman

and

writing <%= @host.provision_interface%>, I get

http://pastie.org/10126609 :frowning:

Shouldnā€™t it give me the ethX identifier? I am using
foreman-1.9.0-0.develop.201504270854git4e21396.el7.noarch

To be clear, @host.primary_interface gives me the hostname.

Solved on IRC, sending the outcome - it ā€œgave nothingā€ because

<%= @host.provision_interface %>

returns the interface object on which ERB calls to_s that equals to
"DNS name
of that interface". Michaelā€™s DNS name of that interface was empty,
thatā€™s why
it seemed as it does not return anything.

To get interface identifier the right snippet is

<%= @host.provision_interface.identifier %>

Similarly, one could get to other interface attributes, like IP, MAC,
ā€¦

ā€“
Marek

Thanks Marek!

Ā·Ā·Ā· Sent from Type Mail

On May 5, 2015, 10:01, at 10:01, Marek Hulan mhulan@redhat.com wrote:

Hello,

Please review my change that covers that

Version 74 - History - TemplateWriting - Foreman

Hope this helps

ā€“
Marek

On Monday 04 of May 2015 23:17:24 Lev Michael wrote:

Thanks a lot!
Is there a chance to elaborate on the wiki?

Sent from Type Mail

On May 4, 2015, 15:13, at 15:13, Marek Hulan mhulan@redhat.com >wrote:

On Monday 04 of May 2015 00:18:56 Lev Michael wrote:

I try to write a template and locate my provision interface but

foreman

canā€™t figure it out :frowning:
I am following

TemplateWriting - Foreman

and

writing <%= @host.provision_interface%>, I get

http://pastie.org/10126609 :frowning:

Shouldnā€™t it give me the ethX identifier? I am using
foreman-1.9.0-0.develop.201504270854git4e21396.el7.noarch

To be clear, @host.primary_interface gives me the hostname.

Solved on IRC, sending the outcome - it ā€œgave nothingā€ because

<%= @host.provision_interface %>

returns the interface object on which ERB calls to_s that equals to
"DNS name
of that interface". Michaelā€™s DNS name of that interface was empty,
thatā€™s why
it seemed as it does not return anything.

To get interface identifier the right snippet is

<%= @host.provision_interface.identifier %>

Similarly, one could get to other interface attributes, like IP,
MAC,

ā€¦

ā€“
Marek

ā€“
You received this message because you are subscribed to a topic in the
Google Groups ā€œForeman usersā€ group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/foreman-users/vvXvbzdP640/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.