Previously the present of an API call only present in cloud-init 0.6.x
was used to determine whether or not cfn-userdata would have been executed
or not. The API call was removed in 0.7.x. This Fixes bug #
1103793
Change-Id: I27129f8ae6144ae7172b7159ed70fc5f0d7d07b9
#!/usr/bin/env python
-import cloudinit
import sys
import os
import stat
import subprocess
import datetime
+import pkg_resources
-path = None
+path = '/var/lib/cloud/data'
-try:
- path = cloudinit.get_cpath('data')
-except AttributeError:
+ci_version = pkg_resources.get_distribution('cloud-init').version.split('.')
+if ci_version[0] <= 0 and ci_version[1] < 6:
# pre 0.6.0 - user data executed via cloudinit, not this helper
with open('/var/log/heat-provision.log', 'w') as log:
log.write('Unable to log provisioning, need a newer version of'