diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8e07295e6d..e3fa1c7904 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,11 @@ Changelog in development -------------- +Added +~~~~~ + +* Added possibility to add new values to the KV store via CLI without leaking them to the shell history. #5164 + Changed ~~~~~~~ diff --git a/st2client/st2client/commands/keyvalue.py b/st2client/st2client/commands/keyvalue.py index 19ea0d9f5b..b825185dbe 100644 --- a/st2client/st2client/commands/keyvalue.py +++ b/st2client/st2client/commands/keyvalue.py @@ -256,7 +256,7 @@ def __init__(self, resource, *args, **kwargs): self.parser.add_argument( "name", metavar="name", help="Name of the key value pair." ) - self.parser.add_argument("value", help="Value paired with the key.") + self.parser.add_argument("value", help="Value paired with the key.", nargs="?") self.parser.add_argument( "-l", "--ttl", @@ -285,10 +285,14 @@ def run(self, args, **kwargs): instance = KeyValuePair() instance.id = args.name # TODO: refactor and get rid of id instance.name = args.name - instance.value = args.value instance.scope = args.scope instance.user = args.user + if not args.value: + instance.value = input("Please insert value for key: ") + else: + instance.value = args.value + if args.secret: instance.secret = args.secret