Project

General

Profile

Actions

Bug #14958

closed

undefined method `mask' for nil:NilClass error

Added by Mostafa Yasin over 8 years ago. Updated over 7 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Greetings,

I have created a template to configure teaming during the provisioning process as follows:-
<%= snippet 'Kickstart_CentOS' %>

%post

<% subnet = @host.subnet ->
<
myinterface = @host.interfaces.managed.first %>

cat << EOF > /etc/hostname
<%= myinterface.name %>
EOF

cat << EOF >> /etc/hosts
<%= myinterface.ip > <= myinterface.name > <= myinterface.shortname %>
EOF

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE="team0"
DEVICETYPE="Team"
ONBOOT="yes"
BOOTPROTO="none"
NETMASK=<%= myinterface.subnet.mask >
IPADDR=<
= myinterface.ip >
GATEWAY=<
= myinterface.subnet.gateway >
SEARCH=<
= @host.domain >
DNS1=<
= subnet.dns_primary >
<
if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? >
DNS2=<
= subnet.dns_secondary >
<
end ->
TEAM_CONFIG='{"runner": {"name": "activebackup"}}'
EOF
real=`ip -o link | grep -i <
= myinterface.mac -> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg
$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team0"
EOF
< myinterface = @host.interfaces.second >
real=`ip o link | grep -i <
= myinterface.mac -> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team0"
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-team1
DEVICE="team1"
DEVICETYPE="Team"
ONBOOT="yes"
BOOTPROTO="none"
NETMASK=<
= myinterface.subnet.mask >
IPADDR=<
= myinterface.ip >
GATEWAY=<
= myinterface.subnet.gateway >
SEARCH=<
= @host.domain >
DNS1=<
= subnet.dns_primary >
<
if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? >
DNS2=<
= subnet.dns_secondary >
<
end ->
TEAM_CONFIG='{"runner": {"name": "activebackup"}}'
EOF
real=`ip -o link | grep -i <
= myinterface.mac -> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg
$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team1"
EOF
< myinterface = @host.interfaces.second >
real=`ip o link | grep -i <
= myinterface.mac -> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team1"
EOF
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-team2
DEVICE="team2"
DEVICETYPE="Team"
ONBOOT="yes"
BOOTPROTO="none"
NETMASK=<
= myinterface.subnet.mask >
IPADDR=<
= myinterface.ip >
GATEWAY=<
= myinterface.subnet.gateway >
SEARCH=<
= @host.domain >
DNS1=<
= subnet.dns_primary >
<
if !subnet.dns_secondary.nil? && !subnet.dns_secondary.empty? >
DNS2=<
= subnet.dns_secondary >
<
end ->
TEAM_CONFIG='{"runner": {"name": "activebackup"}}'
EOF
real=`ip -o link | grep -i <
= myinterface.mac -> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg
$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team2"
EOF
< myinterface = @host.interfaces.second >
real=`ip o link | grep -i <
= myinterface.mac -%> | awk '{print $2;}' | sed s/://`
cat << EOF > /etc/sysconfig/network-scripts/ifcfg$real
DEVICE="$real"
DEVICETYPE="TeamPort"
ONBOOT=yes
BOOTPROTO="none"
TEAM_MASTER="team2"
EOF
%end

And then I have added the MACs in "Interface" tab during creating "new host".

Please i get this error when trying to view the kickstart template using web interface "There was an error rendering the Kickstart BM Netcard for 6 NICs template: undefined method `mask' for nil:NilClass"

Regards,
Mostafa


Related issues 1 (1 open0 closed)

Related to Foreman - Feature #17033: Add Network Teaming configuration for hostsNewActions
Actions

Also available in: Atom PDF