I am going to have to upgrade?

Hello,

I am running Version 0.4.2 and I ran into an issue when trying to put this
into one of the provisioning templates (<%= @host.subnet.gateway %>). I
also tried this <%= subnet.gateway %>. Can I work around it with out
upgrading?

– thanks,
David Garvey

First you'll have to tell us what error you hit :slight_smile:

Greg

··· On 23 May 2013 03:23, david.garvey@gmail.com wrote:

Hello,

I am running Version 0.4.2 and I ran into an issue when trying to put this
into one of the provisioning templates (<%= @host.subnet.gateway %>). I
also tried this <%= subnet.gateway %>. Can I work around it with out
upgrading?

Yeah Right Greg,

Here is the error. I don't see a place where subnet gateway is defined
either. subnet mask works: <%= @host.subnet.mask %>

template: undefined local variable or method `subnet' for
#<ActionView::Base:0x7f473560c100>

··· On Thu, May 23, 2013 at 3:59 AM, Greg Sutcliffe wrote:

On 23 May 2013 03:23, david.garvey@gmail.com david.garvey@gmail.comwrote:

Hello,

I am running Version 0.4.2 and I ran into an issue when trying to put
this into one of the provisioning templates (<%= @host.subnet.gateway %>).
I also tried this <%= subnet.gateway %>. Can I work around it with out
upgrading?

First you’ll have to tell us what error you hit :slight_smile:

Greg


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey

As far as i recall, I think @host.subnet.gateway should work in 0.4.
However, that error doesn't look right at all, what template are you adding
that to?

··· On 23 May 2013 17:17, david.garvey@gmail.com wrote:

Yeah Right Greg,

Here is the error. I don’t see a place where subnet gateway is defined
either. subnet mask works: <%= @host.subnet.mask %>

template: undefined local variable or method `subnet’ for #ActionView::Base:0x7f473560c100

Greg,

It's a provisioning template. I am trying to export some bash variables so
i can write the network info into the file system.

/usr/bin/chvt 3
export IPADDR=<%= @host.ip %>
export GATEWAY=<%= subnet.gateway %>
export MACADDR=<%=@host.mac %>
export NETMASK=<%= @host.subnet.mask %>
export HOSTNAME=<%= @host %>

configure static IP address for eth0

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROT=static
TYPE=ethernet

IPADDR=$IPADDR
NETMASK=$NETMASK
HWADDR=$MACADDR
EOF

ipcalc -b $IPADDR $NETMASK >> /etc/sysconfig/network-scripts/ifcfg-eth0
ipcalc -n $IPADDR $NETMASK >> /etc/sysconfig/network-scripts/ifcfg-eth0

cat << EOF > /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
#GATEWAY=$GATEWAY
HOSTNAME=$HOSTNAME
EOF

··· On Thu, May 23, 2013 at 9:37 AM, Greg Sutcliffe wrote:

On 23 May 2013 17:17, david.garvey@gmail.com david.garvey@gmail.comwrote:

Yeah Right Greg,

Here is the error. I don’t see a place where subnet gateway is defined
either. subnet mask works: <%= @host.subnet.mask %>

template: undefined local variable or method `subnet’ for #ActionView::Base:0x7f473560c100

As far as i recall, I think @host.subnet.gateway should work in 0.4.
However, that error doesn’t look right at all, what template are you adding
that to?


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey

> Greg,
>
> It's a provisioning template. I am trying to export some bash variables so
> i can write the network info into the file system.
>

Fair enough. Occaionally people try to attach the Default PXE Template to a
host, which it isn't really designed for and that can cause weird errors,
hence my question.

export GATEWAY=<%= subnet.gateway %>
>

I wouldn't expect that to work. In my test <%= @host.subnet.gateway %> was
fine, as was <%= @host.subnet %>. Does the latter work for you? You should
get something like "192.168.122.0/24"

Greg

··· On 23 May 2013 17:58, david.garvey@gmail.com wrote:

Thanks Greg,

This works: <%= @host.subnet %>

Template:
export IPADDR=<%= @host.ip %>
export GATEWAY=<%= @host.subnet %>
export MACADDR=<%=@host.mac %>
export NETMASK=<%= @host.subnet.mask %>
export HOSTNAME=<%= @host %>

Results:
export IPADDR=10.2.10.20
export GATEWAY=10.2.10.0/22
export MACADDR=46:25:a5:51:b5:db
export NETMASK=255.255.245.0
export HOSTNAME=test09.sjc.collab.net

··· On Thu, May 23, 2013 at 10:32 AM, Greg Sutcliffe wrote:

On 23 May 2013 17:58, david.garvey@gmail.com david.garvey@gmail.comwrote:

Greg,

It’s a provisioning template. I am trying to export some
bash variables so i can write the network info into the file system.

Fair enough. Occaionally people try to attach the Default PXE Template to
a host, which it isn’t really designed for and that can cause weird errors,
hence my question.

export GATEWAY=<%= subnet.gateway %>

I wouldn’t expect that to work. In my test <%= @host.subnet.gateway %> was
fine, as was <%= @host.subnet %>. Does the latter work for you? You should
get something like “192.168.122.0/24”

Greg


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey

Greg,

Where in the UI do I define <%= @host.subnet.gateway %>?

··· On Thu, May 23, 2013 at 11:10 AM, david.garvey@gmail.com < david.garvey@gmail.com> wrote:

Thanks Greg,

This works: <%= @host.subnet %>

Template:
export IPADDR=<%= @host.ip %>
export GATEWAY=<%= @host.subnet %>
export MACADDR=<%=@host.mac %>
export NETMASK=<%= @host.subnet.mask %>
export HOSTNAME=<%= @host %>

Results:
export IPADDR=10.2.10.20
export GATEWAY=10.2.10.0/22
export MACADDR=46:25:a5:51:b5:db
export NETMASK=255.255.245.0
export HOSTNAME=test09.sjc.collab.net

On Thu, May 23, 2013 at 10:32 AM, Greg Sutcliffe <greg.sutcliffe@gmail.com > > wrote:

On 23 May 2013 17:58, david.garvey@gmail.com david.garvey@gmail.comwrote:

Greg,

It’s a provisioning template. I am trying to export some
bash variables so i can write the network info into the file system.

Fair enough. Occaionally people try to attach the Default PXE Template to
a host, which it isn’t really designed for and that can cause weird errors,
hence my question.

export GATEWAY=<%= subnet.gateway %>

I wouldn’t expect that to work. In my test <%= @host.subnet.gateway %>
was fine, as was <%= @host.subnet %>. Does the latter work for you? You
should get something like “192.168.122.0/24”

Greg


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey


David Garvey

So to recap, you're saying <%= @host.subnet %> works fine but <%=
@host.subnet.gateway %> does not? If so, does your Subnet (More -> Subnets
-> Edit the appropriate subnet) have a gateway set. If so, what's the exact
error that @host.subnet.gateway gives you?

Greg

··· On 23 May 2013 19:18, david.garvey@gmail.com wrote:

Greg,

Where in the UI do I define <%= @host.subnet.gateway %>?

Greg,

I don't see a place to put the subnet gateway.

I just have the following fields. Name,Domain,Network,Netmask,Dhcp,Tftp

··· On Thu, May 23, 2013 at 11:27 AM, Greg Sutcliffe wrote:

On 23 May 2013 19:18, david.garvey@gmail.com david.garvey@gmail.comwrote:

Greg,

Where in the UI do I define <%= @host.subnet.gateway %>?

So to recap, you’re saying <%= @host.subnet %> works fine but <%=
@host.subnet.gateway %> does not? If so, does your Subnet (More → Subnets
→ Edit the appropriate subnet) have a gateway set. If so, what’s the exact
error that @host.subnet.gateway gives you?

Greg


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey

Greg,

It returns the not defined error:

export GATEWAY=<%=@host.subnet.gateway %>

template: undefined method `gateway' for
#<ActiveRecord::Associations::BelongsToAssociation:

