X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNBI.git;a=blobdiff_plain;f=osm_nbi%2Fnbi.py;h=1d53396f05321122f1400c26f5b772b1b4247f6e;hp=4a5b0cc63939c55cdcf6c024521712663861806e;hb=cc10343b861269fe9f336fadf54b8e9fba0a74a7;hpb=d985a8dbd3c2a0ae7e1b6a28b12b6c0297c888b8 diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index 4a5b0cc..1d53396 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -259,9 +259,11 @@ class Server(object): if "application/json" in cherrypy.request.headers["Content-Type"]: error_text = "Invalid json format " indata = json.load(self.reader(cherrypy.request.body)) + cherrypy.request.headers.pop("Content-File-MD5", None) elif "application/yaml" in cherrypy.request.headers["Content-Type"]: error_text = "Invalid yaml format " indata = yaml.load(cherrypy.request.body) + cherrypy.request.headers.pop("Content-File-MD5", None) elif "application/binary" in cherrypy.request.headers["Content-Type"] or \ "application/gzip" in cherrypy.request.headers["Content-Type"] or \ "application/zip" in cherrypy.request.headers["Content-Type"] or \ @@ -281,9 +283,11 @@ class Server(object): # 'application/yaml' for input format are available") error_text = "Invalid yaml format " indata = yaml.load(cherrypy.request.body) + cherrypy.request.headers.pop("Content-File-MD5", None) else: error_text = "Invalid yaml format " indata = yaml.load(cherrypy.request.body) + cherrypy.request.headers.pop("Content-File-MD5", None) if not indata: indata = {} @@ -746,7 +750,11 @@ class Server(object): rollback.reverse() for rollback_item in rollback: try: - self.engine.del_item(**rollback_item, session=session, force=True) + if rollback_item.get("operation") == "set": + self.engine.db.set_one(rollback_item["topic"], {"_id": rollback_item["_id"]}, + rollback_item["content"], fail_on_empty=False) + else: + self.engine.del_item(**rollback_item, session=session, force=True) except Exception as e2: rollback_error_text = "Rollback Exception {}: {}".format(rollback_item, e2) cherrypy.log(rollback_error_text)