Skip to content

Commit

Permalink
Merge pull request #14 from cobbler/osver
Browse files Browse the repository at this point in the history
Fix os_version conditionals (issue #11)
  • Loading branch information
jmaas committed Dec 3, 2015
2 parents 39f1f20 + 5453dbc commit e7e31fb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions koan/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1497,12 +1497,17 @@ def calc_kernel_args(self, pd, replace_self=0):
hashv["netdevice"] = self.static_interface
else:
hashv["ksdevice"] = self.static_interface
newdracut = False
if (breed == "redhat" and
((os_version[0:4] == "rhel" and int(os_version[4:]) >= 7) or
(os_version[0:6] == "fedora" and int(os_version[6:]) >= 17))):
newdracut = True
if ip is not None:
if breed == "suse":
hashv["hostip"] = ip
elif breed == "debian" or breed == "ubuntu":
hashv["netcfg/get_ipaddress"] = ip
elif breed == "redhat" and (os_version >= "rhel7" or os_version >= "fedora17"):
elif newdracut:
def get_cidr(netmask):
binary_str = ''
for octet in netmask.split('.'):
Expand All @@ -1514,19 +1519,19 @@ def get_cidr(netmask):
if netmask is not None:
if breed == "debian" or breed == "ubuntu":
hashv["netcfg/get_netmask"] = netmask
elif breed == "redhat" and (os_version >= "rhel7" or os_version >= "fedora17"):
elif newdracut:
pass
else:
hashv["netmask"] = netmask
if gateway is not None:
if breed == "debian" or breed == "ubuntu":
hashv["netcfg/get_gateway"] = gateway
elif breed == "redhat" and (os_version >= "rhel7" or os_version >= "fedora17"):
elif newdracut:
pass
else:
hashv["gateway"] = gateway
if dns is not None:
if breed == "redhat" and (os_version >= "rhel7" or os_version >= "fedora17"):
if newdracut:
hashv["ip"] += ":" + ":".join(dns[0:2])
elif breed == "suse":
hashv["nameserver"] = dns[0]
Expand Down

0 comments on commit e7e31fb

Please sign in to comment.