]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Hardcode provision-finished file path
authorJeff Peeler <jpeeler@redhat.com>
Wed, 30 Jan 2013 19:26:34 +0000 (14:26 -0500)
committerJeff Peeler <jpeeler@redhat.com>
Wed, 30 Jan 2013 20:38:32 +0000 (15:38 -0500)
A recent change removed the use of the cloudinit module, so write this
log to /var/lib/heat. Functional test paths updated as well.
(User data injection was removed, so that has been deleted as well.)

Change-Id: Ibcaf310a5e4ff9a9ed8b1065bdd411e1b95d4de5
Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
heat/cloudinit/loguserdata.py
heat/tests/functional/util.py

index 521f50985da379b32c7d131c9b49237d1a5fccc8..2adcccd78f39fdc9bd2a9dc34f4c7752436034d0 100644 (file)
@@ -6,6 +6,7 @@ import stat
 import subprocess
 import datetime
 import pkg_resources
+import errno
 
 path = '/var/lib/cloud/data'
 
@@ -17,16 +18,24 @@ if ci_version[0] <= 0 and ci_version[1] < 6:
                   ' cloud-init\n')
         sys.exit(0)
 
-os.chmod(path + '/cfn-userdata', stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
+os.chmod(os.path.join(path, 'cfn-userdata'),
+         stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
 
 with open('/var/log/heat-provision.log', 'w') as log:
     log.write('Provision began: %s\n' % datetime.datetime.now())
     log.flush()
-    p = subprocess.Popen(path + '/cfn-userdata', stdout=log, stderr=log)
+    p = subprocess.Popen(os.path.join(path, 'cfn-userdata'),
+                         stdout=log, stderr=log)
     p.wait()
     log.write('Provision done: %s\n' % datetime.datetime.now())
     if p.returncode:
         sys.exit(p.returncode)
 
-with open(cloudinit.get_ipath_cur() + '/provision-finished', 'w') as log:
+try:
+    os.makedirs('/var/lib/heat')
+except OSError as e:
+    if e.errno != errno.EEXIST:
+        raise
+
+with open('/var/lib/heat/provision-finished', 'w') as log:
     log.write('%s\n' % datetime.datetime.now())
index f986f1ef739931ec3070772c5964c85d3c5a27b2..43059ebae764e3384edfef0b85c6d49f387237bf 100644 (file)
@@ -219,7 +219,7 @@ class Instance(object):
         tries = 0
         while True:
             try:
-                self.sftp.stat('/var/lib/cloud/instance/provision-finished')
+                self.sftp.stat('/var/lib/heat/provision-finished')
             except paramiko.SSHException as e:
                 print e
             except IOError as e:
@@ -268,9 +268,6 @@ class Instance(object):
         t_data = t_data['UserData']['Fn::Base64']['Fn::Join'].pop()
         joined_t_data = ''.join(t_data)
         t_data_list = joined_t_data.split('\n')
-        # must match user data injection
-        t_data_list.insert(len(t_data_list) - 1,
-                           u'touch /var/lib/cloud/instance/provision-finished')
 
         self.testcase.assertEqual(t_data_list, remote_file_list_u)