|
|
|
@ -8,11 +8,10 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
|
import errno
|
|
|
|
|
import json
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def write_secret_to_file(path, secret, key, json_secret=False):
|
|
|
|
|
def write_secret_to_file(path, secret):
|
|
|
|
|
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../' + path))
|
|
|
|
|
try:
|
|
|
|
|
os.makedirs(os.path.dirname(path))
|
|
|
|
@ -22,8 +21,6 @@ def write_secret_to_file(path, secret, key, json_secret=False):
|
|
|
|
|
print("Outputting secret to: {}".format(path))
|
|
|
|
|
|
|
|
|
|
with open(path, 'w') as f:
|
|
|
|
|
if json_secret:
|
|
|
|
|
secret = json.dumps(secret)
|
|
|
|
|
f.write(secret)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -32,11 +29,10 @@ def main():
|
|
|
|
|
|
|
|
|
|
parser.add_argument("-c", dest="content", action="store", help="content of the secret")
|
|
|
|
|
parser.add_argument("-f", dest="path", action="store", help="file to save secret to")
|
|
|
|
|
parser.add_argument("--json", dest="json", action="store_true", default=False, help="serializes the secret to JSON format")
|
|
|
|
|
|
|
|
|
|
result = parser.parse_args()
|
|
|
|
|
|
|
|
|
|
write_secret_to_file(result.path, result.content, result.json)
|
|
|
|
|
write_secret_to_file(result.path, result.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|