summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Gridnev <vgridnev@mirantis.com>2016-08-26 01:05:51 +0300
committerVitaly Gridnev <vgridnev@mirantis.com>2016-08-26 13:57:31 +0000
commited46562157d2f9983f5665394ec47d2e27aad0df (patch)
tree6a9e0c41acbf755169db331db74663f60d1fc250
parentc01e360d8703f8f95ffddf1782404ed300b981ce (diff)
downloadheat-6.1.0.tar.gz
Validate that python3 is ready for loguserdata6.1.0
By default, ubuntu trusty images has python3 executable in path, but we can't use that for executing loguserdata script, because pkg_resources can't be imported. Now it's proposed to try importing pkg_resources for validating readiness of python3 for executing this script. If pkg_resources can't be imported there is no other choice except using python2. Change-Id: Icb4f58630016874eb40dd77590469fc5de6287e4 Closes-bug: 1617069
-rwxr-xr-xheat/cloudinit/loguserdata.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/heat/cloudinit/loguserdata.py b/heat/cloudinit/loguserdata.py
index 7d0dbae46..e02a59bae 100755
--- a/heat/cloudinit/loguserdata.py
+++ b/heat/cloudinit/loguserdata.py
@@ -12,7 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
"true" '''\'
-if hash python3 2>/dev/null; then
+# NOTE(vgridnev): ubuntu trusty by default has python3,
+# but pkg_resources can't be imported.
+echo "import pkg_resources" | python3 2>/dev/null
+has_py3=$?
+if [ $has_py3 = 0 ]; then
interpreter="python3"
else
interpreter="python"