From 956924429d324ed432b2f9bf6ec0ceff437486ad Mon Sep 17 00:00:00 2001 From: tierno Date: Thu, 24 May 2018 18:05:28 +0200 Subject: [PATCH] some minor fixes Change-Id: I58730de0d8577518a4f434ae51eeb8bc0402a691 Signed-off-by: tierno --- osm_nbi/engine.py | 11 ++++++----- osm_nbi/nbi.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/osm_nbi/engine.py b/osm_nbi/engine.py index c13240d..b5989c0 100644 --- a/osm_nbi/engine.py +++ b/osm_nbi/engine.py @@ -949,10 +949,8 @@ class Engine(object): self.db.del_list("vnfrs", {"nsr-id-ref": _id}) self.msg.write("ns", "deleted", {"_id": _id}) return v - if item in ("vim_accounts", "sdns"): - desc = self.db.get_one(item, filter) - desc["_admin"]["to_delete"] = True - self.db.replace(item, _id, desc) # TODO change to set_one + if item in ("vim_accounts", "sdns") and not force: + self.db.set_one(item, {"_id": _id}, {"_admin.to_delete": True}) # TODO change status if item == "vim_accounts": self.msg.write("vim_account", "delete", {"_id": _id}) elif item == "sdns": @@ -960,7 +958,10 @@ class Engine(object): return {"deleted": 1} # TODO indicate an offline operation to return 202 ACCEPTED v = self.db.del_one(item, filter) - self.fs.file_delete(_id, ignore_non_exist=True) + if item in ("vnfds", "nsds"): + self.fs.file_delete(_id, ignore_non_exist=True) + if item in ("vim_accounts", "sdns", "vnfds", "nsds"): + self.msg.write(item[:-1], "deleted", {"_id": _id}) return v def prune(self): diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py index ff8cd11..fefb3e9 100644 --- a/osm_nbi/nbi.py +++ b/osm_nbi/nbi.py @@ -59,7 +59,7 @@ URL: /osm GET POST /ns_instances_content O O / O O /ns_instances 5 5 - / 5 5 + / O5 O5 instantiate O5 terminate O5 action O @@ -215,7 +215,7 @@ class Server(object): "": {"METHODS": ("GET", "DELETE")} }, "ns_instances": {"METHODS": ("GET", "POST"), - "": {"TODO": ("GET", "DELETE"), + "": {"METHODS": ("GET", "DELETE"), "scale": {"TODO": "POST"}, "terminate": {"METHODS": "POST"}, "instantiate": {"METHODS": "POST"}, -- 2.25.1