··· On Thu, May 23, 2013 at 11:43 AM, david.garvey@gmail.com < david.garvey@gmail.com> wrote:

Greg,

I don’t see a place to put the subnet gateway.

I just have the following fields. Name,Domain,Network,Netmask,Dhcp,Tftp

On Thu, May 23, 2013 at 11:27 AM, Greg Sutcliffe <greg.sutcliffe@gmail.com > > wrote:

On 23 May 2013 19:18, david.garvey@gmail.com david.garvey@gmail.comwrote:

Greg,

Where in the UI do I define <%= @host.subnet.gateway %>?

So to recap, you’re saying <%= @host.subnet %> works fine but <%=
@host.subnet.gateway %> does not? If so, does your Subnet (More → Subnets
→ Edit the appropriate subnet) have a gateway set. If so, what’s the exact
error that @host.subnet.gateway gives you?

Greg


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey


David Garvey

Cool Thanks Guys,

That what I figured. I am reading new docs for an outdated build.

··· On Thu, May 23, 2013 at 1:23 PM, david.garvey@gmail.com < david.garvey@gmail.com> wrote:

Greg,

It returns the not defined error:

export GATEWAY=<%=@host.subnet.gateway %>

template: undefined method `gateway’ for #<ActiveRecord::Associations::BelongsToAssociation:

On Thu, May 23, 2013 at 11:43 AM, david.garvey@gmail.com < > david.garvey@gmail.com> wrote:

Greg,

I don’t see a place to put the subnet gateway.

I just have the following fields. Name,Domain,Network,Netmask,Dhcp,Tftp

On Thu, May 23, 2013 at 11:27 AM, Greg Sutcliffe < >> greg.sutcliffe@gmail.com> wrote:

On 23 May 2013 19:18, david.garvey@gmail.com david.garvey@gmail.comwrote:

Greg,

Where in the UI do I define <%= @host.subnet.gateway %>?

So to recap, you’re saying <%= @host.subnet %> works fine but <%=
@host.subnet.gateway %> does not? If so, does your Subnet (More → Subnets
→ Edit the appropriate subnet) have a gateway set. If so, what’s the exact
error that @host.subnet.gateway gives you?

Greg


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey


David Garvey


David Garvey

Greg,

I don't see a place to put the subnet gateway.

gateway and vlan id etc was added in a later release. 1.0 I believe.

··· On Thu, May 23, 2013 at 8:43 PM, david.garvey@gmail.com < david.garvey@gmail.com> wrote:

Thanks for correcting me Mikael, I though that was in 0.4 - clearly not :slight_smile:

David, 0.4 is nearly 2 years old, so you want all that new shinyness, yes?
:wink:

··· On 23 May 2013 21:29, david.garvey@gmail.com wrote:

Cool Thanks Guys,

That what I figured. I am reading new docs for an outdated build.

Yes,

David likes shinyness… Foreman is beautiful even in it's infancy.:wink:

Thanks again,

··· On Fri, May 24, 2013 at 3:00 AM, Greg Sutcliffe wrote:

On 23 May 2013 21:29, david.garvey@gmail.com david.garvey@gmail.comwrote:

Cool Thanks Guys,

That what I figured. I am reading new docs for an outdated build.

Thanks for correcting me Mikael, I though that was in 0.4 - clearly not :slight_smile:

David, 0.4 is nearly 2 years old, so you want all that new shinyness, yes?
:wink:


You received this message because you are subscribed to the Google Groups
“Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


David Garvey