]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
ansible.py: Write "foo" to ~/.vault_pass.txt instead of touching 1173/head
authorDavid Galloway <dgallowa@redhat.com>
Wed, 16 May 2018 19:46:38 +0000 (15:46 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Wed, 16 May 2018 19:46:38 +0000 (15:46 -0400)
ansible-playbook will not run with an empty vault password file.  It
will run if the password file has something in it even if it doesn't get
used.

Signed-off-by: David Galloway <dgallowa@redhat.com>
teuthology/task/ansible.py

index f0ad662f7dc180f1204bcd884fb2c6a1df33d9c8..dfc009feba40257e03674bf3b5009a49667da82d 100644 (file)
@@ -416,12 +416,13 @@ class CephLab(Ansible):
         super(CephLab, self).__init__(ctx, config)
 
     def begin(self):
-        # Emulate 'touch ~/.vault_pass.txt' to avoid ansible failing;
-        # in almost all cases we don't need the actual vault password
+        # Write foo to ~/.vault_pass.txt if it's missing.
+        # In almost all cases we don't need the actual vault password.
+        # Touching an empty file broke as of Ansible 2.4
         vault_pass_path = os.path.expanduser('~/.vault_pass.txt')
         if not os.path.exists(vault_pass_path):
-            with open(vault_pass_path, 'a'):
-                pass
+            with open(vault_pass_path, 'w') as f:
+                f.write('foo')
         super(CephLab, self).begin()
 
     def _set_status(self, status):