Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
cobbler
cobbler-buildiso-list-to-string.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File cobbler-buildiso-list-to-string.patch of Package cobbler
Index: cobbler-2.6.6/cobbler/action_buildiso.py =================================================================== --- cobbler-2.6.6.orig/cobbler/action_buildiso.py +++ cobbler-2.6.6/cobbler/action_buildiso.py @@ -63,6 +63,16 @@ class BuildIso: header_src.close() + def get_first_value(self, koptvalue): + """ + Some kopt values can be string or list but we can handle only 1 value + Return the string or the first value of the list + """ + if type(koptvalue) == list: + return len(koptvalue) and koptvalue[0] or "" + return koptvalue + + def add_remaining_kopts(self,koptdict): """ Add remaining kernel_options to append_line @@ -165,11 +175,8 @@ class BuildIso: if data.has_key("proxy") and data["proxy"] != "": append_line += " proxy=%s" % data["proxy"] if data["kernel_options"].has_key("install"): - v = data["kernel_options"]["install"] - if isinstance(v, list): - v = v[0] - if v: - append_line += " install=%s" % v + v = self.get_first_value(data["kernel_options"]["install"]) + append_line += " install=%s" % v del data["kernel_options"]["install"] else: append_line += " install=http://%s:%s/cblr/links/%s" % ( @@ -222,14 +229,14 @@ class BuildIso: if data.has_key("proxy") and data["proxy"] != "": append_line += " proxy=%s" % data["proxy"] if data["kernel_options"].has_key("install") and data["kernel_options"]["install"] != "": - append_line += " install=%s" % data["kernel_options"]["install"] + append_line += " install=%s" % self.get_first_value(data["kernel_options"]["install"]) del data["kernel_options"]["install"] else: append_line += " install=http://%s:%s/cblr/links/%s" % ( data["server"], self.api.settings().http_port, dist.name ) if data["kernel_options"].has_key("autoyast") and data["kernel_options"]["autoyast"] != "": - append_line += " autoyast=%s" % data["kernel_options"]["autoyast"] + append_line += " autoyast=%s" % self.get_first_value(data["kernel_options"]["autoyast"]) del data["kernel_options"]["autoyast"] else: append_line += " autoyast=%s" % data["kickstart"] @@ -268,51 +275,51 @@ class BuildIso: my_int = None; my_ip = None; my_mask = None; my_gw = None; my_dns = None if dist.breed in ["suse", "redhat"]: if data["kernel_options"].has_key("netmask") and data["kernel_options"]["netmask"] != "": - my_mask = data["kernel_options"]["netmask"] + my_mask = self.get_first_value(data["kernel_options"]["netmask"]) del data["kernel_options"]["netmask"] if data["kernel_options"].has_key("gateway") and data["kernel_options"]["gateway"] != "": - my_gw = data["kernel_options"]["gateway"] + my_gw = self.get_first_value(data["kernel_options"]["gateway"]) del data["kernel_options"]["gateway"] if dist.breed == "redhat": if data["kernel_options"].has_key("ksdevice") and data["kernel_options"]["ksdevice"] != "": - my_int = data["kernel_options"]["ksdevice"] + my_int = self.get_first_value(data["kernel_options"]["ksdevice"]) if my_int == "bootif": my_int = None del data["kernel_options"]["ksdevice"] if data["kernel_options"].has_key("ip") and data["kernel_options"]["ip"] != "": - my_ip = data["kernel_options"]["ip"] + my_ip = self.get_first_value(data["kernel_options"]["ip"]) del data["kernel_options"]["ip"] if data["kernel_options"].has_key("dns") and data["kernel_options"]["dns"] != "": - my_dns = data["kernel_options"]["dns"] + my_dns = self.get_first_value(data["kernel_options"]["dns"]) del data["kernel_options"]["dns"] if dist.breed == "suse": if data["kernel_options"].has_key("netdevice") and data["kernel_options"]["netdevice"] != "": - my_int = data["kernel_options"]["netdevice"] + my_int = self.get_first_value(data["kernel_options"]["netdevice"]) del data["kernel_options"]["netdevice"] if data["kernel_options"].has_key("hostip") and data["kernel_options"]["hostip"] != "": - my_ip = data["kernel_options"]["hostip"] + my_ip = self.get_first_value(data["kernel_options"]["hostip"]) del data["kernel_options"]["hostip"] if data["kernel_options"].has_key("nameserver") and data["kernel_options"]["nameserver"] != "": - my_dns = data["kernel_options"]["nameserver"] + my_dns = self.get_first_value(data["kernel_options"]["nameserver"]) del data["kernel_options"]["nameserver"] if dist.breed in ["ubuntu","debian"]: if data["kernel_options"].has_key("netcfg/choose_interface") and data["kernel_options"]["netcfg/choose_interface"] != "": - my_int = data["kernel_options"]["netcfg/choose_interface"] + my_int = self.get_first_value(data["kernel_options"]["netcfg/choose_interface"]) del data["kernel_options"]["netcfg/choose_interface"] if data["kernel_options"].has_key("netcfg/get_ipaddress") and data["kernel_options"]["netcfg/get_ipaddress"] != "": - my_ip = data["kernel_options"]["netcfg/get_ipaddress"] + my_ip = self.get_first_value(data["kernel_options"]["netcfg/get_ipaddress"]) del data["kernel_options"]["netcfg/get_ipaddress"] if data["kernel_options"].has_key("netcfg/get_netmask") and data["kernel_options"]["netcfg/get_netmask"] != "": - my_mask = data["kernel_options"]["netcfg/get_netmask"] + my_mask = self.get_first_value(data["kernel_options"]["netcfg/get_netmask"]) del data["kernel_options"]["netcfg/get_netmask"] if data["kernel_options"].has_key("netcfg/get_gateway") and data["kernel_options"]["netcfg/get_gateway"] != "": - my_gw = data["kernel_options"]["netcfg/get_gateway"] + my_gw = self.get_first_value(data["kernel_options"]["netcfg/get_gateway"]) del data["kernel_options"]["netcfg/get_gateway"] if data["kernel_options"].has_key("netcfg/get_nameservers") and data["kernel_options"]["netcfg/get_nameservers"] != "": - my_dns = data["kernel_options"]["netcfg/get_nameservers"] + my_dns = self.get_first_value(data["kernel_options"]["netcfg/get_nameservers"]) del data["kernel_options"]["netcfg/get_nameservers"] # if no kernel_options overrides are present find the management interface
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor