Skip to content

Commit 9ad7d67

Browse files
committed
Add fallback on the default system version of Python
When Python is not installed, the python_version fact is undef, but we need to know which version of Python is going to be installed by the module in order to use the proper command invocation for building virtual envs. This issue only occurs when the user use the system version of Python, so add the default version of Python for supported operating systems into Hiera and use that as a fallback when the version of Python is unknown.
1 parent 81daea2 commit 9ad7d67

File tree

15 files changed

+44
-1
lines changed

15 files changed

+44
-1
lines changed

REFERENCE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class { 'python' :
6767

6868
The following parameters are available in the `python` class:
6969

70+
* [`default_system_version`](#-python--default_system_version)
7071
* [`ensure`](#-python--ensure)
7172
* [`version`](#-python--version)
7273
* [`pip`](#-python--pip)
@@ -92,6 +93,12 @@ The following parameters are available in the `python` class:
9293
* [`anaconda_installer_url`](#-python--anaconda_installer_url)
9394
* [`anaconda_install_path`](#-python--anaconda_install_path)
9495

96+
##### <a name="-python--default_system_version"></a>`default_system_version`
97+
98+
Data type: `Python::Version`
99+
100+
The default version of Python provided by the operating system. Only used as a fallback if Python is not installed yet to determine how to handle some actions that vary depending on the Python version used.
101+
95102
##### <a name="-python--ensure"></a>`ensure`
96103

97104
Data type: `Python::Package::Ensure`

data/common.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.11"

data/os/Archlinux.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.13"

data/os/Debian/11.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.9"

data/os/Debian/12.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.11"

data/os/FreeBSD.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.11"

data/os/Gentoo.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.12"

data/os/RedHat/8.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.6"

data/os/RedHat/9.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.9"

data/os/Ubuntu/20.04.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python::default_system_version: "3.8"

0 commit comments

Comments
 (0)