Skip to content

Commit 0350566

Browse files
author
Robert Vincent
committed
486 Set permissive umask.
1 parent 7999862 commit 0350566

2 files changed

Lines changed: 66 additions & 23 deletions

File tree

REFERENCE.md

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
_Public Classes_
99

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

1213
_Private Classes_
1314

@@ -44,7 +45,7 @@ class { 'python':
4445
}
4546
```
4647

47-
##### install python3 from scl report
48+
##### install python3 from scl repo
4849

4950
```puppet
5051
class { 'python' :
@@ -138,6 +139,22 @@ to determine if the epel class is used.
138139

139140
Default value: $python::params::use_epel
140141

142+
##### `manage_scl`
143+
144+
Data type: `Boolean`
145+
146+
Whether to manage core SCL packages or not.
147+
148+
Default value: $python::params::manage_scl
149+
150+
##### `umask`
151+
152+
Data type: `Optional[Pattern[/[0-7]{1,4}/]]`
153+
154+
The default umask for invoked exec calls.
155+
156+
Default value: `undef`
157+
141158
##### `gunicorn_package_name`
142159

143160
Data type: `Any`
@@ -218,6 +235,40 @@ Data type: `Stdlib::Absolutepath`
218235

219236
Default value: $python::params::anaconda_install_path
220237

238+
### python::pip::bootstrap
239+
240+
allow to bootstrap pip when python is managed from other module
241+
242+
#### Examples
243+
244+
#####
245+
246+
```puppet
247+
class { 'python::pip::bootstrap':
248+
version => 'pip',
249+
}
250+
```
251+
252+
#### Parameters
253+
254+
The following parameters are available in the `python::pip::bootstrap` class.
255+
256+
##### `version`
257+
258+
Data type: `Enum['pip', 'pip3']`
259+
260+
should be pip or pip3
261+
262+
Default value: 'pip'
263+
264+
##### `manage_python`
265+
266+
Data type: `Variant[Boolean, String]`
267+
268+
if python module will manage deps
269+
270+
Default value: `false`
271+
221272
## Defined types
222273

223274
### python::dotfile
@@ -256,15 +307,15 @@ Default value: 'present'
256307

257308
##### `filename`
258309

259-
Data type: `Stdlib::Filemode`
310+
Data type: `String[1]`
260311

261312
Filename.
262313

263314
Default value: $title
264315

265316
##### `mode`
266317

267-
Data type: `String[1]`
318+
Data type: `Stdlib::Filemode`
268319

269320
File mode.
270321

@@ -365,12 +416,10 @@ Default value: 'wsgi'
365416

366417
##### `dir`
367418

368-
Data type: `Any`
419+
Data type: `Stdlib::Absolutepath`
369420

370421
Application directory.
371422

372-
Default value: `false`
373-
374423
##### `bind`
375424

376425
Data type: `Any`
@@ -479,7 +528,7 @@ Default value: `false`
479528

480529
##### `log_level`
481530

482-
Data type: `Any`
531+
Data type: `Enum['debug', 'info', 'warning', 'error', 'critical']`
483532

484533

485534

@@ -529,19 +578,6 @@ python::pip { 'requests' :
529578
}
530579
```
531580

532-
##### Install Requests with pip module
533-
534-
```puppet
535-
python::pip { 'requests' :
536-
ensure => 'present',
537-
pkgname => 'requests',
538-
pip_provider => 'python3 -m pip',
539-
virtualenv => '/var/www/project1',
540-
owner => 'root',
541-
timeout => 1800
542-
}
543-
```
544-
545581
#### Parameters
546582

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

569605
##### `virtualenv`
570606

571-
Data type: `String`
607+
Data type: `Variant[Enum['system'], Stdlib::Absolutepath]`
572608

573609
virtualenv to run pip in.
574610

@@ -600,11 +636,11 @@ Default value: 'root'
600636

601637
##### `group`
602638

603-
Data type: `String[1]`
639+
Data type: `Any`
604640

605641
The group of the virtualenv being manipulated.
606642

607-
Default value: 'root'
643+
Default value: getvar('python::params::group')
608644

609645
##### `index`
610646

manifests/init.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# @param provider What provider to use for installation of the packages, except gunicorn and Python itself.
1818
# @param use_epel to determine if the epel class is used.
1919
# @param manage_scl Whether to manage core SCL packages or not.
20+
# @param umask The default umask for invoked exec calls.
2021
#
2122
# @example install python from system python
2223
# class { 'python':
@@ -55,6 +56,7 @@
5556
Stdlib::Httpurl $anaconda_installer_url = $python::params::anaconda_installer_url,
5657
Stdlib::Absolutepath $anaconda_install_path = $python::params::anaconda_install_path,
5758
Boolean $manage_scl = $python::params::manage_scl,
59+
Optional[Pattern[/[0-7]{1,4}/]] $umask = undef,
5860
) inherits python::params {
5961

6062
$exec_prefix = $provider ? {
@@ -80,6 +82,11 @@
8082
-> class { 'python::config': }
8183
-> anchor { 'python::end': }
8284

85+
# Set default umask.
86+
if $umask != undef {
87+
Exec { umask => $umask }
88+
}
89+
8390
# Allow hiera configuration of python resources
8491
create_resources('python::pip', $python_pips)
8592
create_resources('python::pyvenv', $python_pyvenvs)

0 commit comments

Comments
 (0)