Skip to content

Commit

Permalink
PEP 668 disallows installing packages via pip outside of virtual
Browse files Browse the repository at this point in the history
environments, to avoid breaking due to conflicting system packages.

Ansible is unlikely to be installed in the base system, and if it is and
the user still chooses to use `install_method: pip`, that would be an
invalid configuration.

This flag exists to allow users to bootstrap ansible to run as a
controller. The alternative solution would be to require virtual
environments, however this is often packaged as a separate dependency,
which further complicates bootstrap. Allow installing ansible outside of
virtual environments via pip's --break-system-packages.
  • Loading branch information
holmanb committed Aug 23, 2023
1 parent f7a2c48 commit 598ff44
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cloudinit/config/cc_ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def install(self, pkg_name: str):
import pip # noqa: F401
except ImportError:
self.distro.install_packages(self.distro.pip_package_name)
cmd = [sys.executable, "-m", "pip", "install"]
cmd = [
sys.executable, "-m", "pip", "install", "--break-system-packages"
]
if self.run_user:
cmd.append("--user")
self.do_as([*cmd, "--upgrade", "pip"])
Expand Down

0 comments on commit 598ff44

Please sign in to comment.