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.
@@ -174,7 +174,7 @@ class KeyValuePairSetCommand(resource.ResourceCommand):
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 @@ class KeyValuePairSetCommand(resource.ResourceCommand):
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
