summaryrefslogtreecommitdiff
path: root/tools/encrypt_secret.py
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2017-12-30 06:20:39 -0800
committerClint Byrum <clint@fewbar.com>2017-12-30 06:20:39 -0800
commit04bcbe18dc794e8e0024f563d4f675deeb6870ef (patch)
treeb6ea378eec600bb02f034afa9e29df34b1eaa59d /tools/encrypt_secret.py
parent420e8a460bda83e14b6063bc17f8649597b22d46 (diff)
downloadzuul-04bcbe18dc794e8e0024f563d4f675deeb6870ef.tar.gz
Add --strip option to encrypt_secret.py
Sometimes you're storing a password in a file by editting it, but you want it to be raw without newlines/whitespace/etc. This lets you do that easily. Change-Id: Idc961b89a5ec3fb639e70a321b4ea587cf743b9d
Diffstat (limited to 'tools/encrypt_secret.py')
-rwxr-xr-xtools/encrypt_secret.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/encrypt_secret.py b/tools/encrypt_secret.py
index c0ee9be64..4cb166631 100755
--- a/tools/encrypt_secret.py
+++ b/tools/encrypt_secret.py
@@ -46,6 +46,8 @@ def main():
# TODO(jeblair): Throw a fit if SSL is not used.
parser.add_argument('project',
help="The name of the project.")
+ parser.add_argument('--strip', action='store_true', default=False,
+ help="Strip whitespace from beginning/end of input.")
parser.add_argument('--infile',
default=None,
help="A filename whose contents will be encrypted. "
@@ -68,6 +70,8 @@ def main():
plaintext = sys.stdin.read()
plaintext = plaintext.encode("utf-8")
+ if args.strip:
+ plaintext = plaintext.strip()
pubkey_file = tempfile.NamedTemporaryFile(delete=False)
try: