From 57703450f5fba44b28e74a56fb094b7b48fe5b88 Mon Sep 17 00:00:00 2001 From: Pete Travis Date: Sat, 13 Feb 2016 20:22:13 -0600 Subject: [PATCH] use expanduser() before testing user_data as file I like to use ~/somepath instead of absolute paths because that's more shareable. Without expansion, the path wasn't considered a file, and the resulting cloud-config user_data contained a string for the file path instead of the file context. So, expand it. --- lib/ansible/modules/cloud/rackspace/rax.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/rackspace/rax.py b/lib/ansible/modules/cloud/rackspace/rax.py index dad2e2a4f8d..a859e7a7bb3 100644 --- a/lib/ansible/modules/cloud/rackspace/rax.py +++ b/lib/ansible/modules/cloud/rackspace/rax.py @@ -285,7 +285,7 @@ def create(module, names=[], flavor=None, image=None, meta={}, key_name=None, if user_data: config_drive = True - if user_data and os.path.isfile(user_data): + if user_data and os.path.isfile(os.path.expanduser('user_data')): try: f = open(user_data) user_data = f.read()