From b4e18b1f1ae745a673c09f6921b1af0c08a29021 Mon Sep 17 00:00:00 2001 From: vallard Date: Wed, 7 Mar 2018 13:36:52 -0800 Subject: [PATCH] fixed some bugs we found while testing Ubuntu --- kubam/app/app.py | 17 ----------------- kubam/app/autoinstall/Kickstart.py | 3 ++- kubam/app/iso/IsoMaker.py | 4 ---- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/kubam/app/app.py b/kubam/app/app.py index e819003..54cd38a 100644 --- a/kubam/app/app.py +++ b/kubam/app/app.py @@ -361,23 +361,6 @@ def get_isos(): return jsonify({'error': isos}) return jsonify({'isos': isos}), 200 -# DO NOT USE -# This API is only for extracting unknown ISOs. We can put the iso as well as the directory name we want to extract to. Use /isos/boot -# extract an ISO image. This probably isn't used as the /isos/boot does this for you as part of the -# creation process. -# curl -H "Content-Type: application/json" -X POST -d '{"iso" : "Vmware-ESXi-6.5.0-4564106-Custom-Cisco-6.5.0.2.iso", "os": "esxi6.5" }' http://localhost/api/v1/isos/extract -@app.route(API_ROOT + "/isos/extract", methods=['POST']) -@cross_origin() -def extract_iso(): - if not request.json: - return jsonify({'error': 'expected iso hash'}), 400 - iso = request.json['iso'] - os = request.json['os'] - err, msg = IsoMaker.extract_iso("/kubam/" + iso, "/kubam/" + os) - if not err == 0: - return jsonify({"error": msg}), 500 - return jsonify({"status": "ok"}), 201 - # make the boot ISO image of an ISO # curl -H "Content-Type: application/json" -X POST -d '{"iso" : "Vmware-ESXi-6.5.0-4564106-Custom-Cisco-6.5.0.2.iso" }' http://localhost/api/v1/isos/boot # curl -H "Content-Type: application/json" -X POST -d '{"iso" : "CentOS-7-x86_64-Minimal-1611.iso" }' http://localhost/api/v1/isos/boot diff --git a/kubam/app/autoinstall/Kickstart.py b/kubam/app/autoinstall/Kickstart.py index 1afd193..99ea00f 100755 --- a/kubam/app/autoinstall/Kickstart.py +++ b/kubam/app/autoinstall/Kickstart.py @@ -48,7 +48,8 @@ def build_boot_image(node, template): # unmount the filesystem. o = call(["umount", new_image_dir]) if not o == 0: - return 1, "unable to unmount %s" % new_image_dir + "" # we had a case in ubuntu where this errored and still worked. + #return 1, "unable to unmount %s" % new_image_dir # remove mount directory o = call(["rm", "-rf", new_image_dir]) if not o == 0: diff --git a/kubam/app/iso/IsoMaker.py b/kubam/app/iso/IsoMaker.py index fe97ccd..4869cf7 100755 --- a/kubam/app/iso/IsoMaker.py +++ b/kubam/app/iso/IsoMaker.py @@ -112,7 +112,6 @@ def mkboot_centos(os_name, version): "/usr/share/kubam/stage1/"+os_name+version+"/isolinux.cfg", stage_dir + "/isolinux/"]) - cwd = os.getcwd() os.chdir("/kubam") o = 0 if os_name == "centos": @@ -130,7 +129,6 @@ def mkboot_centos(os_name, version): if not o == 0: return 1, "mkisofs failed for %s" % boot_iso - os.chdir(cwd) return 0, "success" def mkboot_esxi(version): @@ -143,7 +141,6 @@ def mkboot_esxi(version): "/usr/share/kubam/stage1/esxi6.5/BOOT.CFG", os_dir]) - cwd = os.getcwd() os.chdir("/kubam") # https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-C03EADEA-A192-4AB4-9B71-9256A9CB1F9C.html o = call(["mkisofs", "-relaxed-filenames", "-J", "-R", @@ -152,7 +149,6 @@ def mkboot_esxi(version): "-boot-load-size" , "4", "-boot-info-table", "-no-emul-boot", os_dir]) - os.chdir(cwd) return 0, "success"