Hardcode provision-finished file path

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>
This commit is contained in:
Jeff Peeler 2013-01-30 14:26:34 -05:00
parent 2533e8ad6d
commit 410336810d
2 changed files with 13 additions and 7 deletions

View File

@ -6,6 +6,7 @@ import stat
import subprocess import subprocess
import datetime import datetime
import pkg_resources import pkg_resources
import errno
path = '/var/lib/cloud/data' path = '/var/lib/cloud/data'
@ -17,16 +18,24 @@ if ci_version[0] <= 0 and ci_version[1] < 6:
' cloud-init\n') ' cloud-init\n')
sys.exit(0) 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: with open('/var/log/heat-provision.log', 'w') as log:
log.write('Provision began: %s\n' % datetime.datetime.now()) log.write('Provision began: %s\n' % datetime.datetime.now())
log.flush() 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() p.wait()
log.write('Provision done: %s\n' % datetime.datetime.now()) log.write('Provision done: %s\n' % datetime.datetime.now())
if p.returncode: if p.returncode:
sys.exit(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()) log.write('%s\n' % datetime.datetime.now())

View File

@ -219,7 +219,7 @@ class Instance(object):
tries = 0 tries = 0
while True: while True:
try: try:
self.sftp.stat('/var/lib/cloud/instance/provision-finished') self.sftp.stat('/var/lib/heat/provision-finished')
except paramiko.SSHException as e: except paramiko.SSHException as e:
print e print e
except IOError as e: except IOError as e:
@ -268,9 +268,6 @@ class Instance(object):
t_data = t_data['UserData']['Fn::Base64']['Fn::Join'].pop() t_data = t_data['UserData']['Fn::Base64']['Fn::Join'].pop()
joined_t_data = ''.join(t_data) joined_t_data = ''.join(t_data)
t_data_list = joined_t_data.split('\n') 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) self.testcase.assertEqual(t_data_list, remote_file_list_u)