Skip to content

Commit

Permalink
486 Set permissive umask.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Vincent committed May 22, 2019
1 parent 7999862 commit 0350566
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 23 deletions.
82 changes: 59 additions & 23 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
_Public Classes_

* [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn.
* [`python::pip::bootstrap`](#pythonpipbootstrap): allow to bootstrap pip when python is managed from other module

_Private Classes_

Expand Down Expand Up @@ -44,7 +45,7 @@ class { 'python':
}
```

##### install python3 from scl report
##### install python3 from scl repo

```puppet
class { 'python' :
Expand Down Expand Up @@ -138,6 +139,22 @@ to determine if the epel class is used.

Default value: $python::params::use_epel

##### `manage_scl`

Data type: `Boolean`

Whether to manage core SCL packages or not.

Default value: $python::params::manage_scl

##### `umask`

Data type: `Optional[Pattern[/[0-7]{1,4}/]]`

The default umask for invoked exec calls.

Default value: `undef`

##### `gunicorn_package_name`

Data type: `Any`
Expand Down Expand Up @@ -218,6 +235,40 @@ Data type: `Stdlib::Absolutepath`

Default value: $python::params::anaconda_install_path

### python::pip::bootstrap

allow to bootstrap pip when python is managed from other module

#### Examples

#####

```puppet
class { 'python::pip::bootstrap':
version => 'pip',
}
```

#### Parameters

The following parameters are available in the `python::pip::bootstrap` class.

##### `version`

Data type: `Enum['pip', 'pip3']`

should be pip or pip3

Default value: 'pip'

##### `manage_python`

Data type: `Variant[Boolean, String]`

if python module will manage deps

Default value: `false`

## Defined types

### python::dotfile
Expand Down Expand Up @@ -256,15 +307,15 @@ Default value: 'present'

##### `filename`

Data type: `Stdlib::Filemode`
Data type: `String[1]`

Filename.

Default value: $title

##### `mode`

Data type: `String[1]`
Data type: `Stdlib::Filemode`

File mode.

Expand Down Expand Up @@ -365,12 +416,10 @@ Default value: 'wsgi'

##### `dir`

Data type: `Any`
Data type: `Stdlib::Absolutepath`

Application directory.

Default value: `false`

##### `bind`

Data type: `Any`
Expand Down Expand Up @@ -479,7 +528,7 @@ Default value: `false`

##### `log_level`

Data type: `Any`
Data type: `Enum['debug', 'info', 'warning', 'error', 'critical']`



Expand Down Expand Up @@ -529,19 +578,6 @@ python::pip { 'requests' :
}
```

##### Install Requests with pip module

```puppet
python::pip { 'requests' :
ensure => 'present',
pkgname => 'requests',
pip_provider => 'python3 -m pip',
virtualenv => '/var/www/project1',
owner => 'root',
timeout => 1800
}
```

#### Parameters

The following parameters are available in the `python::pip` defined type.
Expand All @@ -568,7 +604,7 @@ Default value: present

##### `virtualenv`

Data type: `String`
Data type: `Variant[Enum['system'], Stdlib::Absolutepath]`

virtualenv to run pip in.

Expand Down Expand Up @@ -600,11 +636,11 @@ Default value: 'root'

##### `group`

Data type: `String[1]`
Data type: `Any`

The group of the virtualenv being manipulated.

Default value: 'root'
Default value: getvar('python::params::group')

##### `index`

Expand Down
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# @param provider What provider to use for installation of the packages, except gunicorn and Python itself.
# @param use_epel to determine if the epel class is used.
# @param manage_scl Whether to manage core SCL packages or not.
# @param umask The default umask for invoked exec calls.
#
# @example install python from system python
# class { 'python':
Expand Down Expand Up @@ -55,6 +56,7 @@
Stdlib::Httpurl $anaconda_installer_url = $python::params::anaconda_installer_url,
Stdlib::Absolutepath $anaconda_install_path = $python::params::anaconda_install_path,
Boolean $manage_scl = $python::params::manage_scl,
Optional[Pattern[/[0-7]{1,4}/]] $umask = undef,
) inherits python::params {

$exec_prefix = $provider ? {
Expand All @@ -80,6 +82,11 @@
-> class { 'python::config': }
-> anchor { 'python::end': }

# Set default umask.
if $umask != undef {
Exec { umask => $umask }
}

# Allow hiera configuration of python resources
create_resources('python::pip', $python_pips)
create_resources('python::pyvenv', $python_pyvenvs)
Expand Down

0 comments on commit 0350566

Please sign in to comment.