]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
openstack: get user-data path relative to the sources 689/head
authorLoic Dachary <ldachary@redhat.com>
Wed, 28 Oct 2015 01:34:52 +0000 (10:34 +0900)
committerLoic Dachary <ldachary@redhat.com>
Tue, 3 Nov 2015 07:56:50 +0000 (08:56 +0100)
The user-data files are in the sources, in the teuthology/openstack
directory. By default the template path being used is
teuthology/openstack/openstack-{os_type}-{os_version}-user-data.txt and
assumes teuthology-suite / teuthology-openstack is run from the root of
the source directory.

If the user-data path is relative, make it absolute based on the
directory in which the openstack module is found.

http://tracker.ceph.com/issues/13416 Fixes: #13416

Signed-off-by: Loic Dachary <ldachary@redhat.com>
teuthology/openstack/__init__.py

index 6d8d055eedaaa3a7f009cd1744347920358b5afc..fe976a928486e8a7d76e3aba576069e6d21efbe5 100644 (file)
@@ -500,7 +500,12 @@ ssh access           : ssh {identity}{username}@{ip} # logs in /usr/share/nginx/
         and a few other values are substituted.
         """
         path = tempfile.mktemp()
-        template = open(self.user_data).read()
+        if self.user_data.startswith('/'):
+            user_data = self.user_data
+        else:
+            user_data = os.path.join(os.path.dirname(__file__),
+                                     '../..', self.user_data)
+        template = open(user_data).read()
         openrc = ''
         for (var, value) in os.environ.iteritems():
             if var.startswith('OS_'):