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 375 forks source link

Set SELinux options on the File (Folder) generated by pyvenv #600

Open jameskirsop opened 3 years ago

jameskirsop commented 3 years ago

I'd like to be able to set the SELinux type on my virtualenv, but if I declare a second file directive to do this, I get a redeclare error on the next puppet run.

For example:

file {'externalapi_venv':
  recurse => true,
  path => '/var/www/externalapi/venv',
  seltype => 'httpd_sys_content_rw_t',
}
python::pyvenv { '/var/www/externalapi' :
  ensure       => present,
  version      => '38',
  systempkgs   => true,
  venv_dir     => '/var/www/externalapi/venv',
  owner        => 'jkirsop',
  require => Vcsrepo['/var/www/externalapi/code'],
}

I'm not aware of a way of setting the seltype in a 'clean' way other than doing so through the file class, and so having the ability to do this within the pyvenv class (and then have it filter down to the file class) seems like the most obvious way to me.

jameskirsop commented 3 years ago

@bastelfreak, does the above suggestion make sense?? I'm running into this limitation quite frequently now...