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
def mkboot_iso(): # get the iso map err, msg, isos = YamlDB.get_iso_map(KUBAM_CFG) if err != 0: return jsonify({"error": msg}), 400 if len(isos) == 0: return jsonify({"error": "No ISOS have been mapped. Please map an ISO image with an OS"}), 400 err, msg = IsoMaker.mkboot_iso(isos) if err != 0: return jsonify({"error": msg}), 400 err, msg = Builder.deploy_server_images(KUBAM_CFG) if err != 0: return jsonify({"error": msg}), 400 return jsonify({"status": "ok"}), 201
def test_list_isos(self): err, isos = IsoMaker.list_isos("/asdf/asd/e/e/efasdf") assert (err == 1) assert type(isos) is str
def get_isos(): err, isos = IsoMaker.list_isos("/kubam") if err != 0: return jsonify({'error': isos}) return jsonify({'isos': isos}), 200