feat: add inner password storage and optimize flask command about inner cmdb (#248)

Co-authored-by: fxiang21 <fxiang21@126.com>
This commit is contained in:
pycook
2023-10-30 16:48:53 +08:00
committed by GitHub
parent 4440654a25
commit f75756b71a
5 changed files with 124 additions and 93 deletions

View File

@@ -11,7 +11,6 @@ class InnerKVManger(object):
res = InnerKV.create(**data)
if res.key == key:
return "success", True
return "add failed", False
@classmethod
@@ -21,3 +20,14 @@ class InnerKVManger(object):
return None
return res.value
@classmethod
def update(cls, key, value):
res = InnerKV.get_by(first=True, to_dict=False, **{"key": key})
if not res:
return None
res.value = value
t = res.update()
if t.key == key:
return "success", True
return "update failed", True