Skip to content

Commit

Permalink
Validate that python3 is ready for loguserdata
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Vitaly Gridnev committed Aug 26, 2016
1 parent c01e360 commit ed46562
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion heat/cloudinit/loguserdata.py
Expand Up @@ -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"
Expand Down

0 comments on commit ed46562

Please sign in to comment.