From 6c1488ed0071a406866be6c0ccce569e8050edda Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 2 Oct 2019 10:28:04 -0400 Subject: [PATCH] cli: warn users if they specify a missing file with @ --- awxkit/awxkit/cli/docs/source/examples.rst | 2 +- awxkit/awxkit/cli/options.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/awxkit/awxkit/cli/docs/source/examples.rst b/awxkit/awxkit/cli/docs/source/examples.rst index 6f30a37172..7c66673b3d 100644 --- a/awxkit/awxkit/cli/docs/source/examples.rst +++ b/awxkit/awxkit/cli/docs/source/examples.rst @@ -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"}' diff --git a/awxkit/awxkit/cli/options.py b/awxkit/awxkit/cli/options.py index 70601f2ddd..28a47fd06e 100644 --- a/awxkit/awxkit/cli/options.py +++ b/awxkit/awxkit/cli/options.py @@ -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