INNER CODE UNIT · Python
mod
tpm2-software/tpm2-pkcs11 · tools/tpm2_pkcs11/commandlets_keys.py:438
def mod(cls, path, tid, key, value, inattrs, vtype):
with Db(path) as db:
obj = db.getobject(tid)
if obj is None:
sys.exit('Not found, object with id: {}'.format(tid))
s = obj['attrs']
obj_attrs = yaml.safe_load(s)
# if we don't have any update data, just dump the attributes
if not key and not inattrs:
print(yaml.safe_dump(obj_attrs, default_flow_style=False))
sys.exit()
# if we have attributes YAML file, then we want to update all attributes
if inattrs:
with Db(path) as db:
y = yaml.safe_load(open(inattrs, "r"))