def post(self): args = parser.parse_args() host_id = args['hostname'] abort_if_host_already_exist(host_id) ip = args['ip'] rectype = args['rectype'] new_host = addHostToDict(host_id, ip, rectype) zonefilemgr.addNewHost(my_zone_file,host_id,ip, rectype) zonefilemgr.signalProc('named') return new_host, 201
def post(self): args = parser.parse_args() host_id = args["hostname"] abort_if_host_already_exist(host_id) ip = args["ip"] rectype = args["rectype"] new_host = addHostToDict(host_id, ip, rectype) zonefilemgr.addNewHost(my_zone_file, host_id, ip, rectype) zonefilemgr.signalProc("named") return new_host, 201
def put(self, host_id): abort_if_host_doesnt_exist(host_id) args = parser.parse_args() host = HOSTS[host_id] old_ip = host['ip'] new_ip = args['ip'] rectype = args['rectype'] modified_host = modifyDict(host_id,new_ip,rectype) zonefilemgr.updateHostIP(host_id, my_zone_file, new_ip, rectype) zonefilemgr.signalProc('named') return modified_host, 201
def delete(self, host_id): abort_if_host_doesnt_exist(host_id) del HOSTS[host_id] zonefilemgr.deleteHost(my_zone_file, host_id) zonefilemgr.signalProc('named') return '', 204