fermitools / htvault-config

Configure a Hashicorp Vault server for use with htgettoken
Other
6 stars 2 forks source link

Prevent python traceback if 'name' is missing #6

Closed DrDaveD closed 3 years ago

DrDaveD commented 3 years ago

Currently if 'name' is not in a list, I get this python trace:

Traceback (most recent call last):
  File "/usr/libexec/htvault-config/jsontobash.py", line 54, in <module>
    main()
  File "/usr/libexec/htvault-config/jsontobash.py", line 51, in main
    convertbash("", combined)
  File "/usr/libexec/htvault-config/jsontobash.py", line 29, in convertbash
    convertbash(pfx + '_' + checkbashvar(key), data[key])
  File "/usr/libexec/htvault-config/jsontobash.py", line 36, in convertbash
    convertbash(pfx + '_' + checkbashvar(name), item)
  File "/usr/libexec/htvault-config/jsontobash.py", line 29, in convertbash
    convertbash(pfx + '_' + checkbashvar(key), data[key])
  File "/usr/libexec/htvault-config/jsontobash.py", line 32, in convertbash
    convertbash(pfx, ' '.join([item['name'] for item in data]))
  File "/usr/libexec/htvault-config/jsontobash.py", line 32, in <listcomp>
    convertbash(pfx, ' '.join([item['name'] for item in data]))
KeyError: 'name'
Failure converting config.json to config.bash
DrDaveD commented 3 years ago

Fixed in 1.3