From 044ae3f2d6be8f732e75de4cb7ba6d352580b7e4 Mon Sep 17 00:00:00 2001
From: Riccardo Pittau <elfosardo@gmail.com>
Date: Tue, 4 Feb 2020 18:09:52 +0100
Subject: [PATCH] Force DIB_PYTHON_VERSION to 3 for Debian

Since more and more python libraries are removing support for
Python 2 in the latest versions, we need to force the version of
Python used to build the DIB Debian image to 3, at least until
DIB fully converts to Python 3.

Change-Id: I8e6f15635754ab917562d758c35a8c5f4629efdf
---
 .../environment.d/20-ipa-distro-family.bash                 | 6 ++++++
 dib/ironic-python-agent-ramdisk/pkg-map                     | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dib/ironic-python-agent-ramdisk/environment.d/20-ipa-distro-family.bash b/dib/ironic-python-agent-ramdisk/environment.d/20-ipa-distro-family.bash
index 95a1c15..048066c 100644
--- a/dib/ironic-python-agent-ramdisk/environment.d/20-ipa-distro-family.bash
+++ b/dib/ironic-python-agent-ramdisk/environment.d/20-ipa-distro-family.bash
@@ -4,3 +4,9 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then
 else
     export IPA_DISTRO_FAMILY=other
 fi
+
+# NOTE(rpittau) force Python version to 3 for debian
+if [[ $DISTRO_NAME =~ debian ]]; then
+  DIB_PYTHON_VERSION=3
+  export DIB_PYTHON_VERSION
+fi
diff --git a/dib/ironic-python-agent-ramdisk/pkg-map b/dib/ironic-python-agent-ramdisk/pkg-map
index db67e88..4c80fde 100644
--- a/dib/ironic-python-agent-ramdisk/pkg-map
+++ b/dib/ironic-python-agent-ramdisk/pkg-map
@@ -34,7 +34,8 @@
     },
     "debian": {
       "tgt": "tgt",
-      "curl": "curl"
+      "curl": "curl",
+      "python-dev": "python3-dev"
     }
   },
   "default": {