minor cleanup up CLI import -f yaml support

This commit is contained in:
Ryan Petrello 2020-08-11 09:37:12 -04:00
parent 579604d2c6
commit 987c7d48a0
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -136,13 +136,13 @@ class Import(CustomCommand):
parser.print_help()
raise SystemExit()
format = getattr(client.args, 'conf.format')
if format == 'json':
fmt = client.get_config('format')
if fmt == 'json':
data = json.load(client.stdin)
elif format == 'yaml':
elif fmt == 'yaml':
data = yaml.safe_load(client.stdin)
else:
raise ImportExportError("Unsupported format for Import: " + format)
raise ImportExportError("Unsupported format for Import: " + fmt)
client.authenticate()
client.v2.import_assets(data)