Merge pull request #4881 from ryanpetrello/cli-ssh-example

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

Reviewed-by: Yanis Guenane
             https://github.com/Spredzy
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-10-02 15:00:51 +00:00 committed by GitHub
commit a9b299cd98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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