Skip to content

Commit

Permalink
Fix pip-managed ansible on pip < 23.0.1 (#4403)
Browse files Browse the repository at this point in the history
Commit b417b21 broke pip-managed ansible with
pip < 23.0.1 and fixed pip-managed ansible with
pip >= 23.0.1. Gate the change by a filesystem artifact
only found on newer pip versions.
  • Loading branch information
holmanb authored and TheRealFalcon committed Oct 24, 2023
1 parent 7cf531a commit cfaf1f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cloudinit/config/cc_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import sys
import sysconfig
from copy import deepcopy
from logging import getLogger
from textwrap import dedent
Expand Down Expand Up @@ -141,8 +142,13 @@ def install(self, pkg_name: str):
"-m",
"pip",
"install",
"--break-system-packages",
]
if os.path.exists(
os.path.join(
sysconfig.get_path("stdlib"), "EXTERNALLY-MANAGED"
)
):
cmd.append("--break-system-packages")
if self.run_user:
cmd.append("--user")
self.do_as([*cmd, "--upgrade", "pip"])
Expand Down

0 comments on commit cfaf1f1

Please sign in to comment.