write-dummy-secret.py: clean unused json logic
parent
b4e1360f59
commit
ca05863138
|
@ -8,11 +8,10 @@ from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import errno
|
import errno
|
||||||
import json
|
|
||||||
import os
|
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))
|
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../' + path))
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(path))
|
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))
|
print("Outputting secret to: {}".format(path))
|
||||||
|
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
if json_secret:
|
|
||||||
secret = json.dumps(secret)
|
|
||||||
f.write(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("-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("-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()
|
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__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in New Issue