Browse Source

Validate that python3 is ready for loguserdata

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
changes/04/360804/4
Vitaly Gridnev 5 years ago
parent
commit
f95a8051ca
  1. 6
      heat/cloudinit/loguserdata.py

6
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"

Loading…
Cancel
Save