Showing with 31 additions and 11 deletions.
  1. +8 −2 Gemfile
  2. +2 −1 Rakefile
  3. +1 −1 lib/facter/python_version.rb
  4. +1 −0 manifests/gunicorn.pp
  5. +1 −0 manifests/init.pp
  6. +3 −2 manifests/install.pp
  7. +6 −0 manifests/params.pp
  8. +3 −3 manifests/pip.pp
  9. +1 −1 metadata.json
  10. +5 −1 templates/gunicorn.erb
10 changes: 8 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :test do
gem 'metadata-json-lint', :require => false
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
end

# rspec must be v2 for ruby 1.8.7
# pin old versions for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
gem 'rspec', '~> 2.0'
gem 'rake', '~> 10.0'
else
gem 'rake', :require => false
end

if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '2.0'
gem 'json', '~> 1.0'
end

if facterversion = ENV['FACTER_GEM_VERSION']
Expand Down
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ end
PuppetLint.configuration.fail_on_warnings
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_documentation')
Expand All @@ -36,4 +37,4 @@ task :test => [
:syntax,
:lint,
:spec,
]
]
2 changes: 1 addition & 1 deletion lib/facter/python_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

def get_python_version(executable)
if Facter::Util::Resolution.which(executable)
results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+\.\d+)$/)
results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+\.\d+\+?)$/)
if results
results[1]
end
Expand Down
1 change: 1 addition & 0 deletions manifests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
$appmodule = 'app:app',
$osenv = false,
$timeout = 30,
$workers = false,
$access_log_format = false,
$accesslog = false,
$errorlog = false,
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
$virtualenv = $python::params::virtualenv,
$gunicorn = $python::params::gunicorn,
$manage_gunicorn = $python::params::manage_gunicorn,
$gunicorn_package_name = $python::params::gunicorn_package_name,
$provider = $python::params::provider,
$valid_versions = $python::params::valid_versions,
$python_pips = { },
Expand Down
5 changes: 3 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$python = $::python::version ? {
'system' => 'python',
'pypy' => 'pypy',
default => "python${python::version}",
default => "${python::version}",
}

$pythondev = $::osfamily ? {
Expand Down Expand Up @@ -103,7 +103,7 @@
default => 'absent',
}

package { 'centos-release-SCL':
package { 'centos-release-scl':
ensure => $install_scl_repo_package,
before => Package['scl-utils'],
}
Expand Down Expand Up @@ -219,6 +219,7 @@
}

package { 'gunicorn':
name => $python::gunicorn_package_name,
ensure => $gunicorn_ensure,
}
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@
'Suse' => [],
}
$use_epel = true

$gunicorn_package_name = $::osfamily ? {
'RedHat' => 'python-gunicorn',
default => 'gunicorn',
}

}
6 changes: 3 additions & 3 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@

$python_provider = getparam(Class['python'], 'provider')
$python_version = getparam(Class['python'], 'version')

# Get SCL exec prefix
# NB: this will not work if you are running puppet from scl enabled shell
$exec_prefix = $python_provider ? {
'scl' => "scl enable ${python_version} -- ",
'rhscl' => "scl enable ${python_version} -- ",
default => '',
}

# Parameter validation
if ! $virtualenv {
fail('python::pip: virtualenv parameter must not be empty')
Expand All @@ -117,7 +117,7 @@

$pip_env = $virtualenv ? {
'system' => "${exec_prefix}pip",
default => "${virtualenv}/bin/pip",
default => "${exec_prefix}${virtualenv}/bin/pip",
}

$pypi_index = $index ? {
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stankevich-python",
"version": "1.12.0",
"version": "1.13.0",
"author": "stankevich",
"summary": "Python Module",
"license": "Apache-2.0",
Expand Down
6 changes: 5 additions & 1 deletion templates/gunicorn.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ CONFIG = {
<% else -%>
'--bind=<%= @bind %>',
<% end -%>
'--workers=<%= @processorcount.to_i*2 %>',
<% if @workers -%>
'--workers=<%= @workers %>',
<% else -%>
'--workers=<%= @processorcount.to_i*2 + 1 %>',
<% end -%>
'--timeout=<%= @timeout %>',
<% if @access_log_format -%>
'--access-logformat=<%= @access_log_format %>',
Expand Down