diff --git a/REFERENCE.md b/REFERENCE.md index 3bb30293..d08c17ac 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -28,10 +28,10 @@ ### Data types -* [`Python::Loglevel`](#pythonloglevel): A version type to match all valid versions for python -* [`Python::Package::Ensure`](#pythonpackageensure): A version type to match all valid versions for python -* [`Python::Provider`](#pythonprovider): A version type to match all valid versions for python -* [`Python::Umask`](#pythonumask): A version type to match all valid versions for python +* [`Python::Loglevel`](#pythonloglevel): A version type to match all valid loglevels for python +* [`Python::Package::Ensure`](#pythonpackageensure): A version type to match all valid package ensures for python +* [`Python::Provider`](#pythonprovider): A version type to match all valid provider for python +* [`Python::Umask`](#pythonumask): A version type to match valid umask for python * [`Python::Version`](#pythonversion): A version type to match all valid versions for python ## Classes @@ -433,7 +433,7 @@ Default value: `'/etc/gunicorn.d'` ##### `manage_config_dir` -Data type: `Booloean` +Data type: `Boolean` Set if the gunicorn config directory should be created. @@ -872,7 +872,7 @@ Data type: `Array[Stdlib::Absolutepath]` Specifies the PATH variable. -Default value: `[ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin', ]` +Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` ##### `environment` @@ -977,7 +977,7 @@ Default value: ``false`` ##### `cwd` -Data type: `Stdlib::Absolutepath` +Data type: `Optional[Stdlib::Absolutepath]` The directory from which to run the "pip install" command. @@ -1156,7 +1156,7 @@ Data type: `Array[Stdlib::Absolutepath]` Specifies the PATH variable -Default value: `[ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin', ]` +Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` ##### `cwd` @@ -1202,25 +1202,25 @@ Default value: ``undef`` ### `Python::Loglevel` -A version type to match all valid versions for python +A version type to match all valid loglevels for python Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']` ### `Python::Package::Ensure` -A version type to match all valid versions for python +A version type to match all valid package ensures for python Alias of `Enum['absent', 'present', 'latest']` ### `Python::Provider` -A version type to match all valid versions for python +A version type to match all valid provider for python Alias of `Enum['pip', 'scl', 'rhscl', 'anaconda', '']` ### `Python::Umask` -A version type to match all valid versions for python +A version type to match valid umask for python Alias of `Pattern[/[0-7]{1,4}/]` diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 836e9097..9d245be3 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -10,7 +10,7 @@ # @param src Pip --src parameter to; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. # @param environment Additional environment variables required to install the packages. # @param forceupdate Run a pip install requirements even if we don't receive an event from the requirements file - Useful for when the requirements file is written as part of a resource other than file (E.g vcsrepo) -# @param cwd The directory from which to run the "pip install" command. +# @param cwd The directory from which to run the "pip install" command. # @param extra_pip_args Extra arguments to pass to pip after the requirements file # @param manage_requirements Create the requirements file if it doesn't exist. # @param fix_requirements_owner Change owner and group of requirements file. @@ -35,7 +35,7 @@ Any $src = false, Array $environment = [], Boolean $forceupdate = false, - Stdlib::Absolutepath $cwd = undef, + Optional[Stdlib::Absolutepath] $cwd = undef, String $extra_pip_args = '', Boolean $manage_requirements = true, Boolean $fix_requirements_owner = true, diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 97858b7d..84204a43 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -2,7 +2,6 @@ describe 'python::requirements', type: :define do on_supported_os.each do |os, facts| - next if os == 'gentoo-3-x86_64' context "on #{os}" do let :facts do facts @@ -15,8 +14,7 @@ context 'with /requirements.txt' do let :params do { - requirements: '/requirements.txt', - cwd: '/foo' + requirements: '/requirements.txt' } end @@ -35,8 +33,7 @@ let :params do { owner: 'bob', - group: 'bob', - cwd: '/foo' + group: 'bob' } end @@ -44,17 +41,24 @@ end end - context 'default' do - let :params do - { - 'cwd': '/foo' - } - end + context 'without parameters' do + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('python::config') } + it { is_expected.to contain_class('python::install') } + it { is_expected.to contain_class('python::params') } + it { is_expected.to contain_class('python') } + it { is_expected.to contain_exec('python_requirements/requirements.txt') } + it { is_expected.to contain_package('pip') } + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('gunicorn') } it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } - end - describe 'without cwd' do - it { is_expected.to compile.and_raise_error(%r{parameter 'cwd' expects a Stdlib::Absolutepath}) } + if facts[:os]['name'] == 'Gentoo' + it { is_expected.not_to contain_package('python-dev') } + else + it { is_expected.to contain_package('python-dev') } + end end end end