def createpvcs(): try: token = request.args.get('token') namespace = request.args.get('namespace') pvname = request.args.get('pvname') pvcname = request.args.get('pvcname') print("token: ", token) print("namespace: ", namespace) print("pvname: ", pvname) print("pvcname: ", pvcname) if hastoken(token): srv, path = getpvnfsinfo(token, pvname) if srv is not "none" and path is not "none": if checkpvrbac(token, srv, path): createpvc = cpvc(namespace, pvcname, pvname) return createpvc else: return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' except Exception as e: print("error: %s", e) return '"message": {"error": "Something borked!"}"'
def deletepvcs(): try: token = request.args.get('token') pvcname = request.args.get('pvcname') namespace = request.args.get('namespace') clstr = request.args.get('cluster') print("token: ", token) print("pvcname: ", pvcname) print("namespace: ", namespace) if hastoken(token): gpv = getpv(clstr, namespace, pvcname) srv, path = getpvnfsinfo(clstr, token, gpv) if srv is not "none" and path is not "none": if checkpvrbac(clstr, token, srv, path): deletepvc = dpvc(clstr, namespace, pvcname) return deletepvc else: return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' except Exception as e: print("error: %s", e) return '"message": {"error": "Something borked!"}"'
def deletepvs(): try: token = request.args.get('token') pvname = request.args.get('pvname') print("token: ", token) print("pvname: ", pvname) if hastoken(token): server, mount = getpvnfsinfo(token, pvname) getrbac = checkpvrbac(token, server, mount) if getrbac: deletepv = dpv(pvname) return deletepv else: return '"message": {"auth": "failed"}' return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' except Exception as e: print("error: %s", e) return '"message": {"error": "Something borked!"}"'
def createpvs(): try: token = request.args.get('token') pvname = request.args.get('pvname') server = request.args.get('nfsserver') path = request.args.get('path') print("token: ", token) print("pvname: ", pvname) print("server: ", server) print("path: ", path) if hastoken(token): if checkpvrbac(token, server, path): createpv = cpv(pvname, server, path) return createpv else: return '"message": {"auth": "failed"}' else: return '"message": {"auth": "failed"}' except Exception as e: print("error: %s", e) return '"message": {"error": "Something borked!"}"'