voxpupuli / puppet-python

Puppet module for installing and managing Python, pip, virtualenvs and Gunicorn virtual hosts.
https://forge.puppetlabs.com/puppet/python
Apache License 2.0
199 stars 370 forks source link

Split package installation in multiple classes #670

Open smortex opened 9 months ago

smortex commented 9 months ago

Install python packages from dedicated classes of the module.

This allow to use a single python profile in a control-repo that does not enforce installation / removal of these packages and still allow modules to require them.


# module foo
class foo {
  include python
  include python::install::dev

  # ...
}

# module bar
class bar {
  include python
  include python::install::venv

  # ...
}

# control repo
class profile::python {
  class { 'python':
    dev                 => 'present',
    pip                 => 'present',
    venv                => 'present',
    manage_dev_package  => false,
    manage_pip_package  => false,
    manage_venv_package => false,

    # ... site specific config
  }
}

class profile::foo {
  include profile::python

  class { 'foo':
  }
}

class profile::bar {
  include profile::python

  class { 'bar':
  }
}

If a node is classified profile::foo, the python-dev package will be installed. If a node is classified profile::bar, the python-venv package will be installed. Other python-* packages are not managed.

This is part 2/3 of #668 and does not introduce functional change. However it permits new usages and therefore is labelled enhancement.

Part 3/3 will be backwards-incompatible in order to change the defaults of the python class to match those in the above example.


Also include: