Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix alias renaming #798

Merged
merged 4 commits into from
Jun 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/keri/app/cli/commands/rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,19 @@ def rename(tymth, tock=0.0, **opts):
if hby.habByName(newAlias) is not None:
print(f"{newAlias} is already in use")

if (pre := hab.db.names.get(keys=("", name))) is not None:
if (pre := hab.db.names.get(keys=("", alias))) is not None:

habord = hab.db.habs.get(keys=pre)
habord.name = name
habord.name = newAlias
hab.db.habs.pin(keys=habord.hid,
val=habord)
hab.db.names.pin(keys=("", name), val=pre)
hab.db.names.pin(keys=("", newAlias), val=pre)
hab.db.names.rem(keys=("", alias))

print(f"Hab {alias} renamed to {newAlias}")
else:
raise ConfigurationError(f"No AID with name {alias} found")


except ConfigurationError as e:
print(f"identifier prefix for {name} does not exist, incept must be run first", )
Expand Down
Loading