From 7ce0a2f4a012930736a1b5b33461054caaa0a9bd Mon Sep 17 00:00:00 2001 From: wingiti <73697233+wingiti@users.noreply.github.com> Date: Wed, 24 Feb 2021 12:16:40 +0100 Subject: [PATCH 1/4] Update keyvalue.py Add possibility to add a value by using a prompt instead of a parameter. This prevents secrets from being documented/leaked in the shell history. --- st2client/st2client/commands/keyvalue.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/st2client/st2client/commands/keyvalue.py b/st2client/st2client/commands/keyvalue.py index 9c0d06f806..902da384e2 100644 --- a/st2client/st2client/commands/keyvalue.py +++ b/st2client/st2client/commands/keyvalue.py @@ -174,7 +174,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', dest='ttl', type=int, default=None, help='TTL (in seconds) for this value.') self.parser.add_argument('-s', '--scope', dest='scope', default=DEFAULT_CUD_SCOPE, @@ -188,10 +188,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 From 9f40fbecfd3816e44520fb60ee5799351336d61d Mon Sep 17 00:00:00 2001 From: wingiti <73697233+wingiti@users.noreply.github.com> Date: Wed, 2 Jun 2021 17:15:15 +0200 Subject: [PATCH 2/4] Update CHANGELOG.rst --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cdecd36345..405b7e6b15 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -325,6 +325,8 @@ Improvements continue with printing the details of any other found resources. (new feature) #4912 Contributed by @Kami. + +* Added possibility to add new values to the KV store via CLI without leaking them to the shell history. #5164 Fixed ~~~~~ From 055868f05066281d71df017845e51f5468b80db6 Mon Sep 17 00:00:00 2001 From: Eugen Cusmaunsa Date: Wed, 14 Jul 2021 20:51:46 +0100 Subject: [PATCH 3/4] Update CHANGELOG.rst --- CHANGELOG.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6d5f4ece28..23c7f5120c 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 ~~~~~~~ @@ -351,8 +356,6 @@ Improvements continue with printing the details of any other found resources. (new feature) #4912 Contributed by @Kami. - -* Added possibility to add new values to the KV store via CLI without leaking them to the shell history. #5164 Fixed ~~~~~ From e792bdb9b93c0c2ccbb9381f77f3f54157a1d912 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 1 Oct 2021 20:36:33 -0500 Subject: [PATCH 4/4] whitespace fix --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c20118e5ff..3b80704603 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,7 +6,7 @@ in development Added ~~~~~ - + * Added possibility to add new values to the KV store via CLI without leaking them to the shell history. #5164 Changed