cli: warn users if they specify a missing file with @

This commit is contained in:
Ryan Petrello 2019-10-02 10:28:04 -04:00
parent 1f62d223a2
commit 6c1488ed00
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777
2 changed files with 2 additions and 3 deletions

View File

@ -57,5 +57,5 @@ Importing an SSH Key
awx credentials create --credential_type 'Machine' \
--name 'My SSH Key' --user 'alice' \
--inputs "{'username': 'server-login', 'ssh_key_data': '@~/.ssh/id_rsa`}"
--inputs '{"username": "server-login", "ssh_key_data": "@~/.ssh/id_rsa"}'

View File

@ -165,8 +165,7 @@ class ResourceOptionsParser(object):
# (to make things like SSH key data easier to work with)
if isinstance(v, six.text_type) and v.startswith('@'):
path = os.path.expanduser(v[1:])
if os.path.exists(path):
parsed[k] = open(path).read()
parsed[k] = open(path).read()
return parsed