From 13a3e8351c7c89e9fb7ccb854cfe9c9aff443d64 Mon Sep 17 00:00:00 2001 From: dannygoulder Date: Tue, 4 Oct 2016 16:27:18 +0400 Subject: [PATCH 001/380] add an alias to the python-dev package Allow other packages that require python-devel (e.g. on suse, redhat) to find the package in the catalog --- manifests/install.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/install.pp b/manifests/install.pp index 57d50735..0108c55e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -178,6 +178,7 @@ package { 'python-dev': ensure => $dev_ensure, name => $pythondev, + alias => $pythondev, } if $::osfamily == 'RedHat' { From 58d5cb23fcf4fa11e641ba8204f164a5c6bfa043 Mon Sep 17 00:00:00 2001 From: dannygoulder Date: Tue, 4 Oct 2016 20:49:29 +0400 Subject: [PATCH 002/380] Make proper indentation :) --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 0108c55e..2552c3b4 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -178,7 +178,7 @@ package { 'python-dev': ensure => $dev_ensure, name => $pythondev, - alias => $pythondev, + alias => $pythondev, } if $::osfamily == 'RedHat' { From a10f9c4bb4f985586df910c5becdfe094789d858 Mon Sep 17 00:00:00 2001 From: Daniel James Goulder Date: Sun, 9 Oct 2016 22:27:55 +0400 Subject: [PATCH 003/380] add alias to spec tests --- spec/classes/python_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index f494c33e..a7740e09 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -108,6 +108,7 @@ # Base debian packages. it { is_expected.to contain_package("python") } it { is_expected.to contain_package("python-dev").with_name("python-devel") } + it { is_expected.to contain_package("python-dev").with_alias("python-devel") } it { is_expected.to contain_package("pip") } # Basic python packages (from pip) it { is_expected.to contain_package("virtualenv")} From 4159db4a4aaba75be7caf3e2c32b9ef82777a6ec Mon Sep 17 00:00:00 2001 From: Daniel James Goulder Date: Mon, 10 Oct 2016 00:25:17 +0400 Subject: [PATCH 004/380] refactor rspec tests to use rspec-puppet-facts --- Gemfile | 1 + spec/classes/python_spec.rb | 335 +++++++++--------------------------- spec/spec_helper.rb | 8 + 3 files changed, 88 insertions(+), 256 deletions(-) diff --git a/Gemfile b/Gemfile index 2918dfec..a9e07d4a 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ group :development, :test do gem 'puppet-lint', :require => false gem 'pry', :require => false gem 'simplecov', :require => false + gem 'rspec-puppet-facts', :require => false end # pin old versions for ruby 1.8.7 diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index a7740e09..5b4449ea 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,276 +1,99 @@ require 'spec_helper' describe 'python', :type => :class do - context "on Debian OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', - } - end - - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev") } - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end - - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} - - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => true }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } - end + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + + it { is_expected.to contain_class("python::install") } + # Base debian packages. + it { is_expected.to contain_package("python") } + case facts[:osfamily] + when 'Debian' + it { is_expected.to contain_package("python-dev").with_alias("python-dev") } + when 'RedHat', 'Suse' + it { is_expected.to contain_package("python-dev").with_name("python-devel") } + it { is_expected.to contain_package("python-dev").with_alias("python-devel") } + end + + it { is_expected.to contain_package("pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } end - - describe "without python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } - end + context "empty/default" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end - end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - end - - context "on a Redhat 5 OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :osfamily => 'RedHat', - :operatingsystem => 'RedHat', - :operatingsystemrelease => '5', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev").with_name("python-devel") } - it { is_expected.to contain_package("python-dev").with_alias("python-devel") } - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end - - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} - - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => 'present' }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } - end + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } end - - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } - end + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} end - end - end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - end - - context "on a SLES 11 SP3" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => nil, - :osfamily => 'Suse', - :operatingsystem => 'SLES', - :operatingsystemrelease => '11.3', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - # Base Suse packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev").with_name("python-devel") } - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} end - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} + it { is_expected.to contain_package("virtualenv").with( + 'provider' => 'pip' + )} + it { is_expected.to contain_package("pip").with( + 'provider' => 'pip' + )} + end - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => 'present' }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv")} + it { is_expected.to contain_package("pip")} + + describe "with python::virtualenv" do + context "true" do + case facts[:osfamily] + when 'Debian' + let (:params) {{ :provider => '', :virtualenv => true }} + when 'RedHat', 'Suse' + let (:params) {{ :provider => '', :virtualenv => 'present' }} + end + it { is_expected.to contain_package("virtualenv").with_ensure('present') } + end end - end - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + case facts[:osfamily] + when 'Debian' + describe "without python::virtualenv" do + context "default/empty" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + end + end + when 'RedHat', 'Suse' + describe "with python::virtualenv" do + context "default/empty" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + end + end end end end end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2c6f5664..63b82eaf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1 +1,9 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts +add_custom_fact :id, 'root' +add_custom_fact :kernel, 'Linux' +add_custom_fact :concat_basedir, '/dne' +add_custom_fact :path, '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' +add_custom_fact :lsbdistcodename, 'squeeze', :confine => 'debian-6-x86_64' +add_custom_fact :lsbdistcodename, 'nil', :confine => 'sles-11.3-x86_64' From 6eda9eefdc21289ed80bf8ed49bb9b4956f8e458 Mon Sep 17 00:00:00 2001 From: Chao Zhang Date: Thu, 8 Dec 2016 12:35:10 +0100 Subject: [PATCH 005/380] Allow hiera config for dotfiles --- README.md | 6 ++++++ manifests/init.pp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 36ecec4e..cdbb98e3 100644 --- a/README.md +++ b/README.md @@ -302,6 +302,12 @@ python::python_pips: virtualenv: "/opt/env1" "coverage": virtualenv: "/opt/env2" +python::python_dotfiles: + "/var/lib/jenkins/.pip/pip.conf": + config: + global: + index-url: "https://mypypi.acme.com/simple/" + extra-index-url: "https://pypi.risedev.at/simple/" ``` ### Using SCL packages from RedHat or CentOS diff --git a/manifests/init.pp b/manifests/init.pp index 8b3caf30..6a973097 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -81,6 +81,7 @@ $python_virtualenvs = { }, $python_pyvenvs = { }, $python_requirements = { }, + $python_dotfiles = { }, $use_epel = $python::params::use_epel, $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, ) inherits python::params{ @@ -123,6 +124,7 @@ validate_re($gunicorn, ['^(absent|present|latest)$']) } + validate_hash($python_dotfiles) validate_bool($manage_gunicorn) validate_bool($use_epel) @@ -143,5 +145,6 @@ create_resources('python::pyvenv', $python_pyvenvs) create_resources('python::virtualenv', $python_virtualenvs) create_resources('python::requirements', $python_requirements) + create_resources('python::dotfile', $python_dotfiles) } From 046097a6ef3308102e5d1084328e7e5da57cc8a2 Mon Sep 17 00:00:00 2001 From: Pat Riehecky Date: Fri, 23 Dec 2016 09:39:04 -0600 Subject: [PATCH 006/380] Add python release as available facts --- lib/facter/python_release.rb | 33 +++++++++ spec/unit/facter/python_release_spec.rb | 98 +++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 lib/facter/python_release.rb create mode 100644 spec/unit/facter/python_release_spec.rb diff --git a/lib/facter/python_release.rb b/lib/facter/python_release.rb new file mode 100644 index 00000000..348549c1 --- /dev/null +++ b/lib/facter/python_release.rb @@ -0,0 +1,33 @@ +# Make python release available as facts + +def get_python_release(executable) + if Facter::Util::Resolution.which(executable) + results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+)\.\d+\+?$/) + if results + results[1] + end + end +end + +Facter.add("python_release") do + setcode do + get_python_release 'python' + end +end + +Facter.add("python2_release") do + setcode do + default_release = get_python_release 'python' + if default_release.nil? or !default_release.start_with?('2') + get_python_release 'python2' + else + default_release + end + end +end + +Facter.add("python3_release") do + setcode do + get_python_release 'python3' + end +end diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb new file mode 100644 index 00000000..dc6895a4 --- /dev/null +++ b/spec/unit/facter/python_release_spec.rb @@ -0,0 +1,98 @@ +require "spec_helper" + +describe Facter::Util::Fact do + before { + Facter.clear + } + + let(:python2_version_output) { <<-EOS +Python 2.7.9 +EOS + } + let(:python3_version_output) { <<-EOS +Python 3.3.0 +EOS + } + + describe "python_release" do + context 'returns Python release when `python` present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(true) + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) + expect(Facter.value(:python_release)).to eq("2.7") + end + end + + context 'returns nil when `python` not present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(false) + expect(Facter.value(:python_release)).to eq(nil) + end + end + + end + + describe "python2_release" do + context 'returns Python 2 release when `python` is present and Python 2' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(true) + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) + expect(Facter.value(:python2_release)).to eq('2.7') + end + end + + context 'returns Python 2 release when `python` is Python 3 and `python2` is present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(true) + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with("python2").returns(true) + Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) + expect(Facter.value(:python2_release)).to eq('2.7') + end + end + + context 'returns nil when `python` is Python 3 and `python2` is absent' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(true) + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with("python2").returns(false) + expect(Facter.value(:python2_release)).to eq(nil) + end + end + + context 'returns nil when `python2` and `python` are absent' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python").returns(false) + Facter::Util::Resolution.expects(:which).with("python2").returns(false) + expect(Facter.value(:python2_release)).to eq(nil) + end + end + + end + + describe "python3_release" do + context 'returns Python 3 release when `python3` present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python3").returns(true) + Facter::Util::Resolution.expects(:exec).with("python3 -V 2>&1").returns(python3_version_output) + expect(Facter.value(:python3_release)).to eq("3.3") + end + end + + context 'returns nil when `python3` not present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with("python3").returns(false) + expect(Facter.value(:python3_release)).to eq(nil) + end + end + + end +end From 63a46bbc068f0a691033a1051fb8c3565a12422b Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:02:29 -0400 Subject: [PATCH 007/380] Support latest Puppet v3 and last five releases of Puppet v4 Use actual versions of ruby that are supported, so 2.1.9 instead of 2.1.0 and remove 2.3.1 as it never made it into Puppet v4. --- .travis.yml | 89 ++++++++++------------------------------------------- Gemfile | 12 +++++--- README.md | 13 ++++---- 3 files changed, 31 insertions(+), 83 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef9dcf18..eab11e1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,90 +11,33 @@ before_install: - gem --version - bundle -v -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 - - 2.1.0 - - 2.3.1 - -env: - matrix: - - PUPPET_GEM_VERSION="~> 3.1.0" - - PUPPET_GEM_VERSION="~> 3.2.0" - - PUPPET_GEM_VERSION="~> 3.3.0" - - PUPPET_GEM_VERSION="~> 3.4.0" - - PUPPET_GEM_VERSION="~> 3.5.0" - - PUPPET_GEM_VERSION="~> 3.6.0" - - PUPPET_GEM_VERSION="~> 3.7.0" - - PUPPET_GEM_VERSION="~> 3.8.0" - - PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - PUPPET_GEM_VERSION="~> 4.0.0" - - PUPPET_GEM_VERSION="~> 4.1.0" - - PUPPET_GEM_VERSION="~> 4.2.0" - - PUPPET_GEM_VERSION="~> 4.3.0" - - PUPPET_GEM_VERSION="~> 4.4.0" - - PUPPET_GEM_VERSION="~> 4.5.0" - - PUPPET_GEM_VERSION="~> 4.6.0" - - PUPPET_GEM_VERSION="~> 4.7.0" - - PUPPET_GEM_VERSION="~> 4.8.0" - - PUPPET_GEM_VERSION="~> 4" - sudo: false script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec' matrix: fast_finish: true - exclude: - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.2.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.3.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.0.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.1.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.2.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.3.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.4.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.5.0" + include: - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.6.0" - - rvm: 1.8.7 + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.7.0" - - rvm: 1.8.7 + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.8.0" - - rvm: 1.8.7 + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 4.9.0" + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 4.10.0" + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.2.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.3.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.5.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.6.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.7.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.8.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" notifications: email: false diff --git a/Gemfile b/Gemfile index 898be012..c417fd3d 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,7 @@ else gem 'facter', :require => false end -gem 'puppetlabs_spec_helper', '>= 1.2.0', :require => false -gem 'rspec-puppet', :require => false +gem 'rspec-puppet', '~> 2.0', :require => false gem 'puppet-lint', '~> 2.0', :require => false gem 'simplecov', :require => false @@ -27,7 +26,12 @@ gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0' gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' -gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9' -gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9' +gem 'metadata-json-lint', '0.0.11' if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' +gem 'metadata-json-lint', '1.0.0' if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.0' +gem 'metadata-json-lint' if RUBY_VERSION >= '2.0' + +gem 'puppetlabs_spec_helper', '2.0.2', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' +gem 'puppetlabs_spec_helper', '>= 2.0.0', :require => false if RUBY_VERSION >= '1.9' +gem 'parallel_tests', '<= 2.9.0', :require => false if RUBY_VERSION < '2.0.0' # vim:ft=ruby diff --git a/README.md b/README.md index 36ecec4e..802e79f4 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,17 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn # Compatibility # -* Puppet v3 (with and without the future parser) +See `.travis.yml` for compatibility matrix. + +* Puppet v3 (with the future parser) * Puppet v4 ## Ruby versions -* 1.8.7 -* 1.9.3 -* 2.0.0 -* 2.1.0 -* 2.3.1 +* 1.8.7 - Puppet 3 +* 1.9.3 - Puppet 3 +* 2.0.0 - Puppet 3 +* 2.1.9 - Puppet 3 & 4 ## OS Distributions ## From adf6b371bf9f1fd96329940ee1483f925353b884 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:03:43 -0400 Subject: [PATCH 008/380] Comply with style --- manifests/init.pp | 8 ++++---- manifests/install.pp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8b3caf30..a4e22236 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -133,10 +133,10 @@ } # Anchor pattern to contain dependencies - anchor { 'python::begin': } -> - class { 'python::install': } -> - class { 'python::config': } -> - anchor { 'python::end': } + anchor { 'python::begin': } + -> class { 'python::install': } + -> class { 'python::config': } + -> anchor { 'python::end': } # Allow hiera configuration of python resources create_resources('python::pip', $python_pips) diff --git a/manifests/install.pp b/manifests/install.pp index afe17dac..72da81de 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -164,12 +164,12 @@ } if $::python::rhscl_use_public_repository { - Package <| tag == 'python-scl-repo' |> -> - Package <| tag == 'python-scl-package' |> + Package <| tag == 'python-scl-repo' |> + -> Package <| tag == 'python-scl-package' |> } - Package <| tag == 'python-scl-package' |> -> - Package <| tag == 'python-pip-package' |> + Package <| tag == 'python-scl-package' |> + -> Package <| tag == 'python-pip-package' |> } default: { From 0c963e324784ebdb825ccecf5928ab60458287d2 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:09:19 -0400 Subject: [PATCH 009/380] Fix failing spec tests --- spec/defines/pip_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index e03fd7f1..56216c59 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -34,11 +34,11 @@ describe "proxy as" do context "defaults to empty" do let (:params) {{ }} - it { is_expected.to contain_exec("pip_install_rpyc").without_command(/--proxy/) } + it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } end context "does not add proxy to search command if set to latest and proxy is unset" do let (:params) {{ :ensure => 'latest' }} - it { is_expected.to contain_exec("pip_install_rpyc").without_command(/--proxy/) } + it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } it { is_expected.to contain_exec("pip_install_rpyc").without_unless(/--proxy/) } end context "adds proxy to install command if proxy set" do @@ -55,7 +55,7 @@ describe 'index as' do context 'defaults to empty' do let (:params) {{ }} - it { is_expected.to contain_exec('pip_install_rpyc').without_command(/--index-url/) } + it { should_not contain_exec('pip_install_rpyc').with_command(/--index-url/) } end context 'adds index to install command if index set' do let (:params) {{ :index => 'http://www.example.com/simple/' }} From 70dabffd128fffd44e83c42f45c0a10b7b8b26a9 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:19:02 -0400 Subject: [PATCH 010/380] Validate ruby files under spec/ --- Rakefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 28d00a1e..abf2783b 100644 --- a/Rakefile +++ b/Rakefile @@ -17,7 +17,6 @@ PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_class_parameter_defaults') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] exclude_paths = [ "pkg/**/*", @@ -27,6 +26,13 @@ exclude_paths = [ PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths +desc 'Validate manifests, templates, ruby files and shell scripts' +task :validate do + Dir['spec/**/*.rb'].each do |ruby_file| + sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ + end +end + desc "Run acceptance tests" RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' From f9469b3f4b57ea1b8ff274c6aa4ea06c44eaa000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Becker?= Date: Fri, 29 Sep 2017 13:26:04 +0200 Subject: [PATCH 011/380] Update gunicorn.pp - Add manage_config_dir Some packages doesn't create /etc/gunicorn.d. When manage_config_dir is set to true it will create the config folder. --- manifests/gunicorn.pp | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index b943e332..bc996e6e 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -7,6 +7,12 @@ # [*ensure*] # present|absent. Default: present # +# [*config_dir*] +# Configure the gunicorn config directory path. Default: /etc/gunicorn.d +# +# [*manage_config_dir*] +# Set if the gunicorn config directory should be created. Default: false +# # [*virtualenv*] # Run in virtualenv, specify directory. Default: disabled # @@ -70,6 +76,8 @@ # define python::gunicorn ( $ensure = present, + $config_dir = '/etc/gunicorn.d', + $manage_config_dir = false, $virtualenv = false, $mode = 'wsgi', $dir = false, @@ -96,12 +104,29 @@ validate_re($log_level, 'debug|info|warning|error|critical', "Invalid \$log_level value ${log_level}") - file { "/etc/gunicorn.d/${name}": - ensure => $ensure, - mode => '0644', - owner => 'root', - group => 'root', - content => template($template), + if $manage_config_dir { + file { $config_dir: + ensure => directory, + mode => '0755', + owner => 'root', + group => 'root', + } + file { "${config_dir}/${name}": + ensure => $ensure, + mode => '0644', + owner => 'root', + group => 'root', + content => template($template), + require => File[$config_dir], + } + } else { + file { "${config_dir}/${name}": + ensure => $ensure, + mode => '0644', + owner => 'root', + group => 'root', + content => template($template), + } } } From ffaa5724a68004c3ec6e224f8fb81bccd5e3d451 Mon Sep 17 00:00:00 2001 From: Daniel James Goulder Date: Sat, 27 Jan 2018 20:59:03 +0400 Subject: [PATCH 012/380] Revert "refactor rspec tests to use rspec-puppet-facts" This reverts commit 4159db4a4aaba75be7caf3e2c32b9ef82777a6ec. --- Gemfile | 1 - spec/classes/python_spec.rb | 335 +++++++++++++++++++++++++++--------- spec/spec_helper.rb | 8 - 3 files changed, 256 insertions(+), 88 deletions(-) diff --git a/Gemfile b/Gemfile index a9e07d4a..2918dfec 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,6 @@ group :development, :test do gem 'puppet-lint', :require => false gem 'pry', :require => false gem 'simplecov', :require => false - gem 'rspec-puppet-facts', :require => false end # pin old versions for ruby 1.8.7 diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 5b4449ea..a7740e09 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,99 +1,276 @@ require 'spec_helper' describe 'python', :type => :class do - on_supported_os.each do |os, facts| - context "on #{os}" do - let :facts do - facts - end - - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - case facts[:osfamily] - when 'Debian' - it { is_expected.to contain_package("python-dev").with_alias("python-dev") } - when 'RedHat', 'Suse' - it { is_expected.to contain_package("python-dev").with_name("python-devel") } - it { is_expected.to contain_package("python-dev").with_alias("python-devel") } - end - - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } + context "on Debian OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + } + end + + it { is_expected.to contain_class("python::install") } + # Base debian packages. + it { is_expected.to contain_package("python") } + it { is_expected.to contain_package("python-dev") } + it { is_expected.to contain_package("pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "empty/default" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end + + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } + end + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} + end + end + + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} + it { is_expected.to contain_package("virtualenv").with( + 'provider' => 'pip' + )} + it { is_expected.to contain_package("pip").with( + 'provider' => 'pip' + )} + end + + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv")} + it { is_expected.to contain_package("pip")} + + describe "with python::virtualenv" do + context "true" do + let (:params) {{ :provider => '', :virtualenv => true }} + it { is_expected.to contain_package("virtualenv").with_ensure('present') } + end end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } + + describe "without python::virtualenv" do + context "default/empty" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + end end end + end - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "default/empty" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end + end + + context "on a Redhat 5 OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemrelease => '5', + :concat_basedir => '/dne', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + it { is_expected.to contain_class("python::install") } + # Base debian packages. + it { is_expected.to contain_package("python") } + it { is_expected.to contain_package("python-dev").with_name("python-devel") } + it { is_expected.to contain_package("python-dev").with_alias("python-devel") } + it { is_expected.to contain_package("pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "empty/default" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end + + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } + end + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} + end + end + + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} + + it { is_expected.to contain_package("virtualenv").with( + 'provider' => 'pip' + )} + it { is_expected.to contain_package("pip").with( + 'provider' => 'pip' + )} + end + + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv")} + it { is_expected.to contain_package("pip")} + + describe "with python::virtualenv" do + context "true" do + let (:params) {{ :provider => '', :virtualenv => 'present' }} + it { is_expected.to contain_package("virtualenv").with_ensure('present') } + end end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} + + describe "with python::virtualenv" do + context "default/empty" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + end end end + end - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "default/empty" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end + end + + context "on a SLES 11 SP3" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => nil, + :osfamily => 'Suse', + :operatingsystem => 'SLES', + :operatingsystemrelease => '11.3', + :concat_basedir => '/dne', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + it { is_expected.to contain_class("python::install") } + # Base Suse packages. + it { is_expected.to contain_package("python") } + it { is_expected.to contain_package("python-dev").with_name("python-devel") } + it { is_expected.to contain_package("pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "empty/default" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end + + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } + end + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} + end + end + + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} - - describe "with python::virtualenv" do - context "true" do - case facts[:osfamily] - when 'Debian' - let (:params) {{ :provider => '', :virtualenv => true }} - when 'RedHat', 'Suse' - let (:params) {{ :provider => '', :virtualenv => 'present' }} - end - it { is_expected.to contain_package("virtualenv").with_ensure('present') } - end + it { is_expected.to contain_package("virtualenv").with( + 'provider' => 'pip' + )} + it { is_expected.to contain_package("pip").with( + 'provider' => 'pip' + )} + end + + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv")} + it { is_expected.to contain_package("pip")} + + describe "with python::virtualenv" do + context "true" do + let (:params) {{ :provider => '', :virtualenv => 'present' }} + it { is_expected.to contain_package("virtualenv").with_ensure('present') } end + end - case facts[:osfamily] - when 'Debian' - describe "without python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } - end - end - when 'RedHat', 'Suse' - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } - end - end + describe "with python::virtualenv" do + context "default/empty" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("virtualenv").with_ensure('absent') } end end end end + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => 'present' }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } + end + context "default/empty" do + it { is_expected.to contain_package("python-dev").with_ensure('absent') } + end + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 63b82eaf..2c6f5664 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1 @@ require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -include RspecPuppetFacts -add_custom_fact :id, 'root' -add_custom_fact :kernel, 'Linux' -add_custom_fact :concat_basedir, '/dne' -add_custom_fact :path, '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -add_custom_fact :lsbdistcodename, 'squeeze', :confine => 'debian-6-x86_64' -add_custom_fact :lsbdistcodename, 'nil', :confine => 'sles-11.3-x86_64' From c08aa2851585c8c530eccc430bbebd40faf2a4df Mon Sep 17 00:00:00 2001 From: Daniel James Goulder Date: Sat, 27 Jan 2018 21:08:23 +0400 Subject: [PATCH 013/380] add alias for suse --- spec/classes/python_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 134f5fe1..1ec0de42 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -268,6 +268,7 @@ # Base Suse packages. it { is_expected.to contain_package("python") } it { is_expected.to contain_package("python-dev").with_name("python-devel") } + it { is_expected.to contain_package("python-dev").with_alias("python-devel") } it { is_expected.to contain_package("pip") } # Basic python packages (from pip) it { is_expected.to contain_package("virtualenv")} From 053b1ad5789f3e257938d06eb6329fccc416fb6f Mon Sep 17 00:00:00 2001 From: Sergii Kipot Date: Wed, 18 Oct 2017 17:08:56 +0200 Subject: [PATCH 014/380] Set virtualenv package name for Debian stretch Signed-off-by: Sergii Kipot --- README.md | 1 + manifests/install.pp | 2 ++ metadata.json | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f39b855c..5c5b37cc 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ This module has been tested to work on the following systems. * Debian 6 * Debian 7 * Debian 8 +* Debian 9 * EL 5 * EL 6 * EL 7 diff --git a/manifests/install.pp b/manifests/install.pp index 72da81de..5f41a2de 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -203,6 +203,8 @@ } else { if $::lsbdistcodename == 'jessie' { $virtualenv_package = 'virtualenv' + } elsif $::lsbdistcodename == 'stretch' { + $virtualenv_package = 'virtualenv' } elsif $::osfamily == 'Gentoo' { $virtualenv_package = 'virtualenv' } else { diff --git a/metadata.json b/metadata.json index f1901292..2a01580b 100644 --- a/metadata.json +++ b/metadata.json @@ -28,7 +28,8 @@ "operatingsystemrelease": [ "6", "7", - "8" + "8", + "9" ] }, { From 56845bb502d1027ca55895a13fd958125e1b536c Mon Sep 17 00:00:00 2001 From: Jake Yip Date: Thu, 5 Apr 2018 14:56:17 +1000 Subject: [PATCH 015/380] Support virtualenv for Ubuntu 16.04 --- README.md | 1 + manifests/install.pp | 2 ++ metadata.json | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f39b855c..c99a29ff 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ This module has been tested to work on the following systems. * Ubuntu 10.04 * Ubuntu 12.04 * Ubuntu 14.04 +* Ubuntu 16.04 === diff --git a/manifests/install.pp b/manifests/install.pp index 72da81de..4ba16fe9 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -203,6 +203,8 @@ } else { if $::lsbdistcodename == 'jessie' { $virtualenv_package = 'virtualenv' + } elsif $::lsbdistcodename == 'xenial' { + $virtualenv_package = 'virtualenv' } elsif $::osfamily == 'Gentoo' { $virtualenv_package = 'virtualenv' } else { diff --git a/metadata.json b/metadata.json index f1901292..66eaf927 100644 --- a/metadata.json +++ b/metadata.json @@ -39,7 +39,8 @@ "operatingsystemrelease": [ "10.04", "12.04", - "14.04" + "14.04", + "16.04" ] }, { From cb7e56d7168ddeb812542f24da8aa3bdd06f0f80 Mon Sep 17 00:00:00 2001 From: Jake Yip Date: Mon, 9 Apr 2018 15:39:30 +1000 Subject: [PATCH 016/380] Fix tests: Pin rake for ruby 1.9.3 Rake >12.2.1 throws the following error: rake-12.3.1 requires ruby version >= 2.0.0, which is incompatible with the current version, ruby 1.9.3p551 --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index c417fd3d..0d7cc3a6 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,7 @@ gem 'simplecov', :require => false gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' +gem 'rake', '<= 12.2.1', :require => false if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.0.0' gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0' gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' gem 'metadata-json-lint', '0.0.11' if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' From 5bb75be63d6d3d2994a776d689eaa1e2878943bd Mon Sep 17 00:00:00 2001 From: Vadym Chepkov Date: Sat, 4 Feb 2017 00:51:14 -0500 Subject: [PATCH 017/380] fix for latest versions of setuptools and pip to properly initialize virtual environment pip needs to be upgraded before setuptools pip version 10 obsoleted --no-use-wheel flag and replaced it with --no-binary :all: add pip_args attribute to allow user pass additional flags during environment initialization --- manifests/virtualenv.pp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 459b3399..a5d9ae4b 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -49,6 +49,9 @@ # [*timeout*] # The maximum time in seconds the "pip install" command should take. Default: 1800 # +# [*pip_args*] +# Arguments to pass to pip during initialization. Default: blank +# # [*extra_pip_args*] # Extra arguments to pass to pip after requirements file. Default: blank # @@ -84,6 +87,7 @@ $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], $cwd = undef, $timeout = 1800, + $pip_args = '', $extra_pip_args = '', $virtualenv = undef ) { @@ -156,10 +160,12 @@ } $virtualenv_cmd = "${python::exec_prefix}${used_virtualenv}" - $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + + $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + $pip_flags = "${pypi_index} ${proxy_flag} ${pip_args}" exec { "python_virtualenv_${venv_dir}": - command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", + command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", path => $path, @@ -171,7 +177,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${pip_cmd} wheel --help > /dev/null 2>&1 && { ${pip_cmd} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements} ${extra_pip_args}", + command => "${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --no-binary :all: -r ${requirements} ${extra_pip_args}", refreshonly => true, timeout => $timeout, user => $owner, From bb894891bc2c9b35349d0d2f5e26c205616b315e Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 28 Apr 2018 22:10:15 +0200 Subject: [PATCH 018/380] Release 1.19.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 7e9e991f..083d1c79 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "stankevich-python", - "version": "1.18.2", + "version": "1.19.0", "author": "stankevich", "summary": "Python Module", "license": "Apache-2.0", From 52a74106c41179c775e309025b1b17a02b97cfe2 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Thu, 3 May 2018 08:44:51 -0400 Subject: [PATCH 019/380] Repalce pip wheel --version with pip show wheel Previously (prior to version 10, I think), pip wheel --version would exit 0 when wheel was installed even though it complained about wanting more arguments. Now that same command exits 1 which negates its purpose. Using pip wheel show accomplishes the same goal as was originally intended. --- manifests/pip.pp | 12 ++++++------ spec/defines/pip_spec.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 1ea2a76a..ad839a92 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -184,14 +184,14 @@ # Versions prior to 1.5 don't support the --no-use-wheel flag # # To check for this we test for wheel parameter using help and then using - # version, this makes sure we only use wheels if they are supported and + # show, this makes sure we only use wheels if they are supported and # installed # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ { if $ensure != present and $ensure != latest { exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -202,7 +202,7 @@ } } else { exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -218,7 +218,7 @@ # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -232,7 +232,7 @@ present: { # Whatever version is available. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -246,7 +246,7 @@ latest: { # Latest version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install --upgrade \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install --upgrade ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install --upgrade \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install --upgrade ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", unless => "${pip_env} search ${pypi_search_index} ${proxy_flag} ${source} | grep -i INSTALLED.*latest", user => $owner, group => $group, diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 56216c59..445d1a04 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -43,11 +43,11 @@ end context "adds proxy to install command if proxy set" do let (:params) {{ :proxy => "http://my.proxy:3128" }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } end context "adds proxy to search command if set to latest" do let (:params) {{ :proxy => "http://my.proxy:3128", :ensure => 'latest' }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } it { is_expected.to contain_exec("pip_install_rpyc").with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } end end @@ -59,11 +59,11 @@ end context 'adds index to install command if index set' do let (:params) {{ :index => 'http://www.example.com/simple/' }} - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } end context 'adds index to search command if set to latest' do let (:params) {{ :index => 'http://www.example.com/simple/', :ensure => 'latest' }} - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } end end From 8f52b8b091820b279bb5955d1ac0b78d2e4be9f8 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Thu, 3 May 2018 10:02:00 -0400 Subject: [PATCH 020/380] Refactored to reduce duplication and ease reading The commands were SOOO long before this that they were really hard to follow. While deciphering them I noticed a lot of duplication from command to command and on each side of the ||'s. I pulled most of the duplicated code out into some variables which provides two benefits: 1) a single place to update the common components 2) easier to read exec's --- manifests/pip.pp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index ad839a92..1659b680 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -186,12 +186,16 @@ # To check for this we test for wheel parameter using help and then using # show, this makes sure we only use wheels if they are supported and # installed + $wheel_check = "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; }" + + $pip_install = "${pip_env} --log ${log}/pip.log install" + $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ { if $ensure != present and $ensure != latest { exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}@${ensure}#egg=${egg_name} ;}", + command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -202,7 +206,7 @@ } } else { exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -218,7 +222,7 @@ # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install ${install_args} \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${log}/pip.log install ${install_args} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", + command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -228,11 +232,11 @@ path => $path, } } -# +# present: { # Whatever version is available. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -246,7 +250,7 @@ latest: { # Latest version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${log}/pip.log install --upgrade \$wheel_support_flag ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${log}/pip.log install --upgrade ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", + command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", unless => "${pip_env} search ${pypi_search_index} ${proxy_flag} ${source} | grep -i INSTALLED.*latest", user => $owner, group => $group, From 25c3e321592a5ff617ea70e3f6189162a456e552 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Thu, 3 May 2018 12:30:17 -0400 Subject: [PATCH 021/380] Replace --no-use-wheel with --no-binary :all: --no-use-wheel has been depreciated since at least pip 8. --- manifests/pip.pp | 2 +- spec/defines/pip_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 1659b680..113a9f15 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -186,7 +186,7 @@ # To check for this we test for wheel parameter using help and then using # show, this makes sure we only use wheels if they are supported and # installed - $wheel_check = "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; }" + $wheel_check = "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; }" $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 445d1a04..89be69a1 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -43,11 +43,11 @@ end context "adds proxy to install command if proxy set" do let (:params) {{ :proxy => "http://my.proxy:3128" }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } end context "adds proxy to search command if set to latest" do let (:params) {{ :proxy => "http://my.proxy:3128", :ensure => 'latest' }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } it { is_expected.to contain_exec("pip_install_rpyc").with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } end end @@ -59,11 +59,11 @@ end context 'adds index to install command if index set' do let (:params) {{ :index => 'http://www.example.com/simple/' }} - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } end context 'adds index to search command if set to latest' do let (:params) {{ :index => 'http://www.example.com/simple/', :ensure => 'latest' }} - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } end end From d7fa4c77b1a81bfc8771ebe8bcf4cfb2901dd154 Mon Sep 17 00:00:00 2001 From: Bryan Gwilliam Date: Tue, 8 May 2018 10:42:25 -0600 Subject: [PATCH 022/380] add pip support for setuptools extras --- README.md | 4 +++- manifests/pip.pp | 13 +++++++++++-- spec/defines/pip_spec.rb | 29 +++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c3343a1d..7bd8282c 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,8 @@ Installs and manages packages from pip. **environment** - Additional environment variables required to install the packages. Default: none +**extras** - Extra features provided by the package which should be installed. Default: none + **egg** - The egg name to use. Default: `$name` of the class, e.g. cx_Oracle **install_args** - String of additional flags to pass to pip during installaton. Default: none @@ -316,7 +318,7 @@ python::python_dotfiles: ### Using SCL packages from RedHat or CentOS To use this module with Linux distributions in the Red Hat family and python distributions -from softwarecollections.org, set python::provider to 'rhscl' and python::version to the name +from softwarecollections.org, set python::provider to 'rhscl' and python::version to the name of the collection you want to use (e.g., 'python27', 'python33', or 'rh-python34'). ## Release Notes diff --git a/manifests/pip.pp b/manifests/pip.pp index 113a9f15..cd1f653d 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -37,6 +37,9 @@ # [*environment*] # Additional environment variables required to install the packages. Default: none # +# [*extras*] +# Extra features provided by the package which should be installed. Default: none +# # [*timeout*] # The maximum time in seconds the "pip install" command should take. Default: 1800 # @@ -76,6 +79,7 @@ $egg = false, $editable = false, $environment = [], + $extras = [], $install_args = '', $uninstall_args = '', $timeout = 1800, @@ -161,13 +165,18 @@ } } + $extras_string = empty($extras) ? { + true => '', + default => sprintf('[%s]',join($extras,',')), + } + $egg_name = $egg ? { - false => $pkgname, + false => "${pkgname}${extras_string}", default => $egg } $source = $url ? { - false => $pkgname, + false => "${pkgname}${extras_string}", /^(\/|[a-zA-Z]\:)/ => $url, /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ => $url, default => "${url}#egg=${egg_name}", diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 89be69a1..f5282a09 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -69,3 +69,32 @@ end end + +describe 'python::pip', :type => :define do + let (:title) { 'requests' } + context "on Debian OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + } + end + + describe "extras as" do + context "suceeds with no extras" do + let (:params) {{ }} + it { is_expected.to contain_exec("pip_install_requests").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests || pip --log /tmp/pip.log install requests ;}") } + end + context "succeeds with extras" do + let (:params) {{ :extras => ['security'] }} + it { is_expected.to contain_exec("pip_install_requests").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests[security] || pip --log /tmp/pip.log install requests[security] ;}") } + end + end + end +end From cd04a331a05f0fa7a71d7e8cfa48405d42199640 Mon Sep 17 00:00:00 2001 From: Dennis Well Date: Wed, 9 May 2018 11:53:38 +0200 Subject: [PATCH 023/380] virtualenv.pp: make creation of $venv_dir optional --- manifests/virtualenv.pp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index a5d9ae4b..898f1a50 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -16,9 +16,13 @@ # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't # If virtualenv version < 1.7 this flag has no effect since +# # [*venv_dir*] # Directory to install virtualenv to. Default: $name # +# [*ensure_venv_dir*] +# Create $venv_dir. Default: true +# # [*distribute*] # Include distribute in the virtualenv. Default: true # @@ -77,6 +81,7 @@ $requirements = false, $systempkgs = false, $venv_dir = $name, + $ensure_venv_dir = true, $distribute = true, $index = false, $owner = 'root', @@ -152,11 +157,13 @@ # To check for this we test for wheel parameter using help and then using # version, this makes sure we only use wheels if they are supported - file { $venv_dir: - ensure => directory, - owner => $owner, - group => $group, - mode => $mode + if $ensure_venv_dir { + file { $venv_dir: + ensure => directory, + owner => $owner, + group => $group, + mode => $mode + } } $virtualenv_cmd = "${python::exec_prefix}${used_virtualenv}" From e2de457798df048031e30a6dd203fb57c363f729 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 12 May 2018 21:20:59 +0200 Subject: [PATCH 024/380] modulesync 1.9.0-29-g1ba9f1e --- .github/CONTRIBUTING.md | 124 ++++ .github/ISSUE_TEMPLATE.md | 26 + .github/PULL_REQUEST_TEMPLATE.md | 20 + .gitignore | 37 +- .msync.yml | 1 + .overcommit.yml | 63 ++ .pmtignore | 20 + .rspec | 2 + .rspec_parallel | 1 + .rubocop.yml | 545 ++++++++++++++++++ .travis.yml | 79 +-- .yardopts | 2 + Gemfile | 91 ++- Rakefile | 92 ++- spec/acceptance/nodesets/archlinux-2-x64.yml | 13 + spec/acceptance/nodesets/centos-511-x64.yml | 15 + spec/acceptance/nodesets/centos-6-x64.yml | 15 + spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 + spec/acceptance/nodesets/centos-7-x64.yml | 15 + spec/acceptance/nodesets/debian-78-x64.yml | 15 + spec/acceptance/nodesets/debian-82-x64.yml | 15 + spec/acceptance/nodesets/docker/centos-5.yml | 19 + spec/acceptance/nodesets/docker/centos-6.yml | 20 + spec/acceptance/nodesets/docker/centos-7.yml | 19 + spec/acceptance/nodesets/docker/debian-7.yml | 18 + spec/acceptance/nodesets/docker/debian-8.yml | 20 + spec/acceptance/nodesets/docker/debian-9.yml | 20 + .../nodesets/docker/ubuntu-12.04.yml | 19 + .../nodesets/docker/ubuntu-14.04.yml | 21 + .../nodesets/docker/ubuntu-16.04.yml | 21 + .../nodesets/ec2/amazonlinux-2016091.yml | 31 + .../nodesets/ec2/image_templates.yaml | 34 ++ spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 29 + .../nodesets/ec2/sles-12sp2-x64.yml | 29 + .../nodesets/ec2/ubuntu-1604-x64.yml | 29 + .../nodesets/ec2/windows-2016-base-x64.yml | 29 + spec/acceptance/nodesets/fedora-25-x64.yml | 16 + spec/acceptance/nodesets/fedora-26-x64.yml | 16 + spec/acceptance/nodesets/fedora-27-x64.yml | 18 + .../nodesets/ubuntu-server-1204-x64.yml | 15 + .../nodesets/ubuntu-server-1404-x64.yml | 14 +- .../nodesets/ubuntu-server-1604-x64.yml | 15 + spec/classes/coverage_spec.rb | 4 + spec/default_facts.yml | 14 + spec/spec_helper.rb | 39 +- 45 files changed, 1592 insertions(+), 125 deletions(-) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .msync.yml create mode 100644 .overcommit.yml create mode 100644 .pmtignore create mode 100644 .rspec create mode 100644 .rspec_parallel create mode 100644 .rubocop.yml create mode 100644 .yardopts create mode 100644 spec/acceptance/nodesets/archlinux-2-x64.yml create mode 100644 spec/acceptance/nodesets/centos-511-x64.yml create mode 100644 spec/acceptance/nodesets/centos-6-x64.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-7-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-x64.yml create mode 100644 spec/acceptance/nodesets/docker/centos-5.yml create mode 100644 spec/acceptance/nodesets/docker/centos-6.yml create mode 100644 spec/acceptance/nodesets/docker/centos-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-7.yml create mode 100644 spec/acceptance/nodesets/docker/debian-8.yml create mode 100644 spec/acceptance/nodesets/docker/debian-9.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-12.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-14.04.yml create mode 100644 spec/acceptance/nodesets/docker/ubuntu-16.04.yml create mode 100644 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml create mode 100644 spec/acceptance/nodesets/ec2/image_templates.yaml create mode 100644 spec/acceptance/nodesets/ec2/rhel-73-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml create mode 100644 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml create mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml create mode 100644 spec/acceptance/nodesets/fedora-26-x64.yml create mode 100644 spec/acceptance/nodesets/fedora-27-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml create mode 100644 spec/classes/coverage_spec.rb create mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..496a5c03 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,124 @@ +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +1. Fork the repo. + +1. Create a separate branch for your change. + +1. Run the tests. We only take pull requests with passing tests, and + documentation. + +1. Add a test for your change. Only refactoring and documentation + changes require no new tests. If you are adding functionality + or fixing a bug, please add a test. + +1. Squash your commits down into logical components. Make sure to rebase + against the current master. + +1. Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review +your code. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + + export PUPPET_VERSION="~> 4.2.0" + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development --without system_tests --without release +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --without development --with system_tests --without release +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean +``` + +## Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + + bundle exec rake lint + bundle exec rake validate + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + + bundle exec rake rubocop + +## Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + +To run your all the unit tests + + bundle exec rake spec SPEC_OPTS='--format documentation' + +To run a specific spec test set the `SPEC` variable: + + bundle exec rake spec SPEC=spec/foo_spec.rb + +## Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + + bundle exec rake acceptance + +This will run the tests on the module's default nodeset. You can override the +nodeset used, e.g., + + BEAKER_set=centos-7-x64 bundle exec rake acceptance + +There are default rake tasks for the various acceptance test modules, e.g., + + bundle exec rake beaker:centos-7-x64 + bundle exec rake beaker:ssh:centos-7-x64 + +If you don't want to have to recreate the virtual machine every time you can +use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at +least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the +created virtual machines will be in `.vagrant/beaker_vagrant_files`. + +The easiest way to debug in a docker container is to open a shell: + + docker exec -it -u root ${container_id_or_name} bash diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..593e7aa8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..ef25cdbf --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.gitignore b/.gitignore index 57718ecc..e9b3cf4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,20 @@ -# Editors -project.xml -project.properties -/nbproject/private/ -.buildpath -.project -.settings* -sftp-config.json -.idea - -# Modules pkg/ Gemfile.lock +Gemfile.local vendor/ -spec/fixtures/ -.bundle/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ .vagrant/ +.bundle/ +.ruby-version coverage/ - -# Beaker -.vagrant/ log/ -junit/ - -# OS X metadata -.DS_Store - -# Windows junk -Thumbs.db +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock +*.iml +.*.sw? +.yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 00000000..1a132115 --- /dev/null +++ b/.msync.yml @@ -0,0 +1 @@ +modulesync_config_version: '1.9.2' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 00000000..31699e74 --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,63 @@ +# Managed by https://github.com/voxpupuli/modulesync_configs +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'test' + - 'rubocop' + command: [ 'bundle', 'exec', 'rake' ] diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 00000000..fb589575 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,20 @@ +docs/ +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock +*.iml +.*.sw? +.yardoc/ diff --git a/.rspec b/.rspec new file mode 100644 index 00000000..8c18f1ab --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 00000000..e4d136b7 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1 @@ +--format progress diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..099a11c5 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,545 @@ +require: rubocop-rspec +AllCops: + TargetRubyVersion: 1.9 + Include: + - ./**/*.rb + Exclude: + - files/**/* + - vendor/**/* + - .vendor/**/* + - pkg/**/* + - spec/fixtures/**/* + - Gemfile + - Rakefile + - Guardfile + - Vagrantfile +Lint/ConditionPosition: + Enabled: True + +Lint/ElseLayout: + Enabled: True + +Lint/UnreachableCode: + Enabled: True + +Lint/UselessComparison: + Enabled: True + +Lint/EnsureReturn: + Enabled: True + +Lint/HandleExceptions: + Enabled: True + +Lint/LiteralInCondition: + Enabled: True + +Lint/ShadowingOuterLocalVariable: + Enabled: True + +Lint/LiteralInInterpolation: + Enabled: True + +Style/HashSyntax: + Enabled: True + +Style/RedundantReturn: + Enabled: True + +Layout/EndOfLine: + Enabled: False + +Lint/AmbiguousOperator: + Enabled: True + +Lint/AssignmentInCondition: + Enabled: True + +Layout/SpaceBeforeComment: + Enabled: True + +Style/AndOr: + Enabled: True + +Style/RedundantSelf: + Enabled: True + +Metrics/BlockLength: + Enabled: False + +# Method length is not necessarily an indicator of code quality +Metrics/MethodLength: + Enabled: False + +# Module length is not necessarily an indicator of code quality +Metrics/ModuleLength: + Enabled: False + +Style/WhileUntilModifier: + Enabled: True + +Lint/AmbiguousRegexpLiteral: + Enabled: True + +Security/Eval: + Enabled: True + +Lint/BlockAlignment: + Enabled: True + +Lint/DefEndAlignment: + Enabled: True + +Lint/EndAlignment: + Enabled: True + +Lint/DeprecatedClassMethods: + Enabled: True + +Lint/Loop: + Enabled: True + +Lint/ParenthesesAsGroupedExpression: + Enabled: True + +Lint/RescueException: + Enabled: True + +Lint/StringConversionInInterpolation: + Enabled: True + +Lint/UnusedBlockArgument: + Enabled: True + +Lint/UnusedMethodArgument: + Enabled: True + +Lint/UselessAccessModifier: + Enabled: True + +Lint/UselessAssignment: + Enabled: True + +Lint/Void: + Enabled: True + +Layout/AccessModifierIndentation: + Enabled: True + +Style/AccessorMethodName: + Enabled: True + +Style/Alias: + Enabled: True + +Layout/AlignArray: + Enabled: True + +Layout/AlignHash: + Enabled: True + +Layout/AlignParameters: + Enabled: True + +Metrics/BlockNesting: + Enabled: True + +Style/AsciiComments: + Enabled: True + +Style/Attr: + Enabled: True + +Style/BracesAroundHashParameters: + Enabled: True + +Style/CaseEquality: + Enabled: True + +Layout/CaseIndentation: + Enabled: True + +Style/CharacterLiteral: + Enabled: True + +Style/ClassAndModuleCamelCase: + Enabled: True + +Style/ClassAndModuleChildren: + Enabled: False + +Style/ClassCheck: + Enabled: True + +# Class length is not necessarily an indicator of code quality +Metrics/ClassLength: + Enabled: False + +Style/ClassMethods: + Enabled: True + +Style/ClassVars: + Enabled: True + +Style/WhenThen: + Enabled: True + +Style/WordArray: + Enabled: True + +Style/UnneededPercentQ: + Enabled: True + +Layout/Tab: + Enabled: True + +Layout/SpaceBeforeSemicolon: + Enabled: True + +Layout/TrailingBlankLines: + Enabled: True + +Layout/SpaceInsideBlockBraces: + Enabled: True + +Layout/SpaceInsideBrackets: + Enabled: True + +Layout/SpaceInsideHashLiteralBraces: + Enabled: True + +Layout/SpaceInsideParens: + Enabled: True + +Layout/LeadingCommentSpace: + Enabled: True + +Layout/SpaceBeforeFirstArg: + Enabled: True + +Layout/SpaceAfterColon: + Enabled: True + +Layout/SpaceAfterComma: + Enabled: True + +Layout/SpaceAfterMethodName: + Enabled: True + +Layout/SpaceAfterNot: + Enabled: True + +Layout/SpaceAfterSemicolon: + Enabled: True + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: True + +Layout/SpaceAroundOperators: + Enabled: True + +Layout/SpaceBeforeBlockBraces: + Enabled: True + +Layout/SpaceBeforeComma: + Enabled: True + +Style/CollectionMethods: + Enabled: True + +Layout/CommentIndentation: + Enabled: True + +Style/ColonMethodCall: + Enabled: True + +Style/CommentAnnotation: + Enabled: True + +# 'Complexity' is very relative +Metrics/CyclomaticComplexity: + Enabled: False + +Style/ConstantName: + Enabled: True + +Style/Documentation: + Enabled: False + +Style/DefWithParentheses: + Enabled: True + +Style/PreferredHashMethods: + Enabled: True + +Layout/DotPosition: + EnforcedStyle: trailing + +Style/DoubleNegation: + Enabled: True + +Style/EachWithObject: + Enabled: True + +Layout/EmptyLineBetweenDefs: + Enabled: True + +Layout/IndentArray: + Enabled: True + +Layout/IndentHash: + Enabled: True + +Layout/IndentationConsistency: + Enabled: True + +Layout/IndentationWidth: + Enabled: True + +Layout/EmptyLines: + Enabled: True + +Layout/EmptyLinesAroundAccessModifier: + Enabled: True + +Style/EmptyLiteral: + Enabled: True + +# Configuration parameters: AllowURI, URISchemes. +Metrics/LineLength: + Enabled: False + +Style/MethodCallWithoutArgsParentheses: + Enabled: True + +Style/MethodDefParentheses: + Enabled: True + +Style/LineEndConcatenation: + Enabled: True + +Layout/TrailingWhitespace: + Enabled: True + +Style/StringLiterals: + Enabled: True + +Style/TrailingCommaInArguments: + Enabled: True + +Style/TrailingCommaInLiteral: + Enabled: True + +Style/GlobalVars: + Enabled: True + +Style/GuardClause: + Enabled: True + +Style/IfUnlessModifier: + Enabled: True + +Style/MultilineIfThen: + Enabled: True + +Style/NegatedIf: + Enabled: True + +Style/NegatedWhile: + Enabled: True + +Style/Next: + Enabled: True + +Style/SingleLineBlockParams: + Enabled: True + +Style/SingleLineMethods: + Enabled: True + +Style/SpecialGlobalVars: + Enabled: True + +Style/TrivialAccessors: + Enabled: True + +Style/UnlessElse: + Enabled: True + +Style/VariableInterpolation: + Enabled: True + +Style/VariableName: + Enabled: True + +Style/WhileUntilDo: + Enabled: True + +Style/EvenOdd: + Enabled: True + +Style/FileName: + Enabled: True + +Style/For: + Enabled: True + +Style/Lambda: + Enabled: True + +Style/MethodName: + Enabled: True + +Style/MultilineTernaryOperator: + Enabled: True + +Style/NestedTernaryOperator: + Enabled: True + +Style/NilComparison: + Enabled: True + +Style/FormatString: + Enabled: True + +Style/MultilineBlockChain: + Enabled: True + +Style/Semicolon: + Enabled: True + +Style/SignalException: + Enabled: True + +Style/NonNilCheck: + Enabled: True + +Style/Not: + Enabled: True + +Style/NumericLiterals: + Enabled: True + +Style/OneLineConditional: + Enabled: True + +Style/OpMethod: + Enabled: True + +Style/ParenthesesAroundCondition: + Enabled: True + +Style/PercentLiteralDelimiters: + Enabled: True + +Style/PerlBackrefs: + Enabled: True + +Style/PredicateName: + Enabled: True + +Style/RedundantException: + Enabled: True + +Style/SelfAssignment: + Enabled: True + +Style/Proc: + Enabled: True + +Style/RaiseArgs: + Enabled: True + +Style/RedundantBegin: + Enabled: True + +Style/RescueModifier: + Enabled: True + +# based on https://github.com/voxpupuli/modulesync_config/issues/168 +Style/RegexpLiteral: + EnforcedStyle: percent_r + Enabled: True + +Lint/UnderscorePrefixedVariableName: + Enabled: True + +Metrics/ParameterLists: + Enabled: False + +Lint/RequireParentheses: + Enabled: True + +Style/ModuleFunction: + Enabled: True + +Lint/Debugger: + Enabled: True + +Style/IfWithSemicolon: + Enabled: True + +Style/Encoding: + Enabled: True + +Style/BlockDelimiters: + Enabled: True + +Layout/MultilineBlockLayout: + Enabled: True + +# 'Complexity' is very relative +Metrics/AbcSize: + Enabled: False + +# 'Complexity' is very relative +Metrics/PerceivedComplexity: + Enabled: False + +Lint/UselessAssignment: + Enabled: True + +Layout/ClosingParenthesisIndentation: + Enabled: True + +# RSpec + +RSpec/BeforeAfterAll: + Exclude: + - spec/acceptance/**/* + +# We don't use rspec in this way +RSpec/DescribeClass: + Enabled: False + +# Example length is not necessarily an indicator of code quality +RSpec/ExampleLength: + Enabled: False + +RSpec/NamedSubject: + Enabled: False + +# disabled for now since they cause a lot of issues +# these issues aren't easy to fix +RSpec/RepeatedDescription: + Enabled: False + +RSpec/NestedGroups: + Enabled: False + +# this is broken on ruby1.9 +Layout/IndentHeredoc: + Enabled: False + +# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs +Security/YAMLLoad: + Enabled: false + +# This affects hiera interpolation, as well as some configs that we push. +Style/FormatStringToken: + Enabled: false + +# This is useful, but sometimes a little too picky about where unit tests files +# are located. +RSpec/FilePath: + Enabled: false diff --git a/.travis.yml b/.travis.yml index eab11e1b..2efe490c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,52 @@ --- +sudo: false +dist: trusty language: ruby - -bundler_args: --without system_tests - +cache: bundler +# related to https://github.com/rubygems/rubygems/issues/2123 before_install: - - bundle -v - - rm Gemfile.lock || true - - gem update --system - - gem update bundler - - gem --version - - bundle -v - -sudo: false - -script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec' - + - 'rm -f Gemfile.lock' + - 'gem update --system' + - 'gem install bundler' +script: + - 'bundle exec rake $CHECK' matrix: fast_finish: true include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.6.0" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.7.0" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.8.0" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.9.0" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4.10.0" - - rvm: 2.1.9 - env: PUPPET_GEM_VERSION="~> 4" - + - rvm: 2.1.9 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 + - rvm: 2.4.4 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=test + - rvm: 2.5.1 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls + - rvm: 2.4.4 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=rubocop + - rvm: 2.5.1 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes +branches: + only: + - master + - /^v\d/ notifications: email: false + irc: + on_success: always + on_failure: always + channels: + - "chat.freenode.org#voxpupuli-notifications" +deploy: + provider: puppetforge + user: puppet + password: + secure: "" + on: + tags: true + # all_branches is required to use tags + all_branches: true + # Only publish the build marked with "DEPLOY_TO_FORGE" + condition: "$DEPLOY_TO_FORGE = yes" diff --git a/.yardopts b/.yardopts new file mode 100644 index 00000000..3687f518 --- /dev/null +++ b/.yardopts @@ -0,0 +1,2 @@ +--markup markdown +--output-dir docs/ diff --git a/Gemfile b/Gemfile index 0d7cc3a6..ca803539 100644 --- a/Gemfile +++ b/Gemfile @@ -1,38 +1,77 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end +end + +group :test do + gem 'puppetlabs_spec_helper', '~> 2.6.0', :require => false + gem 'rspec-puppet', '~> 2.5', :require => false + gem 'rspec-puppet-facts', :require => false + gem 'rspec-puppet-utils', :require => false + gem 'puppet-lint-leading_zero-check', :require => false + gem 'puppet-lint-trailing_comma-check', :require => false + gem 'puppet-lint-version_comparison-check', :require => false + gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'metadata-json-lint', :require => false + gem 'redcarpet', :require => false + gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'mocha', '~> 1.4.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'parallel_tests', :require => false +end + +group :development do + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false +end + group :system_tests do - gem 'serverspec', :require => false - gem 'beaker', :require => false - gem 'beaker-rspec', :require => false + gem 'winrm', :require => false + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + else + gem 'beaker', '>= 3.9.0', :require => false + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'serverspec', :require => false + gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false end -if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false -else - gem 'puppet', :require => false +group :release do + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'puppet-strings', '~> 1.0', :require => false end + + if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion, :require => false + gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else - gem 'facter', :require => false + gem 'facter', :require => false, :groups => [:test] end -gem 'rspec-puppet', '~> 2.0', :require => false -gem 'puppet-lint', '~> 2.0', :require => false -gem 'simplecov', :require => false - -gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' -gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' -gem 'rake', '<= 12.2.1', :require => false if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.0.0' -gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0' -gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' -gem 'metadata-json-lint', '0.0.11' if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' -gem 'metadata-json-lint', '1.0.0' if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.0' -gem 'metadata-json-lint' if RUBY_VERSION >= '2.0' - -gem 'puppetlabs_spec_helper', '2.0.2', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' -gem 'puppetlabs_spec_helper', '>= 2.0.0', :require => false if RUBY_VERSION >= '1.9' -gem 'parallel_tests', '<= 2.9.0', :require => false if RUBY_VERSION < '2.0.0' +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] -# vim:ft=ruby +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index abf2783b..279580ac 100644 --- a/Rakefile +++ b/Rakefile @@ -1,46 +1,92 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -require 'puppet-syntax/tasks/puppet-syntax' -# These two gems aren't always present, for instance -# on Travis with --without development +# load optional tasks for releases +# only available if gem group releases is installed begin require 'puppet_blacksmith/rake_tasks' + require 'voxpupuli/release/rake_tasks' + require 'puppet-strings/tasks' rescue LoadError end -PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' +PuppetLint.configuration.fail_on_warnings = true 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') PuppetLint.configuration.send('disable_single_quote_string_with_variables') -exclude_paths = [ - "pkg/**/*", - "vendor/**/*", - "spec/**/*", -] +exclude_paths = %w( + pkg/**/* + vendor/**/* + .vendor/**/* + spec/**/* +) PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths -desc 'Validate manifests, templates, ruby files and shell scripts' -task :validate do - Dir['spec/**/*.rb'].each do |ruby_file| - sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ - end +desc 'Auto-correct puppet-lint offenses' +task 'lint:auto_correct' do + PuppetLint.configuration.fix = true + Rake::Task[:lint].invoke end -desc "Run acceptance tests" +desc 'Run acceptance tests' RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc "Run syntax, lint, and spec tests." -task :test => [ - :syntax, - :lint, - :spec, +desc 'Run tests metadata_lint, release_checks' +task test: [ + :metadata_lint, + :release_checks, ] + +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' + end +end + +desc "Print supported beaker sets" +task 'beaker_sets', [:directory] do |t, args| + directory = args[:directory] + + metadata = JSON.load(File.read('metadata.json')) + + (metadata['operatingsystem_support'] || []).each do |os| + (os['operatingsystemrelease'] || []).each do |release| + if directory + beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}" + else + beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64" + end + + filename = "spec/acceptance/nodesets/#{beaker_set}.yml" + + puts beaker_set if File.exists? filename + end + end +end + +begin + require 'github_changelog_generator/task' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + version = (Blacksmith::Modulefile.new).version + config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') + metadata = JSON.load(File.read(metadata_json)) + config.project = metadata['name'] + end +rescue LoadError +end +# vim: syntax=ruby diff --git a/spec/acceptance/nodesets/archlinux-2-x64.yml b/spec/acceptance/nodesets/archlinux-2-x64.yml new file mode 100644 index 00000000..89b63003 --- /dev/null +++ b/spec/acceptance/nodesets/archlinux-2-x64.yml @@ -0,0 +1,13 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + archlinux-2-x64: + roles: + - master + platform: archlinux-2-x64 + box: archlinux/archlinux + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml new file mode 100644 index 00000000..089d646a --- /dev/null +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-511-x64: + roles: + - master + platform: el-5-x86_64 + box: puppetlabs/centos-5.11-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml new file mode 100644 index 00000000..16abc8f1 --- /dev/null +++ b/spec/acceptance/nodesets/centos-6-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + roles: + - master + platform: el-6-x86_64 + box: centos/6 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml new file mode 100644 index 00000000..1e7aea6d --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,17 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-66-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-puppet-enterprise + hypervisor: vagrant +CONFIG: + type: pe +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml new file mode 100644 index 00000000..e05a3ae1 --- /dev/null +++ b/spec/acceptance/nodesets/centos-7-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + roles: + - master + platform: el-7-x86_64 + box: centos/7 + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 00000000..6ef6de8c --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml new file mode 100644 index 00000000..9897a8fc --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-82-x64: + roles: + - master + platform: debian-8-amd64 + box: puppetlabs/debian-8.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-5.yml b/spec/acceptance/nodesets/docker/centos-5.yml new file mode 100644 index 00000000..c17bc3d0 --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-5.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-5-x64: + platform: el-5-x86_64 + hypervisor: docker + image: centos:5 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'sed -i -e "/mingetty/d" /etc/inittab' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-6.yml b/spec/acceptance/nodesets/docker/centos-6.yml new file mode 100644 index 00000000..d93f884c --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-6.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-6-x64: + platform: el-6-x86_64 + hypervisor: docker + image: centos:6 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm -rf /var/run/network/*' + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' + - 'rm /etc/init/tty.conf' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml new file mode 100644 index 00000000..41e924b5 --- /dev/null +++ b/spec/acceptance/nodesets/docker/centos-7.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + centos-7-x64: + platform: el-7-x86_64 + hypervisor: docker + image: centos:7 + docker_preserve_image: true + docker_cmd: '["/usr/sbin/init"]' + docker_image_commands: + - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' + - 'systemctl mask getty@tty1.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml new file mode 100644 index 00000000..41b284d3 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-7.yml @@ -0,0 +1,18 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-7-x64: + platform: debian-7-amd64 + hypervisor: docker + image: debian:7 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml new file mode 100644 index 00000000..a630b7ef --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-8.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + debian-8-x64: + platform: debian-8-amd64 + hypervisor: docker + image: debian:8 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget' + - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-9.yml b/spec/acceptance/nodesets/docker/debian-9.yml new file mode 100644 index 00000000..dfc8e9c0 --- /dev/null +++ b/spec/acceptance/nodesets/docker/debian-9.yml @@ -0,0 +1,20 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/theforeman/foreman-installer-modulesync +HOSTS: + debian-9-x64: + platform: debian-9-amd64 + hypervisor: docker + image: debian:9 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv' + - 'rm -f /usr/sbin/policy-rc.d' + - 'systemctl mask getty@tty1.service getty-static.service' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml new file mode 100644 index 00000000..ab77cda4 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml @@ -0,0 +1,19 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1204-x64: + platform: ubuntu-12.04-amd64 + hypervisor: docker + image: ubuntu:12.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'apt-get install -y net-tools wget' + - 'locale-gen en_US.UTF-8' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml new file mode 100644 index 00000000..ae453044 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml @@ -0,0 +1,21 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1404-x64: + platform: ubuntu-14.04-amd64 + hypervisor: docker + image: ubuntu:14.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'rm /usr/sbin/policy-rc.d' + - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' + - 'apt-get install -y net-tools wget apt-transport-https' + - 'locale-gen en_US.UTF-8' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml new file mode 100644 index 00000000..cd6f3762 --- /dev/null +++ b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml @@ -0,0 +1,21 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-1604-x64: + platform: ubuntu-16.04-amd64 + hypervisor: docker + image: ubuntu:16.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - 'systemctl mask getty@tty1.service getty-static.service' + - 'apt-get install -y net-tools wget locales apt-transport-https' + - 'locale-gen en_US.UTF-8' + - 'echo LANG=en_US.UTF-8 > /etc/default/locale' +CONFIG: + trace_limit: 200 + masterless: true +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml new file mode 100644 index 00000000..19dd43ed --- /dev/null +++ b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml @@ -0,0 +1,31 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Amazon Linux is not a RHEL clone. +# +HOSTS: + amazonlinux-2016091-x64: + roles: + - master + platform: centos-6-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: amazonlinux-2016091-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml new file mode 100644 index 00000000..e50593ee --- /dev/null +++ b/spec/acceptance/nodesets/ec2/image_templates.yaml @@ -0,0 +1,34 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +# Hint: image IDs (ami-*) for the same image are different per location. +# +AMI: + # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type + amazonlinux-2016091-eu-central-1: + :image: + :aio: ami-af0fc0c0 + :region: eu-central-1 + # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type + rhel-73-eu-central-1: + :image: + :aio: ami-e4c63e8b + :region: eu-central-1 + # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type + sles-12sp2-eu-central-1: + :image: + :aio: ami-c425e4ab + :region: eu-central-1 + # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type + ubuntu-1604-eu-central-1: + :image: + :aio: ami-fe408091 + :region: eu-central-1 + # Microsoft Windows Server 2016 Base + windows-2016-base-eu-central-1: + :image: + :aio: ami-88ec20e7 + :region: eu-central-1 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml new file mode 100644 index 00000000..7fac8236 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + rhel-73-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: rhel-73-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml new file mode 100644 index 00000000..8542154d --- /dev/null +++ b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + sles-12sp2-x64: + roles: + - master + platform: sles-12-x86_64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: sles-12sp2-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml new file mode 100644 index 00000000..9cf59d59 --- /dev/null +++ b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + ubuntu-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: ubuntu-1604-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ubuntu +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml new file mode 100644 index 00000000..0932e29c --- /dev/null +++ b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml @@ -0,0 +1,29 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# Additional ~/.fog config file with AWS EC2 credentials +# required. +# +# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md +# +HOSTS: + windows-2016-base-x64: + roles: + - master + platform: windows-2016-64 + hypervisor: ec2 + # refers to image_tempaltes.yaml AMI[vmname] entry: + vmname: windows-2016-base-eu-central-1 + # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: + snapshot: aio + # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): + amisize: t2.micro + # required so that beaker sanitizes sshd_config and root authorized_keys: + user: ec2-user +CONFIG: + type: aio + :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml new file mode 100644 index 00000000..54dd3305 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-25-x64.yml @@ -0,0 +1,16 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +HOSTS: + fedora-25-x64: + roles: + - master + platform: fedora-25-x86_64 + box: fedora/25-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-26-x64.yml b/spec/acceptance/nodesets/fedora-26-x64.yml new file mode 100644 index 00000000..598822b0 --- /dev/null +++ b/spec/acceptance/nodesets/fedora-26-x64.yml @@ -0,0 +1,16 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +HOSTS: + fedora-26-x64: + roles: + - master + platform: fedora-26-x86_64 + box: fedora/26-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-27-x64.yml b/spec/acceptance/nodesets/fedora-27-x64.yml new file mode 100644 index 00000000..c2b61ebb --- /dev/null +++ b/spec/acceptance/nodesets/fedora-27-x64.yml @@ -0,0 +1,18 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# platform is fedora 26 because there is no puppet-agent +# for fedora 27 as of 2017-11-17 +HOSTS: + fedora-27-x64: + roles: + - master + platform: fedora-26-x86_64 + box: fedora/27-cloud-base + hypervisor: vagrant +CONFIG: + type: aio +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 00000000..29102c56 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml index cba1cd04..054e6588 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -1,11 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config HOSTS: ubuntu-server-1404-x64: roles: - master platform: ubuntu-14.04-amd64 - box : puppetlabs/ubuntu-14.04-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm - hypervisor : vagrant + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant CONFIG: - log_level : debug - type: git + type: foss +... +# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml new file mode 100644 index 00000000..bc85e0e8 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml @@ -0,0 +1,15 @@ +--- +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +HOSTS: + ubuntu-server-1604-x64: + roles: + - master + platform: ubuntu-16.04-amd64 + box: puppetlabs/ubuntu-16.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss +... +# vim: syntax=yaml diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb new file mode 100644 index 00000000..de446548 --- /dev/null +++ b/spec/classes/coverage_spec.rb @@ -0,0 +1,4 @@ +require 'rspec-puppet' + +at_exit { RSpec::Puppet::Coverage.report! } +# vim: syntax=ruby diff --git a/spec/default_facts.yml b/spec/default_facts.yml new file mode 100644 index 00000000..13c41657 --- /dev/null +++ b/spec/default_facts.yml @@ -0,0 +1,14 @@ +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config +# +# use default_module_facts.yaml for module specific +# facts. +# +# Hint if using with rspec-puppet-facts ("on_supported_os.each"): +# if a same named fact exists in facterdb it will be overridden. +--- +concat_basedir: "/tmp" +ipaddress: "172.16.254.254" +is_pe: false +macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d0e3996c..cdd49359 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1,31 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts -RSpec.configure do |config| - config.hiera_config = 'spec/fixtures/hiera/hiera.yaml' - config.before :each do - # Ensure that we don't accidentally cache facts and environment between - # test cases. This requires each example group to explicitly load the - # facts being exercised with something like - # Facter.collection.loader.load(:ipaddress) - Facter.clear - Facter.clear_messages +if Dir.exist?(File.expand_path('../../lib', __FILE__)) + require 'coveralls' + require 'simplecov' + require 'simplecov-console' + SimpleCov.formatters = [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console + ] + SimpleCov.start do + track_files 'lib/**/*.rb' + add_filter '/spec' + add_filter '/vendor' + add_filter '/.vendor' end - config.default_facts = { - :environment => 'rp_env', - :operatingsystemmajrelease => '6', - :osfamily => 'RedHat', +end + +RSpec.configure do |c| + default_facts = { + puppetversion: Puppet.version, + facterversion: Facter.version } + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) + default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) + c.default_facts = default_facts end + +# vim: syntax=ruby From 65dce6f1efd35d3f57d2d3f9c839dafdcbd316c8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 21:37:11 +0200 Subject: [PATCH 025/380] puppet-lint: autofix --- manifests/install.pp | 6 +++--- manifests/pip.pp | 4 ++-- manifests/pyvenv.pp | 2 +- manifests/virtualenv.pp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 7271f3e6..b1150357 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -57,7 +57,7 @@ } case $python::provider { - pip: { + 'pip': { package { 'pip': ensure => $pip_ensure, @@ -98,7 +98,7 @@ provider => 'pip', } } - scl: { + 'scl': { # SCL is only valid in the RedHat family. If RHEL, package must be # enabled using the subscription manager outside of puppet. If CentOS, # the centos-release-SCL will install the repository. @@ -134,7 +134,7 @@ } } } - rhscl: { + 'rhscl': { # rhscl is RedHat SCLs from softwarecollections.org if $::python::rhscl_use_public_repository { $scl_package = "rhscl-${::python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" diff --git a/manifests/pip.pp b/manifests/pip.pp index cd1f653d..724f876d 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -242,7 +242,7 @@ } } # - present: { + 'present': { # Whatever version is available. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", @@ -256,7 +256,7 @@ } } - latest: { + 'latest': { # Latest version. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 5f8fecea..ec659672 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -78,7 +78,7 @@ ensure => directory, owner => $owner, group => $group, - mode => $mode + mode => $mode, } exec { "python_virtualenv_${venv_dir}": diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 898f1a50..638a750b 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -162,7 +162,7 @@ ensure => directory, owner => $owner, group => $group, - mode => $mode + mode => $mode, } } @@ -190,7 +190,7 @@ user => $owner, subscribe => Exec["python_virtualenv_${venv_dir}"], environment => $environment, - cwd => $cwd + cwd => $cwd, } python::requirements { "${requirements}_${venv_dir}": From b671db60b81a820c6da6e0b9deccd0527aa9e6e4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 21:40:45 +0200 Subject: [PATCH 026/380] migrate metadata.json to Vox Pupuli --- metadata.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/metadata.json b/metadata.json index 083d1c79..5a670b63 100644 --- a/metadata.json +++ b/metadata.json @@ -1,12 +1,12 @@ { - "name": "stankevich-python", + "name": "puppet-python", "version": "1.19.0", "author": "stankevich", "summary": "Python Module", "license": "Apache-2.0", - "source": "git://github.com/stankevich/puppet-python.git", - "project_page": "https://github.com/stankevich/puppet-python", - "issues_url": "https://github.com/stankevich/puppet-python/issues", + "source": "git://github.com/voxpupuli/puppet-python.git", + "project_page": "https://github.com/voxpupuli/puppet-python", + "issues_url": "https://github.com/voxpupuli/puppet-python/issues", "description": "Puppet module for Python", "tags": [ "python", From 3a55bc10da3f619be5e43c5ce222f7719e1b8427 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 21:41:17 +0200 Subject: [PATCH 027/380] adjust puppet version range to >= 4.10.0 < 6.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 5a670b63..88834af0 100644 --- a/metadata.json +++ b/metadata.json @@ -54,7 +54,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=3.0.0 < 5.0.0" + "version_requirement": ">= 4.10.0 < 6.0.0" } ], "dependencies": [ From c9693a32cb2dbae3ec41c3a70c8035016d549836 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 21:41:51 +0200 Subject: [PATCH 028/380] drop EOL operatingsystems --- metadata.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/metadata.json b/metadata.json index 88834af0..5b83d994 100644 --- a/metadata.json +++ b/metadata.json @@ -18,7 +18,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "5", "6", "7" ] @@ -26,8 +25,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "6", - "7", "8", "9" ] @@ -38,8 +35,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "10.04", - "12.04", "14.04", "16.04" ] From 1a51d2cb06edb8d59c533cc686ff8f12263151af Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 22:34:20 +0200 Subject: [PATCH 029/380] migrate python_spec to rspec-puppet-facts --- spec/classes/python_spec.rb | 773 ++++++++++++++++++------------------ 1 file changed, 379 insertions(+), 394 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 1ec0de42..84b266d5 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,423 +1,408 @@ require 'spec_helper' -describe 'python', :type => :class do - context "on Debian OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', - } - end - - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev") } - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end - - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} - - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => true }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } +describe 'python', type: :class do + on_supported_os.each do |os, facts| + context "on #{os} " do + let :facts do + facts + end + + case facts[:os]['family'] + when 'Debian' + + # tests were written for Debian 6 + context 'on Debian OS' do + it { is_expected.to contain_class('python::install') } + # Base debian packages. + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('python-dev') } + it { is_expected.to contain_package('pip') } + # Basic python packages (from pip) + it { is_expected.to contain_package('virtualenv') } + + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } + + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'empty/default' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end end - end - describe "without python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn') } + end end - end - end - end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "EPEL does not exist for Debian" do - context "default/empty" do - it { should_not contain_class('epel') } - end - end - - end - - context "on a Fedora 22 OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :osfamily => 'RedHat', - :operatingsystem => 'Fedora', - :operatingsystemrelease => '22', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - - describe "EPEL does not exist for Fedora" do - context "default/empty" do - it { should_not contain_class('epel') } - end - end - - end - - - context "on a Redhat 5 OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :osfamily => 'RedHat', - :operatingsystem => 'RedHat', - :operatingsystemrelease => '5', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev").with_name("python-devel") } - it { is_expected.to contain_package("python-dev").with_alias("python-devel") } - it { is_expected.to contain_package("pip") } - it { is_expected.to contain_package("pip").with_name('python-pip') } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "EPEL may be needed on EL" do - context "default/empty" do - it { should contain_class('epel') } - end - end - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end + describe 'with python::provider' do + context 'pip' do + let(:params) { { provider: 'pip' } } + + it { + is_expected.to contain_package('virtualenv').with( + 'provider' => 'pip' + ) + } + it { + is_expected.to contain_package('pip').with( + 'provider' => 'pip' + ) + } + end + + # python::provider + context 'default' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('pip') } + + describe 'with python::virtualenv' do + context 'true' do + let(:params) { { provider: '', virtualenv: 'present' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('present') } + end + end + + describe 'without python::virtualenv' do + context 'default/empty' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('absent') } + end + end + end + end - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => 'present' }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'default/empty' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end end - end - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + describe 'EPEL does not exist for Debian' do + context 'default/empty' do + it { is_expected.not_to contain_class('epel') } + end end end - end - end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - end - - context "on a Redhat 6 OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :osfamily => 'RedHat', - :operatingsystem => 'RedHat', - :operatingsystemmajrelease => '6', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - it { is_expected.to contain_package("pip").with_name('python-pip') } - end - - context "on a Redhat 7 OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :osfamily => 'RedHat', - :operatingsystem => 'RedHat', - :operatingsystemmajrelease => '7', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - it { is_expected.to contain_package("pip").with_name('python2-pip') } - end - - context "on a SLES 11 SP3" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => nil, - :osfamily => 'Suse', - :operatingsystem => 'SLES', - :operatingsystemrelease => '11.3', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - # Base Suse packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("python-dev").with_name("python-devel") } - it { is_expected.to contain_package("python-dev").with_alias("python-devel") } - it { is_expected.to contain_package("pip") } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "empty/default" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end - - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} - - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end - - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} - - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => 'present' }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } + when 'RedHat' + case facts[:os]['name'] + when 'Fedora' + + # written for Fedora 22 + context 'on a Fedora OS' do + describe 'EPEL does not exist for Fedora' do + context 'default/empty' do + it { is_expected.not_to contain_class('epel') } + end + end end - end - - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + when 'RedHat' + case facts[:os]['release']['major'] + when '5' + # written for RHEL 5 + context 'on a Redhat OS' do + it { is_expected.to contain_class('python::install') } + # Base debian packages. + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('python-dev').with_name('python-devel') } + it { is_expected.to contain_package('python-dev').with_alias('python-devel') } + it { is_expected.to contain_package('pip') } + it { is_expected.to contain_package('pip').with_name('python-pip') } + # Basic python packages (from pip) + it { is_expected.to contain_package('virtualenv') } + + describe 'EPEL may be needed on EL' do + context 'default/empty' do + it { is_expected.to contain_class('epel') } + end + end + + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } + + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'empty/default' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end + + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn') } + end + end + + describe 'with python::provider' do + context 'pip' do + let(:params) { { provider: 'pip' } } + + it { + is_expected.to contain_package('virtualenv').with( + 'provider' => 'pip' + ) + } + it { + is_expected.to contain_package('pip').with( + 'provider' => 'pip' + ) + } + end + + # python::provider + context 'default' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('pip') } + + describe 'with python::virtualenv' do + context 'true' do + let(:params) { { provider: '', virtualenv: 'present' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('present') } + end + end + + describe 'with python::virtualenv' do + context 'default/empty' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('absent') } + end + end + end + end + + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } + + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'default/empty' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end + end + when '6' + + context 'on a Redhat 6 OS' do + it { is_expected.to contain_class('python::install') } + it { is_expected.to contain_package('pip').with_name('python-pip') } + end + when '7' + + context 'on a Redhat 7 OS' do + it { is_expected.to contain_class('python::install') } + it { is_expected.to contain_package('pip').with_name('python2-pip') } + end end end - end - end - - describe "with python::dev" do - context "true" do - let (:params) {{ :dev => 'present' }} - it { is_expected.to contain_package("python-dev").with_ensure('present') } - end - context "default/empty" do - it { is_expected.to contain_package("python-dev").with_ensure('absent') } - end - end - - describe "EPEL does not exist on Suse" do - context "default/empty" do - it { should_not contain_class('epel') } - end - end - end + when 'Suse' + # written for SLES 11 SP3 + + context 'on a SLES 11 SP3' do + it { is_expected.to contain_class('python::install') } + # Base Suse packages. + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('python-dev').with_name('python-devel') } + it { is_expected.to contain_package('python-dev').with_alias('python-devel') } + it { is_expected.to contain_package('pip') } + # Basic python packages (from pip) + it { is_expected.to contain_package('virtualenv') } + + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } + + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'empty/default' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end - context "on a Gentoo OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'n/a', - :osfamily => 'Gentoo', - :operatingsystem => 'Gentoo', - :concat_basedir => '/dne', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } - end - it { is_expected.to contain_class("python::install") } - # Base debian packages. - it { is_expected.to contain_package("python") } - it { is_expected.to contain_package("pip").with({"category" => "dev-python"}) } - # Basic python packages (from pip) - it { is_expected.to contain_package("virtualenv")} - # Python::Dev - it { is_expected.not_to contain_package("python-dev") } - - describe "with manage_gunicorn" do - context "true" do - let (:params) {{ :manage_gunicorn => true }} - it { is_expected.to contain_package("gunicorn") } - end - context "empty args" do - #let (:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package("gunicorn") } - end - context "false" do - let (:params) {{ :manage_gunicorn => false }} - it {is_expected.not_to contain_package("gunicorn")} - end - end + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn') } + end + end - describe "with python::provider" do - context "pip" do - let (:params) {{ :provider => 'pip' }} + describe 'with python::provider' do + context 'pip' do + let(:params) { { provider: 'pip' } } + + it { + is_expected.to contain_package('virtualenv').with( + 'provider' => 'pip' + ) + } + it { + is_expected.to contain_package('pip').with( + 'provider' => 'pip' + ) + } + end + + # python::provider + context 'default' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('pip') } + + describe 'with python::virtualenv' do + context 'true' do + let(:params) { { provider: '', virtualenv: 'present' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('present') } + end + end + + describe 'with python::virtualenv' do + context 'default/empty' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('absent') } + end + end + end + end - it { is_expected.to contain_package("virtualenv").with( - 'provider' => 'pip' - )} - it { is_expected.to contain_package("pip").with( - 'provider' => 'pip' - )} - end + describe 'with python::dev' do + context 'true' do + let(:params) { { dev: 'present' } } - # python::provider - context "default" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv")} - it { is_expected.to contain_package("pip")} + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'default/empty' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end - describe "with python::virtualenv" do - context "true" do - let (:params) {{ :provider => '', :virtualenv => 'present' }} - it { is_expected.to contain_package("virtualenv").with_ensure('present') } + describe 'EPEL does not exist on Suse' do + context 'default/empty' do + it { is_expected.not_to contain_class('epel') } + end end end + when 'Gentoo' + + context 'on a Gentoo OS' do + it { is_expected.to contain_class('python::install') } + # Base debian packages. + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('pip').with('category' => 'dev-python') } + # Basic python packages (from pip) + it { is_expected.to contain_package('virtualenv') } + # Python::Dev + it { is_expected.not_to contain_package('python-dev') } + + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn') } + end + end - describe "with python::virtualenv" do - context "default/empty" do - let (:params) {{ :provider => '' }} - it { is_expected.to contain_package("virtualenv").with_ensure('absent') } + describe 'with python::provider' do + context 'pip' do + let(:params) { { provider: 'pip' } } + + it { + is_expected.to contain_package('virtualenv').with( + 'provider' => 'pip' + ) + } + it { + is_expected.to contain_package('pip').with( + 'provider' => 'pip' + ) + } + end + + # python::provider + context 'default' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('pip') } + + describe 'with python::virtualenv' do + context 'true' do + let(:params) { { provider: '', virtualenv: 'present' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('present') } + end + end + + describe 'with python::virtualenv' do + context 'default/empty' do + let(:params) { { provider: '' } } + + it { is_expected.to contain_package('virtualenv').with_ensure('absent') } + end + end + end end end end end end - end From e5ce33f2651c6d9290ea491eee3092c9d95180ca Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:10:48 +0200 Subject: [PATCH 030/380] pull dependencies from master --- .fixtures.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 0554248c..9e4c5257 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,9 +2,7 @@ fixtures: repositories: stdlib: repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - ref: '4.6.0' epel: repo: 'https://github.com/stahnma/puppet-module-epel.git' - ref: '1.2.2' symlinks: python: "#{source_dir}" From b5b98244d5ccaa6367c386df9dedb092e2100097 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:11:11 +0200 Subject: [PATCH 031/380] add workaround for nonexistent facts --- manifests/install.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index b1150357..a6dad661 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -202,13 +202,13 @@ $virtualenv_package = "${python}-virtualenv" } else { - if $::lsbdistcodename == 'jessie' { + if fact('lsbdistcodename') == 'jessie' { $virtualenv_package = 'virtualenv' - } elsif $::lsbdistcodename == 'stretch' { + } elsif fact('lsbdistcodename') == 'stretch' { $virtualenv_package = 'virtualenv' - } elsif $::lsbdistcodename == 'xenial' { + } elsif fact('lsbdistcodename') == 'xenial' { $virtualenv_package = 'virtualenv' - } elsif $::osfamily == 'Gentoo' { + } elsif $facts['os']['family'] == 'Gentoo' { $virtualenv_package = 'virtualenv' } else { $virtualenv_package = 'python-virtualenv' From 87b56b72b5a827f9165d3ef420239d1eabb23f7d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:11:30 +0200 Subject: [PATCH 032/380] replace legacy validate_* calls with datatypes in init.pp --- manifests/init.pp | 77 +++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 53 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 83ef9c72..d0164ee1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -66,30 +66,26 @@ # Sergey Stankevich # Garrett Honeycutt # -class python ( - $ensure = $python::params::ensure, - $version = $python::params::version, - $pip = $python::params::pip, - $dev = $python::params::dev, - $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 = { }, - $python_virtualenvs = { }, - $python_pyvenvs = { }, - $python_requirements = { }, - $python_dotfiles = { }, - $use_epel = $python::params::use_epel, - $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, -) inherits python::params{ - if $provider != undef and $provider != '' { - validate_re($provider, ['^(pip|scl|rhscl)$'], - "Only 'pip', 'rhscl' and 'scl' are valid providers besides the system default. Detected provider is <${provider}>.") - } +class python ( + Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, + $version = $python::params::version, + Enum['absent', 'present', 'latest'] $pip = $python::params::pip, + $dev = $python::params::dev, + Enum['absent', 'present', 'latest'] $virtualenv = $python::params::virtualenv, + Enum['absent', 'present', 'latest'] $gunicorn = $python::params::gunicorn, + Boolean $manage_gunicorn = $python::params::manage_gunicorn, + $gunicorn_package_name = $python::params::gunicorn_package_name, + Optional[Enum['pip', 'scl', 'rhscl', '']] $provider = $python::params::provider, + $valid_versions = $python::params::valid_versions, + Hash $python_pips = { }, + Hash $python_virtualenvs = { }, + Hash $python_pyvenvs = { }, + Hash $python_requirements = { }, + Hash $python_dotfiles = { }, + Boolean $use_epel = $python::params::use_epel, + $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, +) inherits python::params { $exec_prefix = $provider ? { 'scl' => "/usr/bin/scl enable ${version} -- ", @@ -97,40 +93,15 @@ default => '', } - validate_re($ensure, ['^(absent|present|latest)$']) + #$allowed_versions = concat(['system', 'pypy'], $valid_versions) + #unless $version =~ Enum[allowed_versions] { + #fail("version needs to be within${allowed_versions}") + #} validate_re($version, concat(['system', 'pypy'], $valid_versions)) - if $pip == false or $pip == true { - warning('Use of boolean values for the $pip parameter is deprecated') - } else { - validate_re($pip, ['^(absent|present|latest)$']) - } - - if $virtualenv == false or $virtualenv == true { - warning('Use of boolean values for the $virtualenv parameter is deprecated') - } else { - validate_re($virtualenv, ['^(absent|present|latest)$']) - } - - if $virtualenv == false or $virtualenv == true { - warning('Use of boolean values for the $virtualenv parameter is deprecated') - } else { - validate_re($virtualenv, ['^(absent|present|latest)$']) - } - - if $gunicorn == false or $gunicorn == true { - warning('Use of boolean values for the $gunicorn parameter is deprecated') - } else { - validate_re($gunicorn, ['^(absent|present|latest)$']) - } - - validate_hash($python_dotfiles) - validate_bool($manage_gunicorn) - validate_bool($use_epel) - # Module compatibility check $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo' ] - if ! ($::osfamily in $compatible) { + if ! ($facts['os']['family'] in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } From efd6379ec26d20abc931af0cc181d7d3799b705d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:22:55 +0200 Subject: [PATCH 033/380] migrate pyvenv_spec.rb to rspec-puppet-facts --- spec/defines/pyvenv_spec.rb | 44 +++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index f801a103..876afe12 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -1,27 +1,33 @@ require 'spec_helper' -describe 'python::pyvenv', :type => :define do - let (:title) { '/opt/env' } - let (:facts) do - { - :lsbdistcodename => 'jessie', - :osfamily => 'Debian', - } - end - - it { - is_expected.to contain_file( '/opt/env') - is_expected.to contain_exec( "python_virtualenv_/opt/env").with_command("pyvenv --clear /opt/env") - } +describe 'python::pyvenv', type: :define do + on_supported_os.each do |os, facts| + context "on #{os} " do + let :facts do + facts + end + let :title do + '/opt/env' + end - describe 'when ensure' do - context "is absent" do - let (:params) {{ - :ensure => 'absent' - }} it { - is_expected.to contain_file( '/opt/env').with_ensure('absent').with_purge( true) + is_expected.to contain_file('/opt/env') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv --clear /opt/env') } + + describe 'when ensure' do + context 'is absent' do + let :params do + { + ensure: 'absent' + } + end + + it { + is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true) + } + end + end end end end From 3487e354a5506cba6b55d65db3f8d4c2413f68e3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:25:27 +0200 Subject: [PATCH 034/380] migrate requirements_spec.rb to rspec-puppet-facts --- spec/defines/requirements_spec.rb | 88 ++++++++++++++++++------------- 1 file changed, 50 insertions(+), 38 deletions(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index daf56423..29119422 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -1,48 +1,60 @@ require 'spec_helper' -describe 'python::requirements', :type => :define do - let (:title) { '/requirements.txt' } - context "on Debian OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', - } - end - - describe "requirements as" do - context "/requirements.txt" do - let (:params) {{ :requirements => "/requirements.txt" }} - it { is_expected.to contain_file("/requirements.txt").with_mode('0644') } +describe 'python::requirements', type: :define do + on_supported_os.each do |os, facts| + context "on #{os} " do + let :facts do + facts end - context "/requirements.txt" do - let (:params) {{ :requirements => "/requirements.txt", :manage_requirements => false }} - it { is_expected.not_to contain_file("/requirements.txt") } + + let :title do + '/requirements.txt' end - describe "with owner" do - context "bob:bob" do - let (:params) {{ - :owner => 'bob', - :group => 'bob' - }} - it do - expect { - is_expected.to compile - }.to raise_error(/root user must be used when virtualenv is system/) + context 'on Debian OS' do + describe 'requirements as' do + context '/requirements.txt' do + let :params do + { + requirements: '/requirements.txt' + } + end + + it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } end - end - end + context '/requirements.txt' do + let :params do + { + requirements: '/requirements.txt', + manage_requirements: false + } + end - describe "with owner" do - context "default" do - it { is_expected.to contain_file("/requirements.txt").with_owner('root').with_group('root') } + it { is_expected.not_to contain_file('/requirements.txt') } + end + + describe 'with owner' do + context 'bob:bob' do + let :params do + { + owner: 'bob', + group: 'bob' + } + end + + it do + expect do + is_expected.to compile + end.to raise_error(%r{root user must be used when virtualenv is system}) + end + end + end + + describe 'with owner' do + context 'default' do + it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } + end + end end end end From 17a8f08f9d404604e12dfd17e3d3282e50888c7b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:25:49 +0200 Subject: [PATCH 035/380] ensure that we only subscribe to existing resources --- manifests/requirements.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 75d2b698..d2a64bf4 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -126,6 +126,9 @@ replace => false, content => '# Puppet will install and/or update pip packages listed here', } + $subscribe = File[$requirements] + } else { + $subscribe = undef } exec { "python_requirements${name}": @@ -135,7 +138,7 @@ timeout => $timeout, cwd => $cwd, user => $owner, - subscribe => File[$requirements], + subscribe => $subscribe, environment => $environment, } } From f6b042591cb9e8384c4b8650ef1fc0dc33253682 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:36:22 +0200 Subject: [PATCH 036/380] move tests to examples --- {tests => examples}/gunicorn.pp | 0 {tests => examples}/init.pp | 0 {tests => examples}/pip.pp | 0 {tests => examples}/pyvenv.pp | 0 {tests => examples}/requirements.pp | 0 {tests => examples}/virtualenv.pp | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {tests => examples}/gunicorn.pp (100%) rename {tests => examples}/init.pp (100%) rename {tests => examples}/pip.pp (100%) rename {tests => examples}/pyvenv.pp (100%) rename {tests => examples}/requirements.pp (100%) rename {tests => examples}/virtualenv.pp (100%) diff --git a/tests/gunicorn.pp b/examples/gunicorn.pp similarity index 100% rename from tests/gunicorn.pp rename to examples/gunicorn.pp diff --git a/tests/init.pp b/examples/init.pp similarity index 100% rename from tests/init.pp rename to examples/init.pp diff --git a/tests/pip.pp b/examples/pip.pp similarity index 100% rename from tests/pip.pp rename to examples/pip.pp diff --git a/tests/pyvenv.pp b/examples/pyvenv.pp similarity index 100% rename from tests/pyvenv.pp rename to examples/pyvenv.pp diff --git a/tests/requirements.pp b/examples/requirements.pp similarity index 100% rename from tests/requirements.pp rename to examples/requirements.pp diff --git a/tests/virtualenv.pp b/examples/virtualenv.pp similarity index 100% rename from tests/virtualenv.pp rename to examples/virtualenv.pp From 8a503f444cee14e9cb98486783170cf43b1d988c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 May 2018 23:37:25 +0200 Subject: [PATCH 037/380] puppet-lint: autofix --- examples/gunicorn.pp | 2 +- examples/pyvenv.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gunicorn.pp b/examples/gunicorn.pp index d95f6d0f..9308f000 100644 --- a/examples/gunicorn.pp +++ b/examples/gunicorn.pp @@ -13,7 +13,7 @@ environment => 'prod', appmodule => 'app:app', osenv => { - 'DBHOST' => 'dbserver.example.com' + 'DBHOST' => 'dbserver.example.com', }, timeout => 30, template => 'python/gunicorn.erb', diff --git a/examples/pyvenv.pp b/examples/pyvenv.pp index 8cd0cbce..b41b4306 100644 --- a/examples/pyvenv.pp +++ b/examples/pyvenv.pp @@ -8,5 +8,5 @@ python::pip { 'uwsgi': ensure => 'latest', - virtualenv => '/opt/uwsgi' + virtualenv => '/opt/uwsgi', } From cbd4a91994fee72d25bca7ef738fad3d1d213a55 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 13 May 2018 10:19:10 +0200 Subject: [PATCH 038/380] rubocop: autofix --- lib/facter/pip_version.rb | 4 +- lib/facter/python_release.rb | 16 ++- lib/facter/python_version.rb | 16 ++- lib/facter/virtualenv_version.rb | 4 +- spec/acceptance/class_spec.rb | 7 +- spec/acceptance/facts_test_spec.rb | 31 ++--- spec/acceptance/virtualenv_spec.rb | 7 +- spec/defines/gunicorn_spec.rb | 34 ++--- spec/defines/pip_spec.rb | 131 +++++++++++--------- spec/spec_helper_acceptance.rb | 12 +- spec/unit/facter/pip_version_spec.rb | 22 ++-- spec/unit/facter/python_release_spec.rb | 63 +++++----- spec/unit/facter/python_version_spec.rb | 63 +++++----- spec/unit/facter/virtualenv_version_spec.rb | 22 ++-- 14 files changed, 221 insertions(+), 211 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 71f60aea..808f1541 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -1,9 +1,9 @@ # Make pip version available as a fact -Facter.add("pip_version") do +Facter.add('pip_version') do setcode do if Facter::Util::Resolution.which('pip') - Facter::Util::Resolution.exec('pip --version 2>&1').match(/^pip (\d+\.\d+\.?\d*).*$/)[1] + Facter::Util::Resolution.exec('pip --version 2>&1').match(%r{^pip (\d+\.\d+\.?\d*).*$})[1] end end end diff --git a/lib/facter/python_release.rb b/lib/facter/python_release.rb index 348549c1..5013b5c3 100644 --- a/lib/facter/python_release.rb +++ b/lib/facter/python_release.rb @@ -1,24 +1,22 @@ # Make python release available as facts def get_python_release(executable) - if Facter::Util::Resolution.which(executable) - results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+)\.\d+\+?$/) - if results - results[1] - end + if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause + results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(%r{^.*(\d+\.\d+)\.\d+\+?$}) + results[1] if results end end -Facter.add("python_release") do +Facter.add('python_release') do setcode do get_python_release 'python' end end -Facter.add("python2_release") do +Facter.add('python2_release') do setcode do default_release = get_python_release 'python' - if default_release.nil? or !default_release.start_with?('2') + if default_release.nil? || !default_release.start_with?('2') get_python_release 'python2' else default_release @@ -26,7 +24,7 @@ def get_python_release(executable) end end -Facter.add("python3_release") do +Facter.add('python3_release') do setcode do get_python_release 'python3' end diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index c4ffa45c..e21723bb 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -1,24 +1,22 @@ # Make python versions available as facts def get_python_version(executable) - if Facter::Util::Resolution.which(executable) - results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(/^.*(\d+\.\d+\.\d+\+?)$/) - if results - results[1] - end + if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause + results = Facter::Util::Resolution.exec("#{executable} -V 2>&1").match(%r{^.*(\d+\.\d+\.\d+\+?)$}) + results[1] if results end end -Facter.add("python_version") do +Facter.add('python_version') do setcode do get_python_version 'python' end end -Facter.add("python2_version") do +Facter.add('python2_version') do setcode do default_version = get_python_version 'python' - if default_version.nil? or !default_version.start_with?('2') + if default_version.nil? || !default_version.start_with?('2') get_python_version 'python2' else default_version @@ -26,7 +24,7 @@ def get_python_version(executable) end end -Facter.add("python3_version") do +Facter.add('python3_version') do setcode do get_python_version 'python3' end diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index a0917d09..cf717b91 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -1,9 +1,9 @@ # Make virtualenv version available as a fact -Facter.add("virtualenv_version") do +Facter.add('virtualenv_version') do setcode do if Facter::Util::Resolution.which('virtualenv') - Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(/^(\d+\.\d+\.?\d*).*$/)[0] + Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{^(\d+\.\d+\.?\d*).*$})[0] end end end diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 0b65659c..c75207f1 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,17 +1,16 @@ require 'spec_helper_acceptance' describe 'python class' do - context 'default parameters' do # Using puppet_apply as a helper - it 'should work with no errors' do + it 'works with no errors' do pp = <<-EOS class { 'python': } EOS # Run it twice and test for idempotency - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end end end diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 6393c01f..26b7b72e 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper_acceptance' describe 'python class' do - context 'facts' do install_python = <<-EOS class { 'python' : @@ -11,33 +10,35 @@ class { 'python' : } EOS - fact_notices = <<-EOS + fact_notices = <<-EOS notify{"pip_version: ${::pip_version}":} notify{"system_python_version: ${::system_python_version}":} notify{"python_version: ${::python_version}":} notify{"virtualenv_version: ${::virtualenv_version}":} EOS - it 'should output python facts when not installed' do - apply_manifest(fact_notices, :catch_failures => true) do |r| - expect(r.stdout).to match(/python_version: \S+/) - expect(r.stdout).to match(/pip_version: \S+/) - expect(r.stdout).to match(/virtualenv_version: \S+/) - expect(r.stdout).to match(/system_python_version: \S+/) + # rubocop:disable RSpec/RepeatedExample + it 'outputs python facts when not installed' do # rubocop:disable RSpec/MultipleExpectations + apply_manifest(fact_notices, catch_failures: true) do |r| + expect(r.stdout).to match(%r{python_version: \S+}) + expect(r.stdout).to match(%r{pip_version: \S+}) + expect(r.stdout).to match(%r{virtualenv_version: \S+}) + expect(r.stdout).to match(%r{system_python_version: \S+}) end end it 'sets up python' do - apply_manifest(install_python, :catch_failures => true) + apply_manifest(install_python, catch_failures: true) end - it 'should output python facts when installed' do - apply_manifest(fact_notices, :catch_failures => true) do |r| - expect(r.stdout).to match(/python_version: \S+/) - expect(r.stdout).to match(/pip_version: \S+/) - expect(r.stdout).to match(/virtualenv_version: \S+/) - expect(r.stdout).to match(/system_python_version: \S+/) + it 'outputs python facts when installed' do # rubocop:disable RSpec/MultipleExpectations + apply_manifest(fact_notices, catch_failures: true) do |r| + expect(r.stdout).to match(%r{python_version: \S+}) + expect(r.stdout).to match(%r{pip_version: \S+}) + expect(r.stdout).to match(%r{virtualenv_version: \S+}) + expect(r.stdout).to match(%r{system_python_version: \S+}) end end + # rubocop:enable RSpec/RepeatedExample end end diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 2dfbdc3d..ccf6a3f0 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -1,10 +1,9 @@ require 'spec_helper_acceptance' describe 'python class' do - context 'default parameters' do # Using puppet_apply as a helper - it 'should work with no errors' do + it 'works with no errors' do pp = <<-EOS class { 'python' : version => 'system', @@ -27,8 +26,8 @@ class { 'python' : EOS # Run it twice and test for idempotency - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end end end diff --git a/spec/defines/gunicorn_spec.rb b/spec/defines/gunicorn_spec.rb index 116ad414..d2563054 100644 --- a/spec/defines/gunicorn_spec.rb +++ b/spec/defines/gunicorn_spec.rb @@ -1,35 +1,39 @@ require 'spec_helper' -describe 'python::gunicorn', :type => :define do +describe 'python::gunicorn', type: :define do let(:title) { 'test-app' } + context 'on Debian OS' do let :facts do { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', + id: 'root', + kernel: 'Linux', + lsbdistcodename: 'squeeze', + osfamily: 'Debian', + operatingsystem: 'Debian', + operatingsystemrelease: '6', + path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + concat_basedir: '/dne' } end describe 'test-app with default parameter values' do context 'configures test app with default parameter values' do - let(:params) { { :dir => '/srv/testapp' } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--log-level=error/) } + let(:params) { { dir: '/srv/testapp' } } + + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=error}) } end context 'test-app with custom log level' do - let(:params) { { :dir => '/srv/testapp', :log_level => 'info' } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--log-level=info/) } + let(:params) { { dir: '/srv/testapp', log_level: 'info' } } + + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=info}) } end context 'test-app with custom gunicorn preload arguments' do - let(:params) { { :dir => '/srv/testapp', :args => ['--preload'] } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(/--preload/) } + let(:params) { { dir: '/srv/testapp', args: ['--preload'] } } + + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--preload}) } end end end diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index f5282a09..69d3837a 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -1,99 +1,112 @@ require 'spec_helper' -describe 'python::pip', :type => :define do - let (:title) { 'rpyc' } - context "on Debian OS" do +describe 'python::pip', type: :define do # rubocop:disable RSpec/MultipleDescribes + let(:title) { 'rpyc' } + + context 'on Debian OS' do let :facts do { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', + id: 'root', + kernel: 'Linux', + lsbdistcodename: 'squeeze', + osfamily: 'Debian', + operatingsystem: 'Debian', + operatingsystemrelease: '6', + path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + concat_basedir: '/dne' } end - describe "virtualenv as" do - context "fails with non qualified path" do - let (:params) {{ :virtualenv => "venv" }} - it { is_expected.to raise_error(/"venv" is not an absolute path./) } + describe 'virtualenv as' do + context 'fails with non qualified path' do + let(:params) { { virtualenv: 'venv' } } + + it { is_expected.to raise_error(%r{"venv" is not an absolute path.}) } end - context "suceeds with qualified path" do - let (:params) {{ :virtualenv => "/opt/venv" }} - it { is_expected.to contain_exec("pip_install_rpyc").with_cwd('/opt/venv') } + context 'suceeds with qualified path' do + let(:params) { { virtualenv: '/opt/venv' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_cwd('/opt/venv') } end - context "defaults to system" do - let (:params) {{ }} - it { is_expected.to contain_exec("pip_install_rpyc").with_cwd('/') } + context 'defaults to system' do + let(:params) { {} } + + it { is_expected.to contain_exec('pip_install_rpyc').with_cwd('/') } end end - describe "proxy as" do - context "defaults to empty" do - let (:params) {{ }} - it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } + describe 'proxy as' do + context 'defaults to empty' do + let(:params) { {} } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } end - context "does not add proxy to search command if set to latest and proxy is unset" do - let (:params) {{ :ensure => 'latest' }} - it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } - it { is_expected.to contain_exec("pip_install_rpyc").without_unless(/--proxy/) } + context 'does not add proxy to search command if set to latest and proxy is unset' do + let(:params) { { ensure: 'latest' } } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } + it { is_expected.to contain_exec('pip_install_rpyc').without_unless(%r{--proxy}) } end - context "adds proxy to install command if proxy set" do - let (:params) {{ :proxy => "http://my.proxy:3128" }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } + context 'adds proxy to install command if proxy set' do + let(:params) { { proxy: 'http://my.proxy:3128' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } end - context "adds proxy to search command if set to latest" do - let (:params) {{ :proxy => "http://my.proxy:3128", :ensure => 'latest' }} - it { is_expected.to contain_exec("pip_install_rpyc").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } - it { is_expected.to contain_exec("pip_install_rpyc").with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } + context 'adds proxy to search command if set to latest' do + let(:params) { { proxy: 'http://my.proxy:3128', ensure: 'latest' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } end end describe 'index as' do context 'defaults to empty' do - let (:params) {{ }} - it { should_not contain_exec('pip_install_rpyc').with_command(/--index-url/) } + let(:params) { {} } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--index-url}) } end context 'adds index to install command if index set' do - let (:params) {{ :index => 'http://www.example.com/simple/' }} + let(:params) { { index: 'http://www.example.com/simple/' } } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } end context 'adds index to search command if set to latest' do - let (:params) {{ :index => 'http://www.example.com/simple/', :ensure => 'latest' }} + let(:params) { { index: 'http://www.example.com/simple/', ensure: 'latest' } } + it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } end end - end end -describe 'python::pip', :type => :define do - let (:title) { 'requests' } - context "on Debian OS" do +describe 'python::pip', type: :define do + let(:title) { 'requests' } + + context 'on Debian OS' do let :facts do { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', + id: 'root', + kernel: 'Linux', + lsbdistcodename: 'squeeze', + osfamily: 'Debian', + operatingsystem: 'Debian', + operatingsystemrelease: '6', + path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + concat_basedir: '/dne' } end - describe "extras as" do - context "suceeds with no extras" do - let (:params) {{ }} - it { is_expected.to contain_exec("pip_install_requests").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests || pip --log /tmp/pip.log install requests ;}") } + describe 'extras as' do + context 'suceeds with no extras' do + let(:params) { {} } + + it { is_expected.to contain_exec('pip_install_requests').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests || pip --log /tmp/pip.log install requests ;}") } end - context "succeeds with extras" do - let (:params) {{ :extras => ['security'] }} - it { is_expected.to contain_exec("pip_install_requests").with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests[security] || pip --log /tmp/pip.log install requests[security] ;}") } + context 'succeeds with extras' do + let(:params) { { extras: ['security'] } } + + it { is_expected.to contain_exec('pip_install_requests').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests[security] || pip --log /tmp/pip.log install requests[security] ;}") } end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index c1bb6226..bede2bcb 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,8 +1,8 @@ require 'beaker-rspec' -UNSUPPORTED_PLATFORMS = [ 'windows' ] +UNSUPPORTED_PLATFORMS = ['windows'].freeze -unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' +unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no' hosts.each do |host| if host.is_pe? install_pe @@ -23,11 +23,11 @@ c.before :suite do # Install module and dependencies hosts.each do |host| - shell("rm -rf /etc/puppet/modules/python/") - copy_module_to(host, :source => proj_root, :module_name => 'python') + shell('rm -rf /etc/puppet/modules/python/') + copy_module_to(host, source: proj_root, module_name: 'python') shell("/bin/touch #{default['puppetpath']}/hiera.yaml") - on host, puppet('module install puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module install stahnma-epel'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] + on host, puppet('module install stahnma-epel'), acceptable_exit_codes: [0, 1] end end end diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 63a6187b..7401cde5 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -1,32 +1,32 @@ -require "spec_helper" +require 'spec_helper' describe Facter::Util::Fact do - before { + before do Facter.clear - } + end - let(:pip_version_output) { <<-EOS + let(:pip_version_output) do + <<-EOS pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7) EOS - } + end - describe "pip_version" do + describe 'pip_version' do context 'returns pip version when pip present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("pip").returns(true) - Facter::Util::Resolution.expects(:exec).with("pip --version 2>&1").returns(pip_version_output) - expect(Facter.value(:pip_version)).to eq("6.0.6") + Facter::Util::Resolution.expects(:which).with('pip').returns(true) + Facter::Util::Resolution.expects(:exec).with('pip --version 2>&1').returns(pip_version_output) + expect(Facter.value(:pip_version)).to eq('6.0.6') end end context 'returns nil when pip not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("pip").returns(false) + Facter::Util::Resolution.expects(:which).with('pip').returns(false) expect(Facter.value(:pip_version)).to eq(nil) end end - end end diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index dc6895a4..ad2dc30c 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -1,45 +1,46 @@ -require "spec_helper" +require 'spec_helper' describe Facter::Util::Fact do - before { + before do Facter.clear - } + end - let(:python2_version_output) { <<-EOS + let(:python2_version_output) do + <<-EOS Python 2.7.9 EOS - } - let(:python3_version_output) { <<-EOS + end + let(:python3_version_output) do + <<-EOS Python 3.3.0 EOS - } + end - describe "python_release" do + describe 'python_release' do context 'returns Python release when `python` present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) - expect(Facter.value(:python_release)).to eq("2.7") + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + expect(Facter.value(:python_release)).to eq('2.7') end end context 'returns nil when `python` not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(false) expect(Facter.value(:python_release)).to eq(nil) end end - end - describe "python2_release" do + describe 'python2_release' do context 'returns Python 2 release when `python` is present and Python 2' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) expect(Facter.value(:python2_release)).to eq('2.7') end end @@ -47,10 +48,10 @@ context 'returns Python 2 release when `python` is Python 3 and `python2` is present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with("python2").returns(true) - Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with('python2').returns(true) + Facter::Util::Resolution.expects(:exec).with('python2 -V 2>&1').returns(python2_version_output) expect(Facter.value(:python2_release)).to eq('2.7') end end @@ -58,9 +59,9 @@ context 'returns nil when `python` is Python 3 and `python2` is absent' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with("python2").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with('python2').returns(false) expect(Facter.value(:python2_release)).to eq(nil) end end @@ -68,31 +69,29 @@ context 'returns nil when `python2` and `python` are absent' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(false) - Facter::Util::Resolution.expects(:which).with("python2").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(false) + Facter::Util::Resolution.expects(:which).with('python2').returns(false) expect(Facter.value(:python2_release)).to eq(nil) end end - end - describe "python3_release" do + describe 'python3_release' do context 'returns Python 3 release when `python3` present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python3").returns(true) - Facter::Util::Resolution.expects(:exec).with("python3 -V 2>&1").returns(python3_version_output) - expect(Facter.value(:python3_release)).to eq("3.3") + Facter::Util::Resolution.expects(:which).with('python3').returns(true) + Facter::Util::Resolution.expects(:exec).with('python3 -V 2>&1').returns(python3_version_output) + expect(Facter.value(:python3_release)).to eq('3.3') end end context 'returns nil when `python3` not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python3").returns(false) + Facter::Util::Resolution.expects(:which).with('python3').returns(false) expect(Facter.value(:python3_release)).to eq(nil) end end - end end diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index 48ab1ede..039318d9 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -1,45 +1,46 @@ -require "spec_helper" +require 'spec_helper' describe Facter::Util::Fact do - before { + before do Facter.clear - } + end - let(:python2_version_output) { <<-EOS + let(:python2_version_output) do + <<-EOS Python 2.7.9 EOS - } - let(:python3_version_output) { <<-EOS + end + let(:python3_version_output) do + <<-EOS Python 3.3.0 EOS - } + end - describe "python_version" do + describe 'python_version' do context 'returns Python version when `python` present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) - expect(Facter.value(:python_version)).to eq("2.7.9") + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + expect(Facter.value(:python_version)).to eq('2.7.9') end end context 'returns nil when `python` not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(false) expect(Facter.value(:python_version)).to eq(nil) end end - end - describe "python2_version" do + describe 'python2_version' do context 'returns Python 2 version when `python` is present and Python 2' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) expect(Facter.value(:python2_version)).to eq('2.7.9') end end @@ -47,10 +48,10 @@ context 'returns Python 2 version when `python` is Python 3 and `python2` is present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with("python2").returns(true) - Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with('python2').returns(true) + Facter::Util::Resolution.expects(:exec).with('python2 -V 2>&1').returns(python2_version_output) expect(Facter.value(:python2_version)).to eq('2.7.9') end end @@ -58,9 +59,9 @@ context 'returns nil when `python` is Python 3 and `python2` is absent' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(true) - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with("python2").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(true) + Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) + Facter::Util::Resolution.expects(:which).with('python2').returns(false) expect(Facter.value(:python2_version)).to eq(nil) end end @@ -68,31 +69,29 @@ context 'returns nil when `python2` and `python` are absent' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python").returns(false) - Facter::Util::Resolution.expects(:which).with("python2").returns(false) + Facter::Util::Resolution.expects(:which).with('python').returns(false) + Facter::Util::Resolution.expects(:which).with('python2').returns(false) expect(Facter.value(:python2_version)).to eq(nil) end end - end - describe "python3_version" do + describe 'python3_version' do context 'returns Python 3 version when `python3` present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python3").returns(true) - Facter::Util::Resolution.expects(:exec).with("python3 -V 2>&1").returns(python3_version_output) - expect(Facter.value(:python3_version)).to eq("3.3.0") + Facter::Util::Resolution.expects(:which).with('python3').returns(true) + Facter::Util::Resolution.expects(:exec).with('python3 -V 2>&1').returns(python3_version_output) + expect(Facter.value(:python3_version)).to eq('3.3.0') end end context 'returns nil when `python3` not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("python3").returns(false) + Facter::Util::Resolution.expects(:which).with('python3').returns(false) expect(Facter.value(:python3_version)).to eq(nil) end end - end end diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb index b9aac90e..1d625859 100644 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ b/spec/unit/facter/virtualenv_version_spec.rb @@ -1,32 +1,32 @@ -require "spec_helper" +require 'spec_helper' describe Facter::Util::Fact do - before { + before do Facter.clear - } + end - let(:virtualenv_version_output) { <<-EOS + let(:virtualenv_version_output) do + <<-EOS 12.0.7 EOS - } + end - describe "virtualenv_version" do + describe 'virtualenv_version' do context 'returns virtualenv version when virtualenv present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("virtualenv").returns(true) - Facter::Util::Resolution.expects(:exec).with("virtualenv --version 2>&1").returns(virtualenv_version_output) - expect(Facter.value(:virtualenv_version)).to eq("12.0.7") + Facter::Util::Resolution.expects(:which).with('virtualenv').returns(true) + Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_version_output) + expect(Facter.value(:virtualenv_version)).to eq('12.0.7') end end context 'returns nil when virtualenv not present' do it do Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with("virtualenv").returns(false) + Facter::Util::Resolution.expects(:which).with('virtualenv').returns(false) expect(Facter.value(:virtualenv_version)).to eq(nil) end end - end end From 694ffefefdb5167503c9f79839f8323ad46bc09d Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sun, 13 May 2018 11:32:25 +0200 Subject: [PATCH 039/380] Add deprecation notice Re: https://github.com/voxpupuli/plumbing/issues/167 --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7bd8282c..35c1ece8 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -# puppet-python [![Build Status](https://travis-ci.org/stankevich/puppet-python.svg?branch=master)](https://travis-ci.org/stankevich/puppet-python) +# puppet-python [![Build Status](https://travis-ci.org/voxpupuli/puppet-python.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-python) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. -=== +**Please note:** The module [stankevich/python](https://forge.puppet.com/stankevich/python) has been deprecated and is now available under Vox Pupuli: [puppet/python](https://forge.puppet.com/puppet/python). -# Compatibility # +## Compatibility # See `.travis.yml` for compatibility matrix. * Puppet v3 (with the future parser) * Puppet v4 -## Ruby versions +### Ruby versions * 1.8.7 - Puppet 3 * 1.9.3 - Puppet 3 * 2.0.0 - Puppet 3 * 2.1.9 - Puppet 3 & 4 -## OS Distributions ## +### OS Distributions ## This module has been tested to work on the following systems. @@ -36,8 +36,6 @@ This module has been tested to work on the following systems. * Ubuntu 14.04 * Ubuntu 16.04 -=== - ## Installation ```shell @@ -341,6 +339,6 @@ Currently, the changes you need to make are as follows: * All pip definitions MUST include the owner field which specifies which user owns the virtualenv that packages will be installed in. Adding this greatly improves performance and efficiency of this module. * You must explicitly specify pip => true in the python class if you want pip installed. As such, the pip package is now independent of the dev package and so one can exist without the other. -## Authors +## Contributors -[Sergey Stankevich](https://github.com/stankevich) | [Shiva Poudel](https://github.com/shivapoudel) | [Peter Souter](https://github.com/petems) | [Garrett Honeycutt](http://learnpuppet.com) +Check out [Github contributors](https://github.com/voxpupuli/puppet-python/graphs/contributors). From f27e2cffef34941128ed895e27bf5a0f06b52109 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 13 May 2018 11:47:06 +0200 Subject: [PATCH 040/380] add secret --- .sync.yaml | 3 +++ .travis.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .sync.yaml diff --git a/.sync.yaml b/.sync.yaml new file mode 100644 index 00000000..cdec6c97 --- /dev/null +++ b/.sync.yaml @@ -0,0 +1,3 @@ +--- +.travis.yml: + secret: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" diff --git a/.travis.yml b/.travis.yml index 2efe490c..d76a6929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" on: tags: true # all_branches is required to use tags From 5a156e5cf6ee3461dbc868d2aac5b8c5fc22df55 Mon Sep 17 00:00:00 2001 From: Sandra Thieme Date: Sun, 13 May 2018 11:55:58 +0200 Subject: [PATCH 041/380] Update README compatibility section * remove EOL operating systems * updated supported puppet versions * remove ruby version section --- README.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 35c1ece8..4011d693 100644 --- a/README.md +++ b/README.md @@ -8,31 +8,19 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn See `.travis.yml` for compatibility matrix. -* Puppet v3 (with the future parser) * Puppet v4 - -### Ruby versions - -* 1.8.7 - Puppet 3 -* 1.9.3 - Puppet 3 -* 2.0.0 - Puppet 3 -* 2.1.9 - Puppet 3 & 4 +* Puppet v5 ### OS Distributions ## This module has been tested to work on the following systems. -* Debian 6 -* Debian 7 * Debian 8 * Debian 9 -* EL 5 * EL 6 * EL 7 * Gentoo (and Sabayon) * Suse 11 -* Ubuntu 10.04 -* Ubuntu 12.04 * Ubuntu 14.04 * Ubuntu 16.04 From fd37062a1c4eac674e47036704961df5303152cc Mon Sep 17 00:00:00 2001 From: Jason Staph Date: Sat, 22 Apr 2017 11:19:19 -0400 Subject: [PATCH 042/380] Add umask parameter to pip execs --- manifests/pip.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifests/pip.pp b/manifests/pip.pp index 724f876d..b6d42278 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -74,6 +74,7 @@ $url = false, $owner = 'root', $group = 'root', + $umask = undef, $index = false, $proxy = false, $egg = false, @@ -208,6 +209,7 @@ unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, @@ -219,6 +221,7 @@ unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, @@ -235,6 +238,7 @@ unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, @@ -249,6 +253,7 @@ unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, @@ -263,6 +268,7 @@ unless => "${pip_env} search ${pypi_search_index} ${proxy_flag} ${source} | grep -i INSTALLED.*latest", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, @@ -277,6 +283,7 @@ onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, group => $group, + umask => $umask, cwd => $cwd, environment => $environment, timeout => $timeout, From dfb6fd2a910888c39ef157812c2ce5d3fa7e6b69 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 20 May 2018 18:08:12 +0200 Subject: [PATCH 043/380] modulesync 1.9.2 --- .travis.yml | 2 +- Gemfile | 9 +++++---- spec/spec_helper.rb | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d76a6929..2efe490c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" + secure: "" on: tags: true # all_branches is required to use tags diff --git a/Gemfile b/Gemfile index ca803539..1527b391 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ group :development do end group :system_tests do - gem 'winrm', :require => false + gem 'winrm', :require => false if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) else @@ -51,9 +51,10 @@ group :system_tests do else gem 'beaker-rspec', :require => false end - gem 'serverspec', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'beaker-module_install_helper', :require => false + gem 'serverspec', :require => false + gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false end group :release do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cdd49359..ea74a52a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,10 @@ require 'rspec-puppet-facts' include RspecPuppetFacts +# This file is managed via modulesync +# https://github.com/voxpupuli/modulesync +# https://github.com/voxpupuli/modulesync_config + if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' From 4cadb0211921b968d723671491a54ad5cd49f89f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 22 May 2018 21:52:21 +0200 Subject: [PATCH 044/380] Remove docker nodesets --- spec/acceptance/nodesets/docker/centos-5.yml | 19 ----------------- spec/acceptance/nodesets/docker/centos-6.yml | 20 ------------------ spec/acceptance/nodesets/docker/centos-7.yml | 19 ----------------- spec/acceptance/nodesets/docker/debian-7.yml | 18 ---------------- spec/acceptance/nodesets/docker/debian-8.yml | 20 ------------------ spec/acceptance/nodesets/docker/debian-9.yml | 20 ------------------ .../nodesets/docker/ubuntu-12.04.yml | 19 ----------------- .../nodesets/docker/ubuntu-14.04.yml | 21 ------------------- .../nodesets/docker/ubuntu-16.04.yml | 21 ------------------- 9 files changed, 177 deletions(-) delete mode 100644 spec/acceptance/nodesets/docker/centos-5.yml delete mode 100644 spec/acceptance/nodesets/docker/centos-6.yml delete mode 100644 spec/acceptance/nodesets/docker/centos-7.yml delete mode 100644 spec/acceptance/nodesets/docker/debian-7.yml delete mode 100644 spec/acceptance/nodesets/docker/debian-8.yml delete mode 100644 spec/acceptance/nodesets/docker/debian-9.yml delete mode 100644 spec/acceptance/nodesets/docker/ubuntu-12.04.yml delete mode 100644 spec/acceptance/nodesets/docker/ubuntu-14.04.yml delete mode 100644 spec/acceptance/nodesets/docker/ubuntu-16.04.yml diff --git a/spec/acceptance/nodesets/docker/centos-5.yml b/spec/acceptance/nodesets/docker/centos-5.yml deleted file mode 100644 index c17bc3d0..00000000 --- a/spec/acceptance/nodesets/docker/centos-5.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-5-x64: - platform: el-5-x86_64 - hypervisor: docker - image: centos:5 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' - - 'sed -i -e "/mingetty/d" /etc/inittab' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-6.yml b/spec/acceptance/nodesets/docker/centos-6.yml deleted file mode 100644 index d93f884c..00000000 --- a/spec/acceptance/nodesets/docker/centos-6.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-6-x64: - platform: el-6-x86_64 - hypervisor: docker - image: centos:6 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'rm -rf /var/run/network/*' - - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which' - - 'rm /etc/init/tty.conf' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/centos-7.yml b/spec/acceptance/nodesets/docker/centos-7.yml deleted file mode 100644 index 41e924b5..00000000 --- a/spec/acceptance/nodesets/docker/centos-7.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-7-x64: - platform: el-7-x86_64 - hypervisor: docker - image: centos:7 - docker_preserve_image: true - docker_cmd: '["/usr/sbin/init"]' - docker_image_commands: - - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss' - - 'systemctl mask getty@tty1.service' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-7.yml b/spec/acceptance/nodesets/docker/debian-7.yml deleted file mode 100644 index 41b284d3..00000000 --- a/spec/acceptance/nodesets/docker/debian-7.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-7-x64: - platform: debian-7-amd64 - hypervisor: docker - image: debian:7 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get update && apt-get install -y cron locales-all net-tools wget' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-8.yml b/spec/acceptance/nodesets/docker/debian-8.yml deleted file mode 100644 index a630b7ef..00000000 --- a/spec/acceptance/nodesets/docker/debian-8.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-8-x64: - platform: debian-8-amd64 - hypervisor: docker - image: debian:8 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get update && apt-get install -y cron locales-all net-tools wget' - - 'rm -f /usr/sbin/policy-rc.d' - - 'systemctl mask getty@tty1.service getty-static.service' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/debian-9.yml b/spec/acceptance/nodesets/docker/debian-9.yml deleted file mode 100644 index dfc8e9c0..00000000 --- a/spec/acceptance/nodesets/docker/debian-9.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/theforeman/foreman-installer-modulesync -HOSTS: - debian-9-x64: - platform: debian-9-amd64 - hypervisor: docker - image: debian:9 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv' - - 'rm -f /usr/sbin/policy-rc.d' - - 'systemctl mask getty@tty1.service getty-static.service' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/spec/acceptance/nodesets/docker/ubuntu-12.04.yml deleted file mode 100644 index ab77cda4..00000000 --- a/spec/acceptance/nodesets/docker/ubuntu-12.04.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-1204-x64: - platform: ubuntu-12.04-amd64 - hypervisor: docker - image: ubuntu:12.04 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get install -y net-tools wget' - - 'locale-gen en_US.UTF-8' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/spec/acceptance/nodesets/docker/ubuntu-14.04.yml deleted file mode 100644 index ae453044..00000000 --- a/spec/acceptance/nodesets/docker/ubuntu-14.04.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-1404-x64: - platform: ubuntu-14.04-amd64 - hypervisor: docker - image: ubuntu:14.04 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'rm /usr/sbin/policy-rc.d' - - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl' - - 'apt-get install -y net-tools wget apt-transport-https' - - 'locale-gen en_US.UTF-8' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/spec/acceptance/nodesets/docker/ubuntu-16.04.yml deleted file mode 100644 index cd6f3762..00000000 --- a/spec/acceptance/nodesets/docker/ubuntu-16.04.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-1604-x64: - platform: ubuntu-16.04-amd64 - hypervisor: docker - image: ubuntu:16.04 - docker_preserve_image: true - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'systemctl mask getty@tty1.service getty-static.service' - - 'apt-get install -y net-tools wget locales apt-transport-https' - - 'locale-gen en_US.UTF-8' - - 'echo LANG=en_US.UTF-8 > /etc/default/locale' -CONFIG: - trace_limit: 200 - masterless: true -... -# vim: syntax=yaml From f49763ebc248076b59184aa08540b2efb4f51641 Mon Sep 17 00:00:00 2001 From: grsakea Date: Sat, 9 Jun 2018 14:17:42 +0000 Subject: [PATCH 045/380] Add support for Anaconda --- manifests/init.pp | 4 +++- manifests/install.pp | 17 +++++++++++++++++ manifests/params.pp | 2 ++ manifests/pip.pp | 18 +++++++++++------- manifests/pyvenv.pp | 7 ++++++- manifests/virtualenv.pp | 9 ++++++++- spec/classes/python_spec.rb | 10 ++++++++++ spec/defines/pip_spec.rb | 15 +++++++++++++++ 8 files changed, 72 insertions(+), 10 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d0164ee1..258d0677 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -76,7 +76,7 @@ Enum['absent', 'present', 'latest'] $gunicorn = $python::params::gunicorn, Boolean $manage_gunicorn = $python::params::manage_gunicorn, $gunicorn_package_name = $python::params::gunicorn_package_name, - Optional[Enum['pip', 'scl', 'rhscl', '']] $provider = $python::params::provider, + Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']] $provider = $python::params::provider, $valid_versions = $python::params::valid_versions, Hash $python_pips = { }, Hash $python_virtualenvs = { }, @@ -85,6 +85,8 @@ Hash $python_dotfiles = { }, Boolean $use_epel = $python::params::use_epel, $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, + Stdlib::Httpurl $anaconda_installer_url = $python::params::anaconda_installer_url, + Stdlib::Absolutepath $anaconda_install_path = $python::params::anaconda_install_path, ) inherits python::params { $exec_prefix = $provider ? { diff --git a/manifests/install.pp b/manifests/install.pp index a6dad661..1d1572f5 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -171,6 +171,23 @@ Package <| tag == 'python-scl-package' |> -> Package <| tag == 'python-pip-package' |> } + 'anaconda': { + $installer_path = '/var/tmp/anaconda_installer.sh' + + file { $installer_path: + source => $::python::anaconda_installer_url, + mode => '0700', + } + -> exec { 'install_anaconda_python': + command => "${installer_path} -b -p ${::python::anaconda_install_path}", + creates => $::python::anaconda_install_path, + logoutput => true, + } + -> exec { 'install_anaconda_virtualenv': + command => "${::python::anaconda_install_path}/bin/pip install virtualenv", + creates => "${::python::anaconda_install_path}/bin/virtualenv", + } + } default: { package { 'pip': diff --git a/manifests/params.pp b/manifests/params.pp index bec6815c..5dacfc08 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -35,4 +35,6 @@ $rhscl_use_public_repository = true + $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh' + $anaconda_install_path = '/opt/python' } diff --git a/manifests/pip.pp b/manifests/pip.pp index b6d42278..fde7dc7e 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -87,7 +87,6 @@ $log_dir = '/tmp', $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], ) { - $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') @@ -99,6 +98,11 @@ default => '', } + $_path = $python_provider ? { + 'anaconda' => concat(["${::python::anaconda_install_path}/bin"], $path), + default => $path, + } + # Parameter validation if ! $virtualenv { fail('python::pip: virtualenv parameter must not be empty') @@ -213,7 +217,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } else { exec { "pip_install_${name}": @@ -225,7 +229,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } } else { @@ -242,7 +246,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } # @@ -257,7 +261,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } @@ -272,7 +276,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } @@ -287,7 +291,7 @@ cwd => $cwd, environment => $environment, timeout => $timeout, - path => $path, + path => $_path, } } } diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index ec659672..587f1baa 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -68,6 +68,11 @@ default => "${python::exec_prefix}pyvenv-${version}", } + $_path = $::python::provider ? { + 'anaconda' => concat(["${::python::anaconda_install_path}/bin"], $path), + default => $path, + } + if ( $systempkgs == true ) { $system_pkgs_flag = '--system-site-packages' } else { @@ -85,7 +90,7 @@ command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir}", user => $owner, creates => "${venv_dir}/bin/activate", - path => $path, + path => $_path, cwd => '/tmp', environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 638a750b..ad526678 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -97,6 +97,8 @@ $virtualenv = undef ) { include ::python + $python_provider = getparam(Class['python'], 'provider') + $anaconda_path = getparam(Class['python'], 'anaconda_install_path') if $ensure == 'present' { $python = $version ? { @@ -105,6 +107,11 @@ default => "python${version}", } + $_path = $python_provider ? { + 'anaconda' => concat(["${anaconda_path}/bin"], $path), + default => $path, + } + if $virtualenv == undef { $used_virtualenv = 'virtualenv' } else { @@ -175,7 +182,7 @@ command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", - path => $path, + path => $_path, cwd => '/tmp', environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 84b266d5..a82c3d71 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -183,6 +183,16 @@ } end + context 'anaconda' do + let(:params) { { provider: 'anaconda', anaconda_install_path: '/opt/test_path' } } + + it { + is_expected.to contain_file('/var/tmp/anaconda_installer.sh') + is_expected.to contain_exec('install_anaconda_python').with_command('/var/tmp/anaconda_installer -b -p /opt/test_path') + is_expected.to contain_exec('install_anaconda_virtualenv').with_command('/opt/test_path/bin/pip install virtualenv') + } + end + # python::provider context 'default' do let(:params) { { provider: '' } } diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 69d3837a..edc5fe93 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -9,6 +9,9 @@ id: 'root', kernel: 'Linux', lsbdistcodename: 'squeeze', + os: { + family: 'Debian' + }, osfamily: 'Debian', operatingsystem: 'Debian', operatingsystemrelease: '6', @@ -77,6 +80,15 @@ it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } end end + + describe 'path as' do + context 'adds anaconda path to pip invocation if provider is anaconda' do + let(:params) { {} } + let(:pre_condition) { 'class {"::python": provider => "anaconda", anaconda_install_path => "/opt/python3"}' } + + it { is_expected.to contain_exec('pip_install_rpyc').with_path(['/opt/python3/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin']) } + end + end end end @@ -89,6 +101,9 @@ id: 'root', kernel: 'Linux', lsbdistcodename: 'squeeze', + os: { + family: 'Debian' + }, osfamily: 'Debian', operatingsystem: 'Debian', operatingsystemrelease: '6', From 5e68f54a0e31b3b8d8a5ac74dd3436a918c8ef08 Mon Sep 17 00:00:00 2001 From: Franciszek Klajn Date: Tue, 12 Jun 2018 15:21:04 +0200 Subject: [PATCH 046/380] Fix Python version regex According to the rest of the code `version` (if custom) is expected to contain package name with version. --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index a6dad661..d991b971 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -215,7 +215,7 @@ } } - if "${::python::version}" =~ /^3/ { #lint:ignore:only_variable_string + if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string $pip_category = undef $pip_package = 'python3-pip' } elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) { From df8760adc80c86cefd6a72d91a694c913c044465 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 25 Jun 2018 20:24:23 +0200 Subject: [PATCH 047/380] add secret to .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2efe490c..d76a6929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" on: tags: true # all_branches is required to use tags From 8dfff7e4d04e4d9b9ec0b95a444455f98eaabedd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 25 Jun 2018 20:32:26 +0200 Subject: [PATCH 048/380] release 2.0.0 --- CHANGELOG.md | 614 ++++++++++++++++++++++++++++++++++++++++++++++++++ metadata.json | 2 +- 2 files changed, 615 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..1877ad23 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,614 @@ +# Changelog + +All notable changes to this project will be documented in this file. +Each new release typically also includes the latest modulesync defaults. +These should not affect the functionality of the module. + +## [v2.0.0](https://github.com/voxpupuli/puppet-python/tree/v2.0.0) (2018-06-25) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.19.0...v2.0.0) + +**Breaking changes:** + +- Drop Puppet \<4.10 support [\#401](https://github.com/voxpupuli/puppet-python/issues/401) +- Drop Ruby 1.8 support [\#400](https://github.com/voxpupuli/puppet-python/issues/400) +- Drop EOL operatingsystem: Ubuntu 12.04 [\#397](https://github.com/voxpupuli/puppet-python/issues/397) +- Drop EOL operatingsystem: Ubuntu 10.04 [\#396](https://github.com/voxpupuli/puppet-python/issues/396) +- Drop EOL operatingsystem: Debian 7 [\#395](https://github.com/voxpupuli/puppet-python/issues/395) +- Drop EOL operatingsystem: Debian 6 [\#394](https://github.com/voxpupuli/puppet-python/issues/394) +- Drop EOL operatingsystem: CentOS 5 [\#393](https://github.com/voxpupuli/puppet-python/issues/393) + +**Implemented enhancements:** + +- Add support for Anaconda [\#409](https://github.com/voxpupuli/puppet-python/pull/409) ([grsakea](https://github.com/grsakea)) +- Add umask parameter to pip execs [\#368](https://github.com/voxpupuli/puppet-python/pull/368) ([jstaph](https://github.com/jstaph)) + +**Closed issues:** + +- Activity on this project? [\#371](https://github.com/voxpupuli/puppet-python/issues/371) +- module is not compatible with setuptools v34 [\#361](https://github.com/voxpupuli/puppet-python/issues/361) +- So many Warnings [\#351](https://github.com/voxpupuli/puppet-python/issues/351) +- Spec tests time out with ruby 2.3.1 [\#336](https://github.com/voxpupuli/puppet-python/issues/336) +- how to used pip2.7 as provider in RHEL6 [\#290](https://github.com/voxpupuli/puppet-python/issues/290) +- Cannot determine if a package named in the form packagename\[subfeature\] is installed. [\#284](https://github.com/voxpupuli/puppet-python/issues/284) +- Pip install runs on every puppet run. [\#218](https://github.com/voxpupuli/puppet-python/issues/218) + +**Merged pull requests:** + +- Fix Python version regex in install.pp [\#410](https://github.com/voxpupuli/puppet-python/pull/410) ([fklajn-opera](https://github.com/fklajn-opera)) +- Remove docker nodesets [\#408](https://github.com/voxpupuli/puppet-python/pull/408) ([bastelfreak](https://github.com/bastelfreak)) +- Update README compatibility section [\#405](https://github.com/voxpupuli/puppet-python/pull/405) ([rkcpi](https://github.com/rkcpi)) +- add secret for forge deployment via travis [\#404](https://github.com/voxpupuli/puppet-python/pull/404) ([bastelfreak](https://github.com/bastelfreak)) +- Add deprecation notice for the old repository [\#403](https://github.com/voxpupuli/puppet-python/pull/403) ([stankevich](https://github.com/stankevich)) +- virtualenv.pp: make creation of $venv\_dir optional [\#391](https://github.com/voxpupuli/puppet-python/pull/391) ([daylicron](https://github.com/daylicron)) +- add pip support for setuptools extras [\#390](https://github.com/voxpupuli/puppet-python/pull/390) ([bryangwilliam](https://github.com/bryangwilliam)) +- Fix pip wheel checks [\#389](https://github.com/voxpupuli/puppet-python/pull/389) ([genebean](https://github.com/genebean)) + +## [1.19.0](https://github.com/voxpupuli/puppet-python/tree/1.19.0) (2018-04-28) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.18.2...1.19.0) + +**Closed issues:** + +- travis build failures since december? [\#372](https://github.com/voxpupuli/puppet-python/issues/372) +- python-pip has been renamed to python2-pip on el7 epel repo [\#348](https://github.com/voxpupuli/puppet-python/issues/348) +- --no-use-wheel renamed to --no-binary :all: in pip 7.0 and newer [\#309](https://github.com/voxpupuli/puppet-python/issues/309) +- duplicate resource [\#259](https://github.com/voxpupuli/puppet-python/issues/259) +- python::virtualenv does not accept the string 'pip' as per the documentation [\#205](https://github.com/voxpupuli/puppet-python/issues/205) + +**Merged pull requests:** + +- fix for latest versions of setuptools and pip [\#388](https://github.com/voxpupuli/puppet-python/pull/388) ([vchepkov](https://github.com/vchepkov)) +- Fix tests: Pin rake for ruby 1.9.3 [\#387](https://github.com/voxpupuli/puppet-python/pull/387) ([waipeng](https://github.com/waipeng)) +- Support virtualenv for Ubuntu 16.04 [\#386](https://github.com/voxpupuli/puppet-python/pull/386) ([waipeng](https://github.com/waipeng)) +- Set virtualenv package name for Debian stretch [\#383](https://github.com/voxpupuli/puppet-python/pull/383) ([sergiik](https://github.com/sergiik)) +- Update gunicorn.pp - Add manage\_config\_dir [\#382](https://github.com/voxpupuli/puppet-python/pull/382) ([bc-bjoern](https://github.com/bc-bjoern)) +- Support latest puppet versions [\#376](https://github.com/voxpupuli/puppet-python/pull/376) ([ghoneycutt](https://github.com/ghoneycutt)) +- Add python release as available facts [\#355](https://github.com/voxpupuli/puppet-python/pull/355) ([jcpunk](https://github.com/jcpunk)) +- Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([PuppetNinja](https://github.com/PuppetNinja)) +- Ensure value is a string for =~ comparison [\#342](https://github.com/voxpupuli/puppet-python/pull/342) ([ghoneycutt](https://github.com/ghoneycutt)) +- add an alias to the python-dev package [\#334](https://github.com/voxpupuli/puppet-python/pull/334) ([dannygoulder](https://github.com/dannygoulder)) + +## [1.18.2](https://github.com/voxpupuli/puppet-python/tree/1.18.2) (2016-12-12) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.18.1...1.18.2) + +**Closed issues:** + +- EPEL7 python-pip package is called python2-pip; puppet-python won't recognize that it is installed [\#346](https://github.com/voxpupuli/puppet-python/issues/346) + +**Merged pull requests:** + +- Improve support for pip on CentOS7/EPEL [\#347](https://github.com/voxpupuli/puppet-python/pull/347) ([ju5t](https://github.com/ju5t)) + +## [1.18.1](https://github.com/voxpupuli/puppet-python/tree/1.18.1) (2016-12-08) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.2...1.18.1) + +**Closed issues:** + +- New release on the forge? [\#339](https://github.com/voxpupuli/puppet-python/issues/339) + +**Merged pull requests:** + +- Fix testing [\#345](https://github.com/voxpupuli/puppet-python/pull/345) ([ghoneycutt](https://github.com/ghoneycutt)) +- Add name of package to pip uninstall command [\#340](https://github.com/voxpupuli/puppet-python/pull/340) ([dontreboot](https://github.com/dontreboot)) +- EPEL only makes sense on RH systems but not Fedora [\#297](https://github.com/voxpupuli/puppet-python/pull/297) ([jcpunk](https://github.com/jcpunk)) + +## [2.4.2](https://github.com/voxpupuli/puppet-python/tree/2.4.2) (2016-10-28) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.18.0...2.4.2) + +## [1.18.0](https://github.com/voxpupuli/puppet-python/tree/1.18.0) (2016-10-12) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.1...1.18.0) + +**Merged pull requests:** + +- Allow failure for Ruby 2.3.1 [\#337](https://github.com/voxpupuli/puppet-python/pull/337) ([ghoneycutt](https://github.com/ghoneycutt)) +- Add support, tests and documentation for Gentoo [\#335](https://github.com/voxpupuli/puppet-python/pull/335) ([optiz0r](https://github.com/optiz0r)) + +## [2.4.1](https://github.com/voxpupuli/puppet-python/tree/2.4.1) (2016-09-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.17.0...2.4.1) + +## [1.17.0](https://github.com/voxpupuli/puppet-python/tree/1.17.0) (2016-09-16) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.16.0...1.17.0) + +**Closed issues:** + +- No tags [\#330](https://github.com/voxpupuli/puppet-python/issues/330) + +**Merged pull requests:** + +- Fix unescaped backslash in previous pip list addition [\#332](https://github.com/voxpupuli/puppet-python/pull/332) ([rikwasmus](https://github.com/rikwasmus)) +- Do not try to reinstall packages installed via the OS [\#331](https://github.com/voxpupuli/puppet-python/pull/331) ([rikwasmus](https://github.com/rikwasmus)) + +## [1.16.0](https://github.com/voxpupuli/puppet-python/tree/1.16.0) (2016-09-10) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.0...1.16.0) + +**Merged pull requests:** + +- RHSCL Repository installation made optional [\#328](https://github.com/voxpupuli/puppet-python/pull/328) ([diLLec](https://github.com/diLLec)) + +## [2.4.0](https://github.com/voxpupuli/puppet-python/tree/2.4.0) (2016-09-04) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.3.1...2.4.0) + +## [2.3.1](https://github.com/voxpupuli/puppet-python/tree/2.3.1) (2016-08-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.3.0...2.3.1) + +## [2.3.0](https://github.com/voxpupuli/puppet-python/tree/2.3.0) (2016-08-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.15.0...2.3.0) + +## [1.15.0](https://github.com/voxpupuli/puppet-python/tree/1.15.0) (2016-08-24) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.14.2...1.15.0) + +**Merged pull requests:** + +- Strict vars [\#299](https://github.com/voxpupuli/puppet-python/pull/299) ([ghoneycutt](https://github.com/ghoneycutt)) + +## [1.14.2](https://github.com/voxpupuli/puppet-python/tree/1.14.2) (2016-08-23) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.14.1...1.14.2) + +**Merged pull requests:** + +- Add support for Ruby 2.3.1 [\#326](https://github.com/voxpupuli/puppet-python/pull/326) ([ghoneycutt](https://github.com/ghoneycutt)) + +## [1.14.1](https://github.com/voxpupuli/puppet-python/tree/1.14.1) (2016-08-22) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.14.0...1.14.1) + +**Closed issues:** + +- Not using index when doing pip search for latest [\#321](https://github.com/voxpupuli/puppet-python/issues/321) +- regex for pip explicit version \( ensure =\> '1.0a1' \) broken [\#310](https://github.com/voxpupuli/puppet-python/issues/310) +- python::pip install args needs extra space to separate multiple args [\#162](https://github.com/voxpupuli/puppet-python/issues/162) + +**Merged pull requests:** + +- Fix travis [\#324](https://github.com/voxpupuli/puppet-python/pull/324) ([ghoneycutt](https://github.com/ghoneycutt)) +- Search index when staying at the latest version [\#322](https://github.com/voxpupuli/puppet-python/pull/322) ([mterzo](https://github.com/mterzo)) +- Use a single grep instead of a double pipe [\#320](https://github.com/voxpupuli/puppet-python/pull/320) ([rcalixte](https://github.com/rcalixte)) +- Add "args" option to gunicorn config [\#319](https://github.com/voxpupuli/puppet-python/pull/319) ([kronos-pbrideau](https://github.com/kronos-pbrideau)) +- Patch to support Centos 7 in bootstrap [\#318](https://github.com/voxpupuli/puppet-python/pull/318) ([asasfu](https://github.com/asasfu)) + +## [1.14.0](https://github.com/voxpupuli/puppet-python/tree/1.14.0) (2016-07-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.2.1...1.14.0) + +**Merged pull requests:** + +- Fix regex for pip package versions [\#317](https://github.com/voxpupuli/puppet-python/pull/317) ([mdean](https://github.com/mdean)) + +## [2.2.1](https://github.com/voxpupuli/puppet-python/tree/2.2.1) (2016-07-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.13.0...2.2.1) + +## [1.13.0](https://github.com/voxpupuli/puppet-python/tree/1.13.0) (2016-07-18) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.2.0...1.13.0) + +**Closed issues:** + +- SCL package installation returns an error [\#308](https://github.com/voxpupuli/puppet-python/issues/308) +- Can't install pip3 with Ubuntu [\#287](https://github.com/voxpupuli/puppet-python/issues/287) +- SCL python27: add a workaround for libpython2.7.so.1.0 issue \(LD\_LIBRARY\_PATH\) [\#234](https://github.com/voxpupuli/puppet-python/issues/234) + +**Merged pull requests:** + +- Set gunicorn package name on RedHat family [\#316](https://github.com/voxpupuli/puppet-python/pull/316) ([kronos-pbrideau](https://github.com/kronos-pbrideau)) +- Tweaks to get travis ci tests working again [\#315](https://github.com/voxpupuli/puppet-python/pull/315) ([mbmilligan](https://github.com/mbmilligan)) +- fix pip failing in virtualenv under SCL [\#314](https://github.com/voxpupuli/puppet-python/pull/314) ([mbmilligan](https://github.com/mbmilligan)) +- Ubuntu 16.04 has a + in python -V output at the end of version. [\#313](https://github.com/voxpupuli/puppet-python/pull/313) ([KlavsKlavsen](https://github.com/KlavsKlavsen)) +- use 'version' name specified directly [\#312](https://github.com/voxpupuli/puppet-python/pull/312) ([epleterte](https://github.com/epleterte)) +- Lowercase package name for centos-release-scl [\#304](https://github.com/voxpupuli/puppet-python/pull/304) ([prozach](https://github.com/prozach)) +- Fixed missing comma in \#301 [\#302](https://github.com/voxpupuli/puppet-python/pull/302) ([steverecio](https://github.com/steverecio)) +- Configure workers [\#301](https://github.com/voxpupuli/puppet-python/pull/301) ([steverecio](https://github.com/steverecio)) +- Fix support for Ruby 1.8.7 [\#298](https://github.com/voxpupuli/puppet-python/pull/298) ([ghoneycutt](https://github.com/ghoneycutt)) + +## [2.2.0](https://github.com/voxpupuli/puppet-python/tree/2.2.0) (2016-05-31) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.1.0...2.2.0) + +## [2.1.0](https://github.com/voxpupuli/puppet-python/tree/2.1.0) (2016-05-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.2...2.1.0) + +## [2.0.2](https://github.com/voxpupuli/puppet-python/tree/2.0.2) (2016-05-22) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.1...2.0.2) + +## [2.0.1](https://github.com/voxpupuli/puppet-python/tree/2.0.1) (2016-05-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.0...2.0.1) + +## [2.0.0](https://github.com/voxpupuli/puppet-python/tree/2.0.0) (2016-05-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.12.0...2.0.0) + +**Closed issues:** + +- Patch Release [\#295](https://github.com/voxpupuli/puppet-python/issues/295) + +## [1.12.0](https://github.com/voxpupuli/puppet-python/tree/1.12.0) (2016-03-27) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.11.0...1.12.0) + +**Closed issues:** + +- Puppet-lint prints warnings [\#289](https://github.com/voxpupuli/puppet-python/issues/289) +- Release a new version? [\#285](https://github.com/voxpupuli/puppet-python/issues/285) +- pip is installed on every invocation when pip is installed from pip [\#256](https://github.com/voxpupuli/puppet-python/issues/256) + +**Merged pull requests:** + +- Correct use of version param as it relates to package installation [\#293](https://github.com/voxpupuli/puppet-python/pull/293) ([evidex](https://github.com/evidex)) +- Fix linting issues from \#289 [\#292](https://github.com/voxpupuli/puppet-python/pull/292) ([evidex](https://github.com/evidex)) +- bugfix: test if virtualenv\_version is defined [\#288](https://github.com/voxpupuli/puppet-python/pull/288) ([vicinus](https://github.com/vicinus)) +- Fixes \#256 [\#286](https://github.com/voxpupuli/puppet-python/pull/286) ([joshuaspence](https://github.com/joshuaspence)) + +## [1.11.0](https://github.com/voxpupuli/puppet-python/tree/1.11.0) (2016-01-31) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.10.0...1.11.0) + +**Closed issues:** + +- installing virtualenv broken in master [\#271](https://github.com/voxpupuli/puppet-python/issues/271) +- puppet not install the latest version of pip [\#268](https://github.com/voxpupuli/puppet-python/issues/268) +- Call, 'versioncmp' parameter 'a' expects a String value, got Undef [\#262](https://github.com/voxpupuli/puppet-python/issues/262) +- pip install runs every time for packages with underscores in the name [\#258](https://github.com/voxpupuli/puppet-python/issues/258) +- New version release? [\#257](https://github.com/voxpupuli/puppet-python/issues/257) + +**Merged pull requests:** + +- add SCL specific exec\_prefix [\#283](https://github.com/voxpupuli/puppet-python/pull/283) ([iakovgan](https://github.com/iakovgan)) +- python::pip expects \(un\)install-args to be strings [\#282](https://github.com/voxpupuli/puppet-python/pull/282) ([adamcstephens](https://github.com/adamcstephens)) +- Made virtualenv compatible with RHSCL/SCL [\#281](https://github.com/voxpupuli/puppet-python/pull/281) ([chrisfu](https://github.com/chrisfu)) +- Force virtualenv\_version to be a string. [\#280](https://github.com/voxpupuli/puppet-python/pull/280) ([dansajner](https://github.com/dansajner)) +- Update README to reflect actual defaults [\#279](https://github.com/voxpupuli/puppet-python/pull/279) ([ColinHebert](https://github.com/ColinHebert)) +- Add parameter path to pip manifest [\#277](https://github.com/voxpupuli/puppet-python/pull/277) ([BasLangenberg](https://github.com/BasLangenberg)) +- add configurable log level for gunicorn and unit tests [\#275](https://github.com/voxpupuli/puppet-python/pull/275) ([xaniasd](https://github.com/xaniasd)) +- new manage\_requirements argument to address issue 273 [\#274](https://github.com/voxpupuli/puppet-python/pull/274) ([rosenbergj](https://github.com/rosenbergj)) +- bugfix install pip on centos6 using scl [\#270](https://github.com/voxpupuli/puppet-python/pull/270) ([netors](https://github.com/netors)) +- fixed python dev install when using scl [\#269](https://github.com/voxpupuli/puppet-python/pull/269) ([netors](https://github.com/netors)) +- Revert "Update virtualenv\_version.rb" [\#267](https://github.com/voxpupuli/puppet-python/pull/267) ([shivapoudel](https://github.com/shivapoudel)) +- Update virtualenv\_version.rb [\#265](https://github.com/voxpupuli/puppet-python/pull/265) ([shivapoudel](https://github.com/shivapoudel)) +- Update params.pp [\#263](https://github.com/voxpupuli/puppet-python/pull/263) ([philippeback](https://github.com/philippeback)) +- Bug virtualenv instead of virtualenv-$version [\#261](https://github.com/voxpupuli/puppet-python/pull/261) ([Asher256](https://github.com/Asher256)) +- Addressing stankevich/puppet-python issue \#258. [\#260](https://github.com/voxpupuli/puppet-python/pull/260) ([rpocase](https://github.com/rpocase)) + +## [1.10.0](https://github.com/voxpupuli/puppet-python/tree/1.10.0) (2015-10-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.8...1.10.0) + +**Closed issues:** + +- known puppet bug on CentOS/RHEL 6/7 [\#225](https://github.com/voxpupuli/puppet-python/issues/225) + +**Merged pull requests:** + +- RedHat has different virtualenv packages for different pythons [\#255](https://github.com/voxpupuli/puppet-python/pull/255) ([adamcstephens](https://github.com/adamcstephens)) +- Create symlink for pip-python with pip provider [\#254](https://github.com/voxpupuli/puppet-python/pull/254) ([skpy](https://github.com/skpy)) +- use full path on commands [\#253](https://github.com/voxpupuli/puppet-python/pull/253) ([skpy](https://github.com/skpy)) +- Allow setting a custom index for `python::pip` [\#251](https://github.com/voxpupuli/puppet-python/pull/251) ([joshuaspence](https://github.com/joshuaspence)) + +## [1.9.8](https://github.com/voxpupuli/puppet-python/tree/1.9.8) (2015-09-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.7...1.9.8) + +**Closed issues:** + +- Unable to install pip using pip provider [\#243](https://github.com/voxpupuli/puppet-python/issues/243) +- Not possible to install latest version of Python [\#240](https://github.com/voxpupuli/puppet-python/issues/240) + +**Merged pull requests:** + +- Fix RSpec deprecated messages [\#250](https://github.com/voxpupuli/puppet-python/pull/250) ([tremblaysimon](https://github.com/tremblaysimon)) +- Minor improvement for bootstrapped pip installation [\#249](https://github.com/voxpupuli/puppet-python/pull/249) ([joshuaspence](https://github.com/joshuaspence)) +- Fix an issue with gunicorn [\#248](https://github.com/voxpupuli/puppet-python/pull/248) ([joshuaspence](https://github.com/joshuaspence)) +- Support group parameter for python::pip resource [\#247](https://github.com/voxpupuli/puppet-python/pull/247) ([tremblaysimon](https://github.com/tremblaysimon)) +- Various tidying up [\#246](https://github.com/voxpupuli/puppet-python/pull/246) ([joshuaspence](https://github.com/joshuaspence)) +- Bootstrap pip installation [\#244](https://github.com/voxpupuli/puppet-python/pull/244) ([joshuaspence](https://github.com/joshuaspence)) +- Various tidying up [\#242](https://github.com/voxpupuli/puppet-python/pull/242) ([joshuaspence](https://github.com/joshuaspence)) +- Allow custom versions to be installed [\#241](https://github.com/voxpupuli/puppet-python/pull/241) ([joshuaspence](https://github.com/joshuaspence)) +- Check that we have results before returning a value [\#238](https://github.com/voxpupuli/puppet-python/pull/238) ([xaque208](https://github.com/xaque208)) +- Adjust test code to pass syntax checker [\#237](https://github.com/voxpupuli/puppet-python/pull/237) ([fluential](https://github.com/fluential)) + +## [1.9.7](https://github.com/voxpupuli/puppet-python/tree/1.9.7) (2015-08-21) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.6...1.9.7) + +**Closed issues:** + +- Exec\<| tag == 'python-virtualenv' |\> changes and breaks the API [\#230](https://github.com/voxpupuli/puppet-python/issues/230) + +## [1.9.6](https://github.com/voxpupuli/puppet-python/tree/1.9.6) (2015-08-01) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.5...1.9.6) + +**Implemented enhancements:** + +- Manage compilers? [\#118](https://github.com/voxpupuli/puppet-python/issues/118) + +**Fixed bugs:** + +- Dupilicate declaration for requirement file [\#112](https://github.com/voxpupuli/puppet-python/issues/112) +- Resource order restrictions? [\#76](https://github.com/voxpupuli/puppet-python/issues/76) + +**Closed issues:** + +- May attempt to create virtualenvs before package install [\#215](https://github.com/voxpupuli/puppet-python/issues/215) +- virtualenv does not use SCL path from environment [\#212](https://github.com/voxpupuli/puppet-python/issues/212) +- Cut a new release [\#206](https://github.com/voxpupuli/puppet-python/issues/206) +- Doesn't work with python3 [\#204](https://github.com/voxpupuli/puppet-python/issues/204) +- Unable to use virtualenv in Debian Jessie [\#194](https://github.com/voxpupuli/puppet-python/issues/194) +- Support for SCL? [\#189](https://github.com/voxpupuli/puppet-python/issues/189) +- I am trying to install python version 2.7, It doesn't work. [\#185](https://github.com/voxpupuli/puppet-python/issues/185) +- facts broken on all systems [\#184](https://github.com/voxpupuli/puppet-python/issues/184) +- Documentation conflicts itself on whether or not pip must be explictly specified. [\#160](https://github.com/voxpupuli/puppet-python/issues/160) + +## [1.9.5](https://github.com/voxpupuli/puppet-python/tree/1.9.5) (2015-07-05) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.4...1.9.5) + +**Implemented enhancements:** + +- include epel for RedHat [\#115](https://github.com/voxpupuli/puppet-python/issues/115) + +**Closed issues:** + +- python-pip requires EPEL on Redhat/CentOs 6 and 7 [\#196](https://github.com/voxpupuli/puppet-python/issues/196) +- Is it possible to add a support for ipython? [\#195](https://github.com/voxpupuli/puppet-python/issues/195) +- New Feature: Pip installing specific version/tag out of VCS? [\#149](https://github.com/voxpupuli/puppet-python/issues/149) + +## [1.9.4](https://github.com/voxpupuli/puppet-python/tree/1.9.4) (2015-04-17) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.3...1.9.4) + +## [1.9.3](https://github.com/voxpupuli/puppet-python/tree/1.9.3) (2015-04-17) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.2...1.9.3) + +**Closed issues:** + +- Bump Version [\#190](https://github.com/voxpupuli/puppet-python/issues/190) + +## [1.9.2](https://github.com/voxpupuli/puppet-python/tree/1.9.2) (2015-04-17) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.1...1.9.2) + +## [1.9.1](https://github.com/voxpupuli/puppet-python/tree/1.9.1) (2015-03-27) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.0...1.9.1) + +**Closed issues:** + +- python::pip hangs with ensure "latest" behind a proxy server [\#170](https://github.com/voxpupuli/puppet-python/issues/170) +- Parameter cwd failed on Exec\[pip\_install\_rpyc\]: cwd must be a fully qualified path [\#165](https://github.com/voxpupuli/puppet-python/issues/165) +- 'require puppet' forces puppet to load pre-maturely [\#163](https://github.com/voxpupuli/puppet-python/issues/163) + +## [1.9.0](https://github.com/voxpupuli/puppet-python/tree/1.9.0) (2015-03-18) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.8.3...1.9.0) + +**Fixed bugs:** + +- virtualenv broken for python3 [\#24](https://github.com/voxpupuli/puppet-python/issues/24) + +**Closed issues:** + +- Missing Gunicorn Parameters [\#167](https://github.com/voxpupuli/puppet-python/issues/167) +- python::pip downgrade to older versions fails [\#150](https://github.com/voxpupuli/puppet-python/issues/150) + +## [1.8.3](https://github.com/voxpupuli/puppet-python/tree/1.8.3) (2015-02-04) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.8.2...1.8.3) + +**Implemented enhancements:** + +- Manage Python related .dotfiles \(for a user\) [\#87](https://github.com/voxpupuli/puppet-python/issues/87) + +## [1.8.2](https://github.com/voxpupuli/puppet-python/tree/1.8.2) (2014-12-03) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.8.1...1.8.2) + +## [1.8.1](https://github.com/voxpupuli/puppet-python/tree/1.8.1) (2014-12-02) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.8.0...1.8.1) + +## [1.8.0](https://github.com/voxpupuli/puppet-python/tree/1.8.0) (2014-11-30) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.16...1.8.0) + +**Closed issues:** + +- Facts cannot be loaded on the first puppet run due to missing rubygems gem [\#153](https://github.com/voxpupuli/puppet-python/issues/153) +- Please publish a new version in forge [\#152](https://github.com/voxpupuli/puppet-python/issues/152) +- Could not retrieve local facts: uninitialized constant Gem [\#151](https://github.com/voxpupuli/puppet-python/issues/151) + +## [1.7.16](https://github.com/voxpupuli/puppet-python/tree/1.7.16) (2014-11-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.15...1.7.16) + +**Implemented enhancements:** + +- Installing pip module via github [\#81](https://github.com/voxpupuli/puppet-python/issues/81) + +**Fixed bugs:** + +- python::pip Specifying a local path in url fails [\#91](https://github.com/voxpupuli/puppet-python/issues/91) + +**Closed issues:** + +- puppet-python fails to run on Ubuntu 12.04 [\#145](https://github.com/voxpupuli/puppet-python/issues/145) +- Specify package versions [\#144](https://github.com/voxpupuli/puppet-python/issues/144) +- Compatibility with puppet 2.7? [\#139](https://github.com/voxpupuli/puppet-python/issues/139) + +## [1.7.15](https://github.com/voxpupuli/puppet-python/tree/1.7.15) (2014-11-04) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.14...1.7.15) + +**Closed issues:** + +- Invalid parameter allow\_virtual [\#140](https://github.com/voxpupuli/puppet-python/issues/140) + +## [1.7.14](https://github.com/voxpupuli/puppet-python/tree/1.7.14) (2014-10-30) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.13...1.7.14) + +**Closed issues:** + +- Gunicorn timeout hardcoded in template [\#137](https://github.com/voxpupuli/puppet-python/issues/137) +- Problem with Package defaults warning [\#122](https://github.com/voxpupuli/puppet-python/issues/122) + +## [1.7.13](https://github.com/voxpupuli/puppet-python/tree/1.7.13) (2014-10-22) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.12...1.7.13) + +**Closed issues:** + +- Gunicorn does not allow passing in a list of environment variables [\#132](https://github.com/voxpupuli/puppet-python/issues/132) + +## [1.7.12](https://github.com/voxpupuli/puppet-python/tree/1.7.12) (2014-10-18) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.11...1.7.12) + +**Closed issues:** + +- 'system' or any other version of python doesn't work, doesn't get validated [\#129](https://github.com/voxpupuli/puppet-python/issues/129) +- Could not look up qualified variable '::python::install::valid\_versions' [\#126](https://github.com/voxpupuli/puppet-python/issues/126) + +## [1.7.11](https://github.com/voxpupuli/puppet-python/tree/1.7.11) (2014-10-11) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.10...1.7.11) + +**Closed issues:** + +- Unable to customize `APP\_MODULE` variable in gunicorn template [\#127](https://github.com/voxpupuli/puppet-python/issues/127) +- New release on the Puppet forge [\#125](https://github.com/voxpupuli/puppet-python/issues/125) + +## [1.7.10](https://github.com/voxpupuli/puppet-python/tree/1.7.10) (2014-09-25) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.9...1.7.10) + +**Implemented enhancements:** + +- Add support to python-pyenv [\#113](https://github.com/voxpupuli/puppet-python/issues/113) +- Multiple python versions [\#79](https://github.com/voxpupuli/puppet-python/issues/79) +- use ensure\_packages [\#68](https://github.com/voxpupuli/puppet-python/issues/68) +- Allow extra flags when installing from requirement file [\#66](https://github.com/voxpupuli/puppet-python/issues/66) + +**Fixed bugs:** + +- There is listing of 2 similar depedency [\#111](https://github.com/voxpupuli/puppet-python/issues/111) + +**Closed issues:** + +- pip =\> true, but no python-pip installed on CentOS 6.5 [\#124](https://github.com/voxpupuli/puppet-python/issues/124) +- Could not match $\(ensure at pip.pp:104 [\#123](https://github.com/voxpupuli/puppet-python/issues/123) +- Add the forge module link in github project [\#110](https://github.com/voxpupuli/puppet-python/issues/110) +- Add support to travis-ci build status [\#106](https://github.com/voxpupuli/puppet-python/issues/106) +- Could not start Service\[gunicorn\] [\#83](https://github.com/voxpupuli/puppet-python/issues/83) +- python::pip - empty pkgname is silently ignored [\#67](https://github.com/voxpupuli/puppet-python/issues/67) +- python::requirements interferes with managing requirements.txt if not explicitly in a file resource [\#64](https://github.com/voxpupuli/puppet-python/issues/64) +- Manifests using the module aren't testable in windows [\#27](https://github.com/voxpupuli/puppet-python/issues/27) +- Can not install the same packages in different virtualenvs [\#18](https://github.com/voxpupuli/puppet-python/issues/18) + +## [1.7.9](https://github.com/voxpupuli/puppet-python/tree/1.7.9) (2014-08-10) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.8...1.7.9) + +## [1.7.8](https://github.com/voxpupuli/puppet-python/tree/1.7.8) (2014-07-31) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.7...1.7.8) + +**Closed issues:** + +- Need sudo to install pip [\#96](https://github.com/voxpupuli/puppet-python/issues/96) +- virtualenv / systempkgs and fact precedence [\#94](https://github.com/voxpupuli/puppet-python/issues/94) + +## [1.7.7](https://github.com/voxpupuli/puppet-python/tree/1.7.7) (2014-07-17) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.6...1.7.7) + +**Closed issues:** + +- Need a better way to deal with wheels when using pip [\#53](https://github.com/voxpupuli/puppet-python/issues/53) +- Wheel support? [\#10](https://github.com/voxpupuli/puppet-python/issues/10) + +## [1.7.6](https://github.com/voxpupuli/puppet-python/tree/1.7.6) (2014-07-07) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.5...1.7.6) + +## [1.7.5](https://github.com/voxpupuli/puppet-python/tree/1.7.5) (2014-05-07) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.4...1.7.5) + +## [1.7.4](https://github.com/voxpupuli/puppet-python/tree/1.7.4) (2014-04-24) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.3...1.7.4) + +## [1.7.3](https://github.com/voxpupuli/puppet-python/tree/1.7.3) (2014-04-24) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.2...1.7.3) + +## [1.7.2](https://github.com/voxpupuli/puppet-python/tree/1.7.2) (2014-04-08) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.1...1.7.2) + +**Closed issues:** + +- Remove redundant pkgname [\#74](https://github.com/voxpupuli/puppet-python/issues/74) +- Facter scripts raise warnings [\#69](https://github.com/voxpupuli/puppet-python/issues/69) + +## [1.7.1](https://github.com/voxpupuli/puppet-python/tree/1.7.1) (2014-03-25) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.7.0...1.7.1) + +## [1.7.0](https://github.com/voxpupuli/puppet-python/tree/1.7.0) (2014-03-18) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.6.6...1.7.0) + +**Closed issues:** + +- pip wheel error [\#70](https://github.com/voxpupuli/puppet-python/issues/70) +- Don't try to reinstall pip packages on every Puppet run [\#59](https://github.com/voxpupuli/puppet-python/issues/59) + +## [1.6.6](https://github.com/voxpupuli/puppet-python/tree/1.6.6) (2014-03-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.6.5...1.6.6) + +## [1.6.5](https://github.com/voxpupuli/puppet-python/tree/1.6.5) (2014-03-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.6.4...1.6.5) + +**Closed issues:** + +- Versions are not tagged in github as in puppet forge [\#63](https://github.com/voxpupuli/puppet-python/issues/63) + +## [1.6.4](https://github.com/voxpupuli/puppet-python/tree/1.6.4) (2014-03-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/ed137893babebabdfdb5adf44d1a52272093ce8b...1.6.4) + +**Closed issues:** + +- Could not retrieve pip\_version: undefined method [\#61](https://github.com/voxpupuli/puppet-python/issues/61) +- New release on the forge? [\#58](https://github.com/voxpupuli/puppet-python/issues/58) +- If virtualenv isn't installed, it isn't properly detected or installed. [\#50](https://github.com/voxpupuli/puppet-python/issues/50) +- IOError: \[Errno 26\] Text file busy [\#46](https://github.com/voxpupuli/puppet-python/issues/46) +- Add support for Scientific Linux [\#39](https://github.com/voxpupuli/puppet-python/issues/39) +- python::pip doesn't find pip command [\#31](https://github.com/voxpupuli/puppet-python/issues/31) +- Incorrect log file name option in pip command [\#28](https://github.com/voxpupuli/puppet-python/issues/28) +- Resource failed with ArgumentError [\#26](https://github.com/voxpupuli/puppet-python/issues/26) +- Upload to the forge [\#25](https://github.com/voxpupuli/puppet-python/issues/25) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/metadata.json b/metadata.json index 5b83d994..e0903cce 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "1.19.0", + "version": "2.0.0", "author": "stankevich", "summary": "Python Module", "license": "Apache-2.0", From b5c679819b56868770cecb79089bb653634e7523 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 25 Jun 2018 20:43:42 +0200 Subject: [PATCH 049/380] [blacksmith] Bump version to 2.0.1-rc0 --- metadata.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/metadata.json b/metadata.json index e0903cce..e029930f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.0.0", + "version": "2.0.1-rc0", "author": "stankevich", "summary": "Python Module", "license": "Apache-2.0", @@ -53,7 +53,13 @@ } ], "dependencies": [ - {"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 6.0.0"}, - {"name":"stahnma/epel","version_requirement":">= 1.2.2 < 2.0.0"} + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 4.6.0 < 6.0.0" + }, + { + "name": "stahnma/epel", + "version_requirement": ">= 1.2.2 < 2.0.0" + } ] } From c86dd5d4d93557e1241eb874194c3382779459e3 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 9 Jul 2018 16:51:00 -0400 Subject: [PATCH 050/380] support for providing pip3 provider w/ tests. Modified readme 4 examples --- README.md | 25 ++++++++++++++++++++++ manifests/pip.pp | 45 ++++++++++++++++++++++----------------- manifests/requirements.pp | 37 ++++++++++++++++++-------------- spec/defines/pip_spec.rb | 20 +++++++++++++++++ 4 files changed, 91 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 4011d693..544826a8 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic **use_epel** - Boolean to determine if the epel class is used. Default: true on RHEL like systems, false otherwise +*Install Python from system python* ```puppet class { 'python' : version => 'system', @@ -66,6 +67,15 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic gunicorn => 'absent', } ``` +*Install Python 3 from the scl repo* +```puppet + class { 'python' : + ensure => 'present', + version => 'rh-python36-python', + dev => 'present', + virtualenv => 'present', + } +``` ### python::pip @@ -77,6 +87,8 @@ Installs and manages packages from pip. **virtualenv** - virtualenv to run pip in. Default: system (no virtualenv) +**pip_provider** - pip provider to execute pip with. Default: pip. + **url** - URL to install from. Default: none **owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root @@ -94,6 +106,8 @@ Installs and manages packages from pip. **uninstall_args** - String of additional flags to pass to pip during uninstall. Default: none **timeout** - Timeout for the pip install command. Defaults to 1800. + +*Install cx_Oracle with pip* ```puppet python::pip { 'cx_Oracle' : pkgname => 'cx_Oracle', @@ -106,6 +120,17 @@ Installs and manages packages from pip. timeout => 1800, } ``` +*Install Requests with pip3* +```puppet + python::pip { 'requests' : + ensure => 'present', + pkgname => 'requests', + pip_provider => 'pip3', + virtualenv => '/var/www/project1', + owner => 'root', + timeout => 1800 + } +``` ### python::requirements diff --git a/manifests/pip.pp b/manifests/pip.pp index fde7dc7e..755081a3 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -16,6 +16,9 @@ # [*virtualenv*] # virtualenv to run pip in. # +# [*pip_provider*] +# version of pip you wish to use. Default: pip +# # [*url*] # URL to install from. Default: none # @@ -66,26 +69,28 @@ # # Sergey Stankevich # Fotis Gimian +# Daniel Quackenbush # define python::pip ( - $pkgname = $name, - $ensure = present, - $virtualenv = 'system', - $url = false, - $owner = 'root', - $group = 'root', - $umask = undef, - $index = false, - $proxy = false, - $egg = false, - $editable = false, - $environment = [], - $extras = [], - $install_args = '', - $uninstall_args = '', - $timeout = 1800, - $log_dir = '/tmp', - $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + $pkgname = $name, + $ensure = present, + $virtualenv = 'system', + Enum['pip', 'pip3'] $pip_provider = 'pip', + $url = false, + $owner = 'root', + $group = 'root', + $umask = undef, + $index = false, + $proxy = false, + $egg = false, + $editable = false, + $environment = [], + $extras = [], + $install_args = '', + $uninstall_args = '', + $timeout = 1800, + $log_dir = '/tmp', + $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], ) { $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') @@ -125,8 +130,8 @@ } $pip_env = $virtualenv ? { - 'system' => "${exec_prefix}pip", - default => "${exec_prefix}${virtualenv}/bin/pip", + 'system' => "${exec_prefix}${pip_provider}", + default => "${exec_prefix}${virtualenv}/bin/${pip_provider}", } $pypi_index = $index ? { diff --git a/manifests/requirements.pp b/manifests/requirements.pp index d2a64bf4..ffdfd420 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -10,6 +10,9 @@ # [*virtualenv*] # virtualenv to run pip in. Default: system-wide # +# [*pip_provider*] +# version of pip you wish to use. Default: pip +# # [*owner*] # The owner of the virtualenv being manipulated. Default: root # @@ -62,22 +65,24 @@ # Sergey Stankevich # Ashley Penney # Fotis Gimian +# Daniel Quackenbush # define python::requirements ( - $requirements = $name, - $virtualenv = 'system', - $owner = 'root', - $group = 'root', - $proxy = false, - $src = false, - $environment = [], - $forceupdate = false, - $cwd = undef, - $extra_pip_args = '', - $manage_requirements = true, - $fix_requirements_owner = true, - $log_dir = '/tmp', - $timeout = 1800, + $requirements = $name, + $virtualenv = 'system', + Enum['pip', 'pip3'] $pip_provider = 'pip', + $owner = 'root', + $group = 'root', + $proxy = false, + $src = false, + $environment = [], + $forceupdate = false, + $cwd = undef, + $extra_pip_args = '', + $manage_requirements = true, + $fix_requirements_owner = true, + $log_dir = '/tmp', + $timeout = 1800, ) { include ::python @@ -100,8 +105,8 @@ } $pip_env = $virtualenv ? { - 'system' => "${::python::exec_prefix} pip", - default => "${::python::exec_prefix} ${virtualenv}/bin/pip", + 'system' => "${::python::exec_prefix} ${pip_provider}", + default => "${::python::exec_prefix} ${virtualenv}/bin/${pip_provider}", } $proxy_flag = $proxy ? { diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index edc5fe93..a040beec 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -38,6 +38,26 @@ end end + describe 'pip_provide as' do + context 'defaults to pip' do + let(:params) { {} } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command(%r{pip}) } + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{pip3}) } + end + context 'use pip instead of pip3 when specified' do + let(:params) { { pip_provider: 'pip' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command(%r{pip}) } + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{pip3}) } + end + context 'use pip3 instead of pip when specified' do + let(:params) { { pip_provider: 'pip3' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command(%r{pip3}) } + end + end + describe 'proxy as' do context 'defaults to empty' do let(:params) { {} } From 4d3dbfb13861d198bef3bd9e5263c29ca81a5dc8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 9 Jul 2018 23:06:26 +0200 Subject: [PATCH 051/380] release 2.1.0 --- CHANGELOG.md | 14 ++++++++++++++ metadata.json | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1877ad23..2361ec5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v2.1.0](https://github.com/voxpupuli/puppet-python/tree/v2.1.0) (2018-07-09) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.0.0...v2.1.0) + +**Implemented enhancements:** + +- support for providing pip3 provider w/ tests. Modified readme 4 examples [\#414](https://github.com/voxpupuli/puppet-python/pull/414) ([danquack](https://github.com/danquack)) + +**Closed issues:** + +- How to deploy pip package to rhscl python34 [\#377](https://github.com/voxpupuli/puppet-python/issues/377) +- CentOS 7 with Python3 does not work [\#303](https://github.com/voxpupuli/puppet-python/issues/303) + ## [v2.0.0](https://github.com/voxpupuli/puppet-python/tree/v2.0.0) (2018-06-25) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.19.0...v2.0.0) @@ -20,6 +33,7 @@ These should not affect the functionality of the module. **Implemented enhancements:** +- Add Debian 9 Support [\#398](https://github.com/voxpupuli/puppet-python/issues/398) - Add support for Anaconda [\#409](https://github.com/voxpupuli/puppet-python/pull/409) ([grsakea](https://github.com/grsakea)) - Add umask parameter to pip execs [\#368](https://github.com/voxpupuli/puppet-python/pull/368) ([jstaph](https://github.com/jstaph)) diff --git a/metadata.json b/metadata.json index e029930f..6f99c671 100644 --- a/metadata.json +++ b/metadata.json @@ -1,7 +1,7 @@ { "name": "puppet-python", - "version": "2.0.1-rc0", - "author": "stankevich", + "version": "2.1.0", + "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", "source": "git://github.com/voxpupuli/puppet-python.git", From c01882b60a183d3df6f2579a2d2f7476b282cbe3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 10 Jul 2018 18:01:01 +0200 Subject: [PATCH 052/380] [blacksmith] Bump version to 2.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 6f99c671..822de9e1 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.1.0", + "version": "2.1.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 696640d624f23fd775aca518b2b3911a748e3d36 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 15 Jul 2018 10:14:56 +0200 Subject: [PATCH 053/380] modulesync 1.9.3 --- .msync.yml | 2 +- .travis.yml | 2 +- Gemfile | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.msync.yml b/.msync.yml index 1a132115..c39f6b7d 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.2' +modulesync_config_version: '1.9.3' diff --git a/.travis.yml b/.travis.yml index d76a6929..2efe490c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" + secure: "" on: tags: true # all_branches is required to use tags diff --git a/Gemfile b/Gemfile index 1527b391..8da95fb3 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.6.0', :require => false + gem 'puppetlabs_spec_helper', '~> 2.6', :require => false gem 'rspec-puppet', '~> 2.5', :require => false gem 'rspec-puppet-facts', :require => false gem 'rspec-puppet-utils', :require => false @@ -55,13 +55,16 @@ group :system_tests do gem 'beaker-hostgenerator', '>= 1.1.10', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false + gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' + gem 'bcrypt_pbkdf', :require => false end group :release do gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '~> 1.0', :require => false + gem 'puppet-strings', '>= 1.0', :require => false end From f060058895eda1edb29aabf7056756678dad0f4a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 15 Jul 2018 11:00:14 +0200 Subject: [PATCH 054/380] fix .sync.yml --- .sync.yaml | 3 --- .sync.yml | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 .sync.yaml diff --git a/.sync.yaml b/.sync.yaml deleted file mode 100644 index cdec6c97..00000000 --- a/.sync.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -.travis.yml: - secret: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" diff --git a/.sync.yml b/.sync.yml index ed97d539..cdec6c97 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1 +1,3 @@ --- +.travis.yml: + secret: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" From 5e4466610e99b2c0dd7c505188479a25ddb12603 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 15 Jul 2018 11:00:34 +0200 Subject: [PATCH 055/380] add secret to .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2efe490c..d76a6929 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" on: tags: true # all_branches is required to use tags From 296900606ace65c43ad9881d1c63025f4a71a8db Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 25 Jul 2018 22:06:50 +0200 Subject: [PATCH 056/380] modulesync 1.9.4 --- .msync.yml | 2 +- .travis.yml | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.msync.yml b/.msync.yml index c39f6b7d..1115a3fb 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.3' +modulesync_config_version: '1.9.4' diff --git a/.travis.yml b/.travis.yml index d76a6929..b7b75a7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,8 @@ sudo: false dist: trusty language: ruby cache: bundler -# related to https://github.com/rubygems/rubygems/issues/2123 before_install: - - 'rm -f Gemfile.lock' - - 'gem update --system' - - 'gem install bundler' + - rm -f Gemfile.lock script: - 'bundle exec rake $CHECK' matrix: @@ -43,7 +40,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" + secure: "" on: tags: true # all_branches is required to use tags From 9b168b08414e032dd090378550402ce15e477230 Mon Sep 17 00:00:00 2001 From: Tanner Prestegard Date: Wed, 8 Aug 2018 09:28:39 -0500 Subject: [PATCH 057/380] Updated README for python::virtualenv Added parameters to README for python::virtualenv which were described in the manifest file, but were undocumented in the README. --- README.md | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 544826a8..55a1a1ee 100644 --- a/README.md +++ b/README.md @@ -167,37 +167,52 @@ Creates Python virtualenv. **requirements** - Path to pip requirements.txt file. Default: none -**proxy** - Proxy server to use for outbound connections. Default: none - **systempkgs** - Copy system site-packages into virtualenv. Default: don't +**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name + +**ensure_venv_dir** - Create virtualenv directory. Default: true + **distribute** - Include distribute in the virtualenv. Default: true -**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name +**index** - Base URL of Python package index. Default: none **owner** - Specify the owner of this virtualenv **group** - Specify the group for this virtualenv -**index** - Base URL of Python package index. Default: none +**mode** - Specify the directory mode. Default: 0755 + +**proxy** - Proxy server to use for outbound connections. Default: none + +**environment** - Additional environment variables required to install the packages. Default: none + +**path** - Set the $PATH environment variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] **cwd** - The directory from which to run the "pip install" command. Default: undef **timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800 +**pip_args** - Arguments to pass to pip during installation. Default: blank + +**extra_pip_args** - Arguments to pass to pip for package install. These are included in the pip command *after* the requirements file. Default: blank + ```puppet python::virtualenv { '/var/www/project1' : - ensure => present, - version => 'system', - requirements => '/var/www/project1/requirements.txt', - proxy => 'http://proxy.domain.com:3128', - systempkgs => true, - distribute => false, - venv_dir => '/home/appuser/virtualenvs', - owner => 'appuser', - group => 'apps', - cwd => '/var/www/project1', - timeout => 0, + ensure => present, + version => 'system', + requirements => '/var/www/project1/requirements.txt', + systempkgs => true, + venv_dir => '/home/appuser/virtualenvs', + ensure_venv_dir => false, + distribute => false, + index => 'appuser', + owner => 'appuser', + group => 'apps', + proxy => 'http://proxy.domain.com:3128', + cwd => '/var/www/project1', + timeout => 0, + extra_pip_args => '--no-binary :none:', } ``` From 2c8adadc09b56efb484436998e8ba7923adda766 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 12 Aug 2018 19:44:50 +0200 Subject: [PATCH 058/380] modulesync 1.9.6 --- .msync.yml | 2 +- Gemfile | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 1115a3fb..c632e462 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.4' +modulesync_config_version: '1.9.6' diff --git a/Gemfile b/Gemfile index 8da95fb3..998c9ed6 100644 --- a/Gemfile +++ b/Gemfile @@ -53,9 +53,11 @@ group :system_tests do end gem 'serverspec', :require => false gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-docker', :require => false + gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' gem 'bcrypt_pbkdf', :require => false end From c90613c5ec6fa5c9c8848809f6aad57fba8d5521 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 29 Jul 2018 17:55:01 +0200 Subject: [PATCH 059/380] enable acceptance tests --- .sync.yml | 7 ++++++- .travis.yml | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/.sync.yml b/.sync.yml index cdec6c97..3db83040 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,8 @@ --- .travis.yml: - secret: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" + secret: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" + docker_sets: + - set: ubuntu1404-64 + - set: ubuntu1604-64 + - set: debian8-64 + - set: debian9-64 diff --git a/.travis.yml b/.travis.yml index b7b75a7c..181f7f10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,30 @@ matrix: - rvm: 2.5.1 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required branches: only: - master @@ -40,7 +64,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" on: tags: true # all_branches is required to use tags From f95eddebb5b059c395e69671f64de31cdb95839a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 29 Jul 2018 18:23:03 +0200 Subject: [PATCH 060/380] update spec_helper_acceptance --- spec/spec_helper_acceptance.rb | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index bede2bcb..c978c402 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,33 +1,19 @@ require 'beaker-rspec' +require 'beaker-puppet' +require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' -UNSUPPORTED_PLATFORMS = ['windows'].freeze - -unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no' - hosts.each do |host| - if host.is_pe? - install_pe - else - install_puppet - end - end -end +run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' +install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i +install_module_on(hosts) +install_module_dependencies_on(hosts) RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - # Readable test descriptions c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - hosts.each do |host| - shell('rm -rf /etc/puppet/modules/python/') - copy_module_to(host, source: proj_root, module_name: 'python') - shell("/bin/touch #{default['puppetpath']}/hiera.yaml") - on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] - on host, puppet('module install stahnma-epel'), acceptable_exit_codes: [0, 1] + hosts.each do |host| + if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker} + on(host, "sed -i '/nodocs/d' /etc/yum.conf") end end end From d4e264b89290cb45cf8f9bc7c9fdb91756c71757 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 13 Aug 2018 20:19:15 -0400 Subject: [PATCH 061/380] Added CentOS rake, Add conditional that if virtualenv, then install dev --- .travis.yml | 6 ++++++ manifests/install.pp | 22 ++++++++++++++++------ spec/classes/python_spec.rb | 10 ++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 181f7f10..1f25e080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required branches: only: - master diff --git a/manifests/install.pp b/manifests/install.pp index 0a91976f..1e704d3b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,12 +28,6 @@ 'Gentoo' => undef, } - $dev_ensure = $python::dev ? { - true => 'present', - false => 'absent', - default => $python::dev, - } - $pip_ensure = $python::pip ? { true => 'present', false => 'absent', @@ -46,6 +40,21 @@ default => $python::virtualenv, } + if ($venv_ensure == 'present') { + $dev_ensure = 'present' + if ! $python::dev { + # Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch + # Python dev is required for virtual environment, but python environment is not required for python dev. + notify { 'Python virtual environment is dependent on python dev': } + } + } else { + $dev_ensure = $python::dev ? { + true => 'present', + false => 'absent', + default => $python::dev, + } + } + package { 'python': ensure => $python::ensure, name => $python, @@ -96,6 +105,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', + require => Package['python-dev'] } } 'scl': { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index a82c3d71..5abbc3b9 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -31,6 +31,16 @@ end end + describe 'with python::virtualenv, without python::dev' do + context 'true' do + let(:params) { { dev: 'absent', virtualenv: 'present' } } + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'empty/default' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end + describe 'with manage_gunicorn' do context 'true' do let(:params) { { manage_gunicorn: true } } From ac6e2eb9d928c896cfa83333c2a4da8cd9e39bed Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 13 Aug 2018 20:22:45 -0400 Subject: [PATCH 062/380] Added CentOS 7 to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 55a1a1ee..3f2aec4c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This module has been tested to work on the following systems. * Debian 9 * EL 6 * EL 7 +* CentOS 7 * Gentoo (and Sabayon) * Suse 11 * Ubuntu 14.04 From c3b912493db2baf691d0407a89e21a97d0d62f18 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 13 Aug 2018 20:23:04 -0400 Subject: [PATCH 063/380] added puppet validation on overcommit --- .overcommit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.overcommit.yml b/.overcommit.yml index 31699e74..1b03fad7 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -58,6 +58,7 @@ PrePush: enabled: true description: 'Run rake targets' targets: + - 'validate' - 'test' - 'rubocop' command: [ 'bundle', 'exec', 'rake' ] From 90f263c7a4b93664cd1c0c3c9e2af0a4575619e3 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 13 Aug 2018 20:30:28 -0400 Subject: [PATCH 064/380] added centos7-64 to sync --- .sync.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.sync.yml b/.sync.yml index 3db83040..169bbe60 100644 --- a/.sync.yml +++ b/.sync.yml @@ -6,3 +6,4 @@ - set: ubuntu1604-64 - set: debian8-64 - set: debian9-64 + - set: centos7-64 From 54c7535b0e2c008262a86cab70ada207f0119610 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 13 Aug 2018 20:41:21 -0400 Subject: [PATCH 065/380] fixed robocop offenses --- spec/classes/python_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 5abbc3b9..d5ee2771 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -33,7 +33,8 @@ describe 'with python::virtualenv, without python::dev' do context 'true' do - let(:params) { { dev: 'absent', virtualenv: 'present' } } + let(:params) { { dev: 'absent', virtualenv: 'present' } } + it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'empty/default' do From ae76b600e9853734d6c393823de71c43c9085c31 Mon Sep 17 00:00:00 2001 From: dquacken Date: Tue, 14 Aug 2018 10:43:53 -0400 Subject: [PATCH 066/380] updated to use @ekohl nits --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 1e704d3b..bddfd0ec 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -40,9 +40,9 @@ default => $python::virtualenv, } - if ($venv_ensure == 'present') { + if $venv_ensure == 'present' { $dev_ensure = 'present' - if ! $python::dev { + unless $python::dev { # Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch # Python dev is required for virtual environment, but python environment is not required for python dev. notify { 'Python virtual environment is dependent on python dev': } From 8b661ef92e52592908429d90dcc9466d4348c4a8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 19 Aug 2018 19:45:32 +0200 Subject: [PATCH 067/380] release 2.1.1 --- CHANGELOG.md | 21 ++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2361ec5c..d71e3700 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v2.1.1](https://github.com/voxpupuli/puppet-python/tree/v2.1.1) (2018-08-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.1.0...v2.1.1) + +**Fixed bugs:** + +- CentOS Acceptance testing, and more.... [\#424](https://github.com/voxpupuli/puppet-python/pull/424) ([danquack](https://github.com/danquack)) + +**Closed issues:** + +- enable acceptance tests for centos [\#423](https://github.com/voxpupuli/puppet-python/issues/423) +- Run acceptance tests on travis [\#402](https://github.com/voxpupuli/puppet-python/issues/402) +- \[CentOS7 + Python 2.7\]: python::virtualenv fails [\#365](https://github.com/voxpupuli/puppet-python/issues/365) + +**Merged pull requests:** + +- Updated README for python::virtualenv [\#421](https://github.com/voxpupuli/puppet-python/pull/421) ([tprestegard](https://github.com/tprestegard)) +- enable acceptance tests [\#419](https://github.com/voxpupuli/puppet-python/pull/419) ([bastelfreak](https://github.com/bastelfreak)) + ## [v2.1.0](https://github.com/voxpupuli/puppet-python/tree/v2.1.0) (2018-07-09) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.0.0...v2.1.0) @@ -625,4 +644,4 @@ These should not affect the functionality of the module. -\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/metadata.json b/metadata.json index 822de9e1..c650efd9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.1.1-rc0", + "version": "2.1.1", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 183bd51196716cf8be0f6cdd97838664fee65d67 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 20 Aug 2018 22:40:16 +0200 Subject: [PATCH 068/380] [blacksmith] Bump version to 2.1.2-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index c650efd9..ec4bcf90 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.1.1", + "version": "2.1.2-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From e1e02525d8142b72225c4aadcb025e0b9235f18d Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Wed, 22 Aug 2018 22:31:25 -0400 Subject: [PATCH 069/380] Added ubuntu 18.04 to travis tests --- .travis.yml | 6 ++++++ README.md | 1 + metadata.json | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1f25e080..39dfd047 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty diff --git a/README.md b/README.md index 3f2aec4c..e24ed058 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ This module has been tested to work on the following systems. * Suse 11 * Ubuntu 14.04 * Ubuntu 16.04 +* Ubuntu 18.04 ## Installation diff --git a/metadata.json b/metadata.json index 822de9e1..61ea3bba 100644 --- a/metadata.json +++ b/metadata.json @@ -36,7 +36,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "14.04", - "16.04" + "16.04", + "18.04" ] }, { From 23d1fbc11edfe10351acd6c2d4de3b8b6a8dce75 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Wed, 29 Aug 2018 18:06:49 -0400 Subject: [PATCH 070/380] Added ubuntu 1804 to sync --- .sync.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.sync.yml b/.sync.yml index 169bbe60..b502a785 100644 --- a/.sync.yml +++ b/.sync.yml @@ -4,6 +4,7 @@ docker_sets: - set: ubuntu1404-64 - set: ubuntu1604-64 + - set: ubuntu1804-64 - set: debian8-64 - set: debian9-64 - set: centos7-64 From 4bce6172ede3bf4b2d2cc35bd622621b20c565c1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Sep 2018 18:44:46 +0200 Subject: [PATCH 071/380] modulesync 2.0.0 --- .msync.yml | 2 +- .travis.yml | 38 +++++++++++++++++++++++++++++++++++++- Gemfile | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.msync.yml b/.msync.yml index c632e462..e1cef550 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '1.9.6' +modulesync_config_version: '2.0.0' diff --git a/.travis.yml b/.travis.yml index 39dfd047..c30e8749 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,36 +31,72 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required branches: only: - master @@ -76,7 +112,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" + secure: "" on: tags: true # all_branches is required to use tags diff --git a/Gemfile b/Gemfile index 998c9ed6..20f3df02 100644 --- a/Gemfile +++ b/Gemfile @@ -63,7 +63,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '>= 1.0', :require => false From c76c9b4dd8933ec0608cc34166fc4e87653e5579 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Fri, 7 Sep 2018 09:38:59 +0200 Subject: [PATCH 072/380] Acceptance test: Install pip First part of regression test for PR#418 --- spec/acceptance/virtualenv_spec.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index ccf6a3f0..b1a83b02 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -29,5 +29,30 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + it 'maintains pip version' do + pp = <<-EOS + class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> + python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv2', + owner => 'root', + group => 'root', + } + -> + python::pip { 'pip' : + ensure => '18.0', + virtualenv => '/opt/venv2', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + end end end From bbb85bf0f4cf34112adae0c89b527168bef53e38 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Fri, 7 Sep 2018 12:41:17 +0200 Subject: [PATCH 073/380] Acceptance test: check if pip installation is idempotent Second part of regression test for PR#418 --- spec/acceptance/virtualenv_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index b1a83b02..5412bee3 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -53,6 +53,7 @@ class { 'python' : # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end end end From 3c3ba036e594b514fcf8e3f134be726ec3c695c9 Mon Sep 17 00:00:00 2001 From: Vincent Brillault Date: Thu, 26 Jul 2018 08:48:21 +0200 Subject: [PATCH 074/380] Pip: freeze all to be able to control setuptools, distribute, wheel, pip By default `pip freeze` skip the mentioned packages and only displays their version if `--all` is used --- manifests/pip.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 755081a3..e7aa6efe 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -215,7 +215,7 @@ if $ensure != present and $ensure != latest { exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -227,7 +227,7 @@ } else { exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -244,7 +244,7 @@ # Explicit version. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -259,7 +259,7 @@ # Whatever version is available. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", - unless => "${pip_env} freeze | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", + unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, @@ -289,7 +289,7 @@ # Anti-action, uninstall. exec { "pip_uninstall_${name}": command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", - onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", + onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, umask => $umask, From 1bc43b9be9efcc94ac4840ef9b77fe591111d455 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 17:33:17 +0200 Subject: [PATCH 075/380] modulesync 2.2.0 --- .github/CONTRIBUTING.md | 75 ++++++++++++++++++++++++++++++++--------- .msync.yml | 2 +- .travis.yml | 44 +++++++++++++++++++++--- Gemfile | 5 ++- spec/default_facts.yml | 1 - spec/spec_helper.rb | 19 +++++------ 6 files changed, 112 insertions(+), 34 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 496a5c03..832578e1 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms. 1. Create a separate branch for your change. -1. Run the tests. We only take pull requests with passing tests, and - documentation. +1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) + runs the tests for us. You can also execute them locally. This is explained + in a later section. + +1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we + use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). + They provide some guidance for new code that might help you before you submit a pull request. 1. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. 1. Squash your commits down into logical components. Make sure to rebase - against the current master. + against our current master. 1. Push the branch to your fork and submit a pull request. @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet. If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: - export PUPPET_VERSION="~> 4.2.0" +```sh +export PUPPET_VERSION="~> 5.5.6" +``` You can install all needed gems for spec tests into the modules directory by running: @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to check various syntax and style things. You can run these locally with: - bundle exec rake lint - bundle exec rake validate +```sh +bundle exec rake lint +bundle exec rake validate +``` It will also run some [Rubocop](http://batsov.com/rubocop/) tests against it. You can run those locally ahead of time with: - bundle exec rake rubocop +```sh +bundle exec rake rubocop +``` ## Running the unit tests @@ -82,15 +93,21 @@ about how best to test your new feature. To run the linter, the syntax checker and the unit tests: - bundle exec rake test +```sh +bundle exec rake test +``` To run your all the unit tests - bundle exec rake spec SPEC_OPTS='--format documentation' +```sh +bundle exec rake spec +``` To run a specific spec test set the `SPEC` variable: - bundle exec rake spec SPEC=spec/foo_spec.rb +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` ## Integration tests @@ -102,23 +119,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of simple tests against it after applying the module. You can run this with: - bundle exec rake acceptance +```sh +bundle exec rake acceptance +``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., - BEAKER_set=centos-7-x64 bundle exec rake acceptance +```sh +BEAKER_set=centos-7-x64 bundle exec rake acceptance +``` There are default rake tasks for the various acceptance test modules, e.g., - bundle exec rake beaker:centos-7-x64 - bundle exec rake beaker:ssh:centos-7-x64 +```sh +bundle exec rake beaker:centos-7-x64 +bundle exec rake beaker:ssh:centos-7-x64 +``` If you don't want to have to recreate the virtual machine every time you can use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the created virtual machines will be in `.vagrant/beaker_vagrant_files`. +Beaker also supports docker containers. We also use that in our automated CI +pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: + +``` +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +``` + +You can replace the string `debian9` with any common operating system. +The following strings are known to work: + +* ubuntu1604 +* ubuntu1804 +* debian8 +* debian9 +* centos6 +* centos7 + The easiest way to debug in a docker container is to open a shell: - docker exec -it -u root ${container_id_or_name} bash +```sh +docker exec -it -u root ${container_id_or_name} bash +``` + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.msync.yml b/.msync.yml index e1cef550..1d2221fa 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.0.0' +modulesync_config_version: '2.2.0' diff --git a/.travis.yml b/.travis.yml index c30e8749..9c95480c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,11 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=test - rvm: 2.5.1 bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=rubocop + env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - rvm: 2.5.1 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 6.0" CHECK=rubocop + - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.1 @@ -31,6 +31,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -43,6 +49,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -55,6 +67,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -67,6 +85,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -79,6 +103,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty @@ -91,6 +121,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker services: docker sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty diff --git a/Gemfile b/Gemfile index 20f3df02..7ed69d4e 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,8 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '~> 2.6', :require => false - gem 'rspec-puppet', '~> 2.5', :require => false - gem 'rspec-puppet-facts', :require => false + gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false + gem 'rspec-puppet-facts', '>= 1.8.0', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false diff --git a/spec/default_facts.yml b/spec/default_facts.yml index 13c41657..2f6698d5 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -8,7 +8,6 @@ # Hint if using with rspec-puppet-facts ("on_supported_os.each"): # if a same named fact exists in facterdb it will be overridden. --- -concat_basedir: "/tmp" ipaddress: "172.16.254.254" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ea74a52a..88bca595 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,10 +1,9 @@ -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -include RspecPuppetFacts - # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet-facts' +include RspecPuppetFacts if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' @@ -23,13 +22,13 @@ end RSpec.configure do |c| - default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version - } + default_facts = {} default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) c.default_facts = default_facts -end -# vim: syntax=ruby + # Coverage generation + c.after(:suite) do + RSpec::Puppet::Coverage.report! + end +end From ea03f5df56a702de122760b8e7eeea08b4abace5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 17:34:23 +0200 Subject: [PATCH 076/380] purge obsolete symlink setting in fixtures --- .fixtures.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 9e4c5257..61826194 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,8 +1,4 @@ fixtures: repositories: - stdlib: - repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - epel: - repo: 'https://github.com/stahnma/puppet-module-epel.git' - symlinks: - python: "#{source_dir}" + stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' + epel: 'https://github.com/stahnma/puppet-module-epel.git' From f09134337d78764d8c9ed3e135832c0ab956aeae Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 17:34:33 +0200 Subject: [PATCH 077/380] allow puppet 6.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 967d942b..94f363ef 100644 --- a/metadata.json +++ b/metadata.json @@ -50,7 +50,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 6.0.0" + "version_requirement": ">= 4.10.0 < 7.0.0" } ], "dependencies": [ From 35c92057541694d57a920e1ef39051c426c860f2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 17:34:46 +0200 Subject: [PATCH 078/380] delete unneeded coverage_spec.rb --- spec/classes/coverage_spec.rb | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 spec/classes/coverage_spec.rb diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb deleted file mode 100644 index de446548..00000000 --- a/spec/classes/coverage_spec.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'rspec-puppet' - -at_exit { RSpec::Puppet::Coverage.report! } -# vim: syntax=ruby From 2f8102401646e21790c3f43f13dab6da90af6295 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 13 Oct 2018 18:06:39 +0200 Subject: [PATCH 079/380] add yumrepo_core module to fixtures --- .fixtures.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.fixtures.yml b/.fixtures.yml index 61826194..1cf7a43a 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,3 +2,6 @@ fixtures: repositories: stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' epel: 'https://github.com/stahnma/puppet-module-epel.git' + yumrepo_core: + repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git + puppet_version: ">= 6.0.0" From cfe091a18180bf52d09b09953287ada826ebaeda Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 19 Oct 2018 20:58:35 +0200 Subject: [PATCH 080/380] release 2.2.0 --- CHANGELOG.md | 19 ++++++++++++++++++- metadata.json | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d71e3700..15274a6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,24 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. -## [v2.1.1](https://github.com/voxpupuli/puppet-python/tree/v2.1.1) (2018-08-19) +## [v2.2.0](https://github.com/voxpupuli/puppet-python/tree/v2.2.0) (2018-10-19) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.1.1...v2.2.0) + +**Implemented enhancements:** + +- Add Ubuntu 18.04 support [\#399](https://github.com/voxpupuli/puppet-python/issues/399) +- Add ubuntu 18.04 support [\#426](https://github.com/voxpupuli/puppet-python/pull/426) ([danquack](https://github.com/danquack)) + +**Fixed bugs:** + +- Pip: freeze all to be able to control setuptools, distribute, wheel, pip [\#418](https://github.com/voxpupuli/puppet-python/pull/418) ([Feandil](https://github.com/Feandil)) + +**Merged pull requests:** + +- modulesync 2.2.0 and allow puppet 6.x [\#435](https://github.com/voxpupuli/puppet-python/pull/435) ([bastelfreak](https://github.com/bastelfreak)) + +## [v2.1.1](https://github.com/voxpupuli/puppet-python/tree/v2.1.1) (2018-08-20) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.1.0...v2.1.1) diff --git a/metadata.json b/metadata.json index 94f363ef..8daf22c6 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.1.2-rc0", + "version": "2.2.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 48a32f21e9b2345ec8109c2831efd6fee80cbc7f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 19 Oct 2018 22:34:13 +0200 Subject: [PATCH 081/380] [blacksmith] Bump version to 2.2.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 8daf22c6..4c807d23 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.2.0", + "version": "2.2.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 7d033d29e9dd4226a75068522453fb23d1ae57a3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 19 Oct 2018 23:10:16 +0200 Subject: [PATCH 082/380] add secret to .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c95480c..db8ac85a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -148,7 +148,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" on: tags: true # all_branches is required to use tags From 5722104119eb4d6d32c3a774ff10b532b18f4be8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 20 Oct 2018 19:34:19 +0200 Subject: [PATCH 083/380] release 2.2.2 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15274a6a..8ef5be38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v2.2.2](https://github.com/voxpupuli/puppet-python/tree/v2.2.2) (2018-10-20) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.2.0...v2.2.2) + +**Closed issues:** + +- Make a new release to the forge [\#437](https://github.com/voxpupuli/puppet-python/issues/437) + ## [v2.2.0](https://github.com/voxpupuli/puppet-python/tree/v2.2.0) (2018-10-19) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.1.1...v2.2.0) diff --git a/metadata.json b/metadata.json index 4c807d23..8b926dc1 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.2.1-rc0", + "version": "2.2.2", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From eac8ea67df0f55962223ab27d9be56334021a9c5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 20 Oct 2018 19:59:12 +0200 Subject: [PATCH 084/380] [blacksmith] Bump version to 2.2.3-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 8b926dc1..c1c42664 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.2.2", + "version": "2.2.3-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 8bb994c1820b5dbd6ff5870d24bd1c23223b8ab6 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 00:01:58 -0400 Subject: [PATCH 085/380] pip type updates - defined data types, updated for forge reference --- REFERENCE.md | 1253 ++++++++++++++++++++++++++++++++++++++++++++++ manifests/pip.pp | 134 ++--- 2 files changed, 1300 insertions(+), 87 deletions(-) create mode 100644 REFERENCE.md diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 00000000..b5fd1b6e --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,1253 @@ +# Reference + + +## Table of Contents + +**Classes** + +* [`python`](#python): +* [`python::config`](#pythonconfig): +* [`python::install`](#pythoninstall): == Class: python::install Installs core python packages, === Examples include python::install === Authors Sergey Stankevich Ashley Penne +* [`python::params`](#pythonparams): == Class: python::params The python Module default configuration settings. + +**Defined types** + +* [`python::dotfile`](#pythondotfile): == Define: python::dotfile Manages any python dotfiles with a simple config hash. === Parameters [*ensure*] present|absent. Default: pres +* [`python::gunicorn`](#pythongunicorn): == Define: python::gunicorn Manages Gunicorn virtual hosts. === Parameters [*ensure*] present|absent. Default: present [*config_dir*] C +* [`python::pip`](#pythonpip): Installs and manages packages from pip. +* [`python::pyvenv`](#pythonpyvenv): [*environment*] Optionally specify environment variables for pyvenv === Examples python::venv { '/var/www/project1': ensure => pres +* [`python::requirements`](#pythonrequirements): == Define: python::requirements Installs and manages Python packages from requirements file. === Parameters [*requirements*] Path to the +* [`python::virtualenv`](#pythonvirtualenv): == Define: python::virtualenv Creates Python virtualenv. === Parameters [*ensure*] present|absent. Default: present [*version*] Python + +## Classes + +### python + +The python class. + +#### Parameters + +The following parameters are available in the `python` class. + +##### `ensure` + +Data type: `Enum['absent', 'present', 'latest']` + + + +Default value: $python::params::ensure + +##### `version` + +Data type: `Any` + + + +Default value: $python::params::version + +##### `pip` + +Data type: `Enum['absent', 'present', 'latest']` + + + +Default value: $python::params::pip + +##### `dev` + +Data type: `Any` + + + +Default value: $python::params::dev + +##### `virtualenv` + +Data type: `Enum['absent', 'present', 'latest']` + + + +Default value: $python::params::virtualenv + +##### `gunicorn` + +Data type: `Enum['absent', 'present', 'latest']` + + + +Default value: $python::params::gunicorn + +##### `manage_gunicorn` + +Data type: `Boolean` + + + +Default value: $python::params::manage_gunicorn + +##### `gunicorn_package_name` + +Data type: `Any` + + + +Default value: $python::params::gunicorn_package_name + +##### `provider` + +Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` + + + +Default value: $python::params::provider + +##### `valid_versions` + +Data type: `Any` + + + +Default value: $python::params::valid_versions + +##### `python_pips` + +Data type: `Hash` + + + +Default value: { } + +##### `python_virtualenvs` + +Data type: `Hash` + + + +Default value: { } + +##### `python_pyvenvs` + +Data type: `Hash` + + + +Default value: { } + +##### `python_requirements` + +Data type: `Hash` + + + +Default value: { } + +##### `python_dotfiles` + +Data type: `Hash` + + + +Default value: { } + +##### `use_epel` + +Data type: `Boolean` + + + +Default value: $python::params::use_epel + +##### `rhscl_use_public_repository` + +Data type: `Any` + + + +Default value: $python::params::rhscl_use_public_repository + +##### `anaconda_installer_url` + +Data type: `Stdlib::Httpurl` + + + +Default value: $python::params::anaconda_installer_url + +##### `anaconda_install_path` + +Data type: `Stdlib::Absolutepath` + + + +Default value: $python::params::anaconda_install_path + +### python::config + +The python::config class. + +### python::install + +== Class: python::install + +Installs core python packages, + +=== Examples + +include python::install + +=== Authors + +Sergey Stankevich +Ashley Penney +Fotis Gimian +Garrett Honeycutt + +### python::params + +== Class: python::params + +The python Module default configuration settings. + +## Defined types + +### python::dotfile + +== Define: python::dotfile + +Manages any python dotfiles with a simple config hash. + +=== Parameters + +[*ensure*] + present|absent. Default: present + +[*filename*] + Filename. Default: $title + +[*mode*] + File mode. Default: 0644 + +[*owner*] +[*group*] + Owner/group. Default: `root`/`root` + +[*config*] + Config hash. This will be expanded to an ini-file. Default: {} + +=== Examples + +python::dotfile { '/var/lib/jenkins/.pip/pip.conf': + ensure => present, + owner => 'jenkins', + group => 'jenkins', + config => { + 'global' => { + 'index-url => 'https://mypypi.acme.com/simple/' + 'extra-index-url => https://pypi.risedev.at/simple/ + } + } +} + +#### Parameters + +The following parameters are available in the `python::dotfile` defined type. + +##### `ensure` + +Data type: `Any` + + + +Default value: 'present' + +##### `filename` + +Data type: `Any` + + + +Default value: $title + +##### `owner` + +Data type: `Any` + + + +Default value: 'root' + +##### `group` + +Data type: `Any` + + + +Default value: 'root' + +##### `mode` + +Data type: `Any` + + + +Default value: '0644' + +##### `config` + +Data type: `Any` + + + +Default value: {} + +### python::gunicorn + +== Define: python::gunicorn + +Manages Gunicorn virtual hosts. + +=== Parameters + +[*ensure*] + present|absent. Default: present + +[*config_dir*] + Configure the gunicorn config directory path. Default: /etc/gunicorn.d + +[*manage_config_dir*] + Set if the gunicorn config directory should be created. Default: false + +[*virtualenv*] + Run in virtualenv, specify directory. Default: disabled + +[*mode*] + Gunicorn mode. + wsgi|django. Default: wsgi + +[*dir*] + Application directory. + +[*bind*] + Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. + Default: system-wide: unix:/tmp/gunicorn-$name.socket + virtualenv: unix:${virtualenv}/${name}.socket + +[*environment*] + Set ENVIRONMENT variable. Default: none + +[*appmodule*] + Set the application module name for gunicorn to load when not using Django. + Default: app:app + +[*osenv*] + Allows setting environment variables for the gunicorn service. Accepts a + hash of 'key': 'value' pairs. + Default: false + +[*timeout*] + Allows setting the gunicorn idle worker process time before being killed. + The unit of time is seconds. + Default: 30 + +[*template*] + Which ERB template to use. Default: python/gunicorn.erb + +[*args*] + Custom arguments to add in gunicorn config file. Default: [] + +=== Examples + +python::gunicorn { 'vhost': + ensure => present, + virtualenv => '/var/www/project1', + mode => 'wsgi', + dir => '/var/www/project1/current', + bind => 'unix:/tmp/gunicorn.socket', + environment => 'prod', + owner => 'www-data', + group => 'www-data', + appmodule => 'app:app', + osenv => { 'DBHOST' => 'dbserver.example.com' }, + timeout => 30, + template => 'python/gunicorn.erb', +} + +=== Authors + +Sergey Stankevich +Ashley Penney +Marc Fournier + +#### Parameters + +The following parameters are available in the `python::gunicorn` defined type. + +##### `ensure` + +Data type: `Any` + + + +Default value: present + +##### `config_dir` + +Data type: `Any` + + + +Default value: '/etc/gunicorn.d' + +##### `manage_config_dir` + +Data type: `Any` + + + +Default value: `false` + +##### `virtualenv` + +Data type: `Any` + + + +Default value: `false` + +##### `mode` + +Data type: `Any` + + + +Default value: 'wsgi' + +##### `dir` + +Data type: `Any` + + + +Default value: `false` + +##### `bind` + +Data type: `Any` + + + +Default value: `false` + +##### `environment` + +Data type: `Any` + + + +Default value: `false` + +##### `owner` + +Data type: `Any` + + + +Default value: 'www-data' + +##### `group` + +Data type: `Any` + + + +Default value: 'www-data' + +##### `appmodule` + +Data type: `Any` + + + +Default value: 'app:app' + +##### `osenv` + +Data type: `Any` + + + +Default value: `false` + +##### `timeout` + +Data type: `Any` + + + +Default value: 30 + +##### `workers` + +Data type: `Any` + + + +Default value: `false` + +##### `access_log_format` + +Data type: `Any` + + + +Default value: `false` + +##### `accesslog` + +Data type: `Any` + + + +Default value: `false` + +##### `errorlog` + +Data type: `Any` + + + +Default value: `false` + +##### `log_level` + +Data type: `Any` + + + +Default value: 'error' + +##### `template` + +Data type: `Any` + + + +Default value: 'python/gunicorn.erb' + +##### `args` + +Data type: `Any` + + + +Default value: [] + +### python::pip + +Installs and manages packages from pip. + +#### Examples + +##### Install Flask to /var/www/project1 using a proxy + +```puppet +python::pip { 'flask': + virtualenv => '/var/www/project1', + proxy => 'http://proxy.domain.com:3128', + index => 'http://www.example.com/simple/', +} +``` + +#### Parameters + +The following parameters are available in the `python::pip` defined type. + +##### `name` + +must be unique + +##### `pkgname` + +Data type: `String` + +name of the package. + +Default value: $name + +##### `ensure` + +Data type: `Enum[present, absent, latest]` + +Require pip to be available. + +Default value: present + +##### `virtualenv` + +Data type: `String` + +virtualenv to run pip in. + +Default value: 'system' + +##### `pip_provider` + +Data type: `Enum['pip', 'pip3']` + +version of pip you wish to use. + +Default value: 'pip' + +##### `url` + +Data type: `Variant[Boolean, String]` + +URL to install from. + +Default value: `false` + +##### `owner` + +Data type: `String` + +The owner of the virtualenv being manipulated. + +Default value: 'root' + +##### `group` + +Data type: `String` + +The group of the virtualenv being manipulated. + +Default value: 'root' + +##### `index` + +Data type: `Any` + +Base URL of Python package index. + +Default value: `false` + +##### `proxy` + +Data type: `Variant[Boolean, String]` + +Proxy server to use for outbound connections. + +Default value: `false` + +##### `editable` + +Data type: `Boolean` + +If true the package is installed as an editable resource. + +Default value: `false` + +##### `environment` + +Data type: `Any` + +Additional environment variables required to install the packages. + +Default value: [] + +##### `extras` + +Data type: `Any` + +Extra features provided by the package which should be installed. + +Default value: [] + +##### `timeout` + +Data type: `Numeric` + +The maximum time in seconds the "pip install" command should take. + +Default value: 1800 + +##### `install_args` + +Data type: `String` + +Any additional installation arguments that will be supplied when running pip install. + +Default value: '' + +##### `uninstall_args` + +Data type: `String` + +Any additional arguments that will be supplied when running pip uninstall. + +Default value: '' + +##### `log_dir` + +Data type: `String` + +Log directory + +Default value: '/tmp' + +##### `egg` + +Data type: `Any` + + + +Default value: `false` + +##### `umask` + +Data type: `Any` + + + +Default value: `undef` + +##### `egg` + + + +Default value: `false` + +##### `path` + +Data type: `Array[String]` + + + +Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] + +### python::pyvenv + +[*environment*] +Optionally specify environment variables for pyvenv + +=== Examples + +python::venv { '/var/www/project1': + ensure => present, + version => 'system', + systempkgs => true, +} + +=== Authors + +Sergey Stankevich +Ashley Penney +Marc Fournier +Fotis Gimian +Seth Cleveland + +#### Parameters + +The following parameters are available in the `python::pyvenv` defined type. + +##### `ensure` + +Data type: `Any` + + + +Default value: present + +##### `version` + +Data type: `Any` + + + +Default value: 'system' + +##### `systempkgs` + +Data type: `Any` + + + +Default value: `false` + +##### `venv_dir` + +Data type: `Any` + + + +Default value: $name + +##### `owner` + +Data type: `Any` + + + +Default value: 'root' + +##### `group` + +Data type: `Any` + + + +Default value: 'root' + +##### `mode` + +Data type: `Any` + + + +Default value: '0755' + +##### `path` + +Data type: `Any` + + + +Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] + +##### `environment` + +Data type: `Any` + + + +Default value: [] + +### python::requirements + +== Define: python::requirements + +Installs and manages Python packages from requirements file. + +=== Parameters + +[*requirements*] + Path to the requirements file. Defaults to the resource name + +[*virtualenv*] + virtualenv to run pip in. Default: system-wide + +[*pip_provider*] + version of pip you wish to use. Default: pip + +[*owner*] + The owner of the virtualenv being manipulated. Default: root + +[*group*] + The group relating to the virtualenv being manipulated. Default: root + +[*proxy*] + Proxy server to use for outbound connections. Default: none + +[*src*] +Pip --src parameter; if the requirements file contains --editable resources, +this parameter specifies where they will be installed. See the pip +documentation for more. Default: none (i.e. use the pip default). + +[*environment*] + Additional environment variables required to install the packages. Default: none + +[*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) + +[*cwd*] + The directory from which to run the "pip install" command. Default: undef + +[*extra_pip_args*] +Extra arguments to pass to pip after the requirements file + +[*manage_requirements*] +Create the requirements file if it doesn't exist. Default: true + +[*fix_requirements_owner*] +Change owner and group of requirements file. Default: true + +[*log_dir*] +String. Log directory. + +[*timeout*] + The maximum time in seconds the "pip install" command should take. Default: 1800 + +=== Examples + +python::requirements { '/var/www/project1/requirements.txt': + virtualenv => '/var/www/project1', + proxy => 'http://proxy.domain.com:3128', +} + +=== Authors + +Sergey Stankevich +Ashley Penney +Fotis Gimian +Daniel Quackenbush + +#### Parameters + +The following parameters are available in the `python::requirements` defined type. + +##### `requirements` + +Data type: `Any` + + + +Default value: $name + +##### `virtualenv` + +Data type: `Any` + + + +Default value: 'system' + +##### `pip_provider` + +Data type: `Enum['pip', 'pip3']` + + + +Default value: 'pip' + +##### `owner` + +Data type: `Any` + + + +Default value: 'root' + +##### `group` + +Data type: `Any` + + + +Default value: 'root' + +##### `proxy` + +Data type: `Any` + + + +Default value: `false` + +##### `src` + +Data type: `Any` + + + +Default value: `false` + +##### `environment` + +Data type: `Any` + + + +Default value: [] + +##### `forceupdate` + +Data type: `Any` + + + +Default value: `false` + +##### `cwd` + +Data type: `Any` + + + +Default value: `undef` + +##### `extra_pip_args` + +Data type: `Any` + + + +Default value: '' + +##### `manage_requirements` + +Data type: `Any` + + + +Default value: `true` + +##### `fix_requirements_owner` + +Data type: `Any` + + + +Default value: `true` + +##### `log_dir` + +Data type: `Any` + + + +Default value: '/tmp' + +##### `timeout` + +Data type: `Any` + + + +Default value: 1800 + +### python::virtualenv + +== Define: python::virtualenv + +Creates Python virtualenv. + +=== Parameters + +[*ensure*] + present|absent. Default: present + +[*version*] + Python version to use. Default: system default + +[*requirements*] + Path to pip requirements.txt file. Default: none + +[*systempkgs*] + Copy system site-packages into virtualenv. Default: don't + If virtualenv version < 1.7 this flag has no effect since + +[*venv_dir*] + Directory to install virtualenv to. Default: $name + +[*ensure_venv_dir*] +Create $venv_dir. Default: true + +[*distribute*] + Include distribute in the virtualenv. Default: true + +[*index*] + Base URL of Python package index. Default: none (http://pypi.python.org/simple/) + +[*owner*] + The owner of the virtualenv being manipulated. Default: root + +[*group*] + The group relating to the virtualenv being manipulated. Default: root + +[*mode*] +Optionally specify directory mode. Default: 0755 + +[*proxy*] + Proxy server to use for outbound connections. Default: none + +[*environment*] + Additional environment variables required to install the packages. Default: none + +[*path*] + Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] + +[*cwd*] + The directory from which to run the "pip install" command. Default: undef + +[*timeout*] + The maximum time in seconds the "pip install" command should take. Default: 1800 + +[*pip_args*] + Arguments to pass to pip during initialization. Default: blank + +[*extra_pip_args*] + Extra arguments to pass to pip after requirements file. Default: blank + +=== Examples + +python::virtualenv { '/var/www/project1': + ensure => present, + version => 'system', + requirements => '/var/www/project1/requirements.txt', + proxy => 'http://proxy.domain.com:3128', + systempkgs => true, + index => 'http://www.example.com/simple/', +} + +=== Authors + +Sergey Stankevich +Shiva Poudel + +#### Parameters + +The following parameters are available in the `python::virtualenv` defined type. + +##### `ensure` + +Data type: `Any` + + + +Default value: present + +##### `version` + +Data type: `Any` + + + +Default value: 'system' + +##### `requirements` + +Data type: `Any` + + + +Default value: `false` + +##### `systempkgs` + +Data type: `Any` + + + +Default value: `false` + +##### `venv_dir` + +Data type: `Any` + + + +Default value: $name + +##### `ensure_venv_dir` + +Data type: `Any` + + + +Default value: `true` + +##### `distribute` + +Data type: `Any` + + + +Default value: `true` + +##### `index` + +Data type: `Any` + + + +Default value: `false` + +##### `owner` + +Data type: `Any` + + + +Default value: 'root' + +##### `group` + +Data type: `Any` + + + +Default value: 'root' + +##### `mode` + +Data type: `Any` + + + +Default value: '0755' + +##### `proxy` + +Data type: `Any` + + + +Default value: `false` + +##### `environment` + +Data type: `Any` + + + +Default value: [] + +##### `path` + +Data type: `Any` + + + +Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] + +##### `cwd` + +Data type: `Any` + + + +Default value: `undef` + +##### `timeout` + +Data type: `Any` + + + +Default value: 1800 + +##### `pip_args` + +Data type: `Any` + + + +Default value: '' + +##### `extra_pip_args` + +Data type: `Any` + + + +Default value: '' + +##### `virtualenv` + +Data type: `Any` + + + +Default value: `undef` + diff --git a/manifests/pip.pp b/manifests/pip.pp index e7aa6efe..04d956b8 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,96 +1,56 @@ -# == Define: python::pip -# -# Installs and manages packages from pip. -# -# === Parameters -# -# [*name] -# must be unique -# -# [*pkgname] -# name of the package. If pkgname is not specified, use name (title) instead. -# -# [*ensure*] -# present|absent. Default: present -# -# [*virtualenv*] -# virtualenv to run pip in. -# -# [*pip_provider*] -# version of pip you wish to use. Default: pip -# -# [*url*] -# URL to install from. Default: none -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group of the virtualenv being manipulated. Default: root -# -# [*index*] -# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) -# -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# -# [*editable*] -# Boolean. If true the package is installed as an editable resource. -# -# [*environment*] -# Additional environment variables required to install the packages. Default: none -# -# [*extras*] -# Extra features provided by the package which should be installed. Default: none -# -# [*timeout*] -# The maximum time in seconds the "pip install" command should take. Default: 1800 -# -# [*install_args*] -# String. Any additional installation arguments that will be supplied -# when running pip install. -# -# [*uninstall_args*] -# String. Any additional arguments that will be supplied when running -# pip uninstall. -# -# [*log_dir*] -# String. Log directory. + # -# === Examples +# @summary Installs and manages packages from pip. # -# python::pip { 'flask': -# virtualenv => '/var/www/project1', -# proxy => 'http://proxy.domain.com:3128', -# index => 'http://www.example.com/simple/', -# } +# @param name must be unique +# @param pkgname name of the package. +# @param ensure Require pip to be available. +# @param virtualenv virtualenv to run pip in. +# @param pip_provider version of pip you wish to use. +# @param url URL to install from. +# @param owner The owner of the virtualenv being manipulated. +# @param group The group of the virtualenv being manipulated. +# @param index Base URL of Python package index. +# @param proxy Proxy server to use for outbound connections. +# @param editable If true the package is installed as an editable resource. +# @param environment Additional environment variables required to install the packages. +# @param extras Extra features provided by the package which should be installed. +# @param timeout The maximum time in seconds the "pip install" command should take. +# @param install_args Any additional installation arguments that will be supplied when running pip install. +# @param uninstall_args Any additional arguments that will be supplied when running pip uninstall. +# @param log_dir Log directory +# @param egg +# @param umask +# @param egg # -# === Authors +# @example Install Flask to /var/www/project1 using a proxy +# python::pip { 'flask': +# virtualenv => '/var/www/project1', +# proxy => 'http://proxy.domain.com:3128', +# index => 'http://www.example.com/simple/', +# } # -# Sergey Stankevich -# Fotis Gimian -# Daniel Quackenbush # define python::pip ( - $pkgname = $name, - $ensure = present, - $virtualenv = 'system', - Enum['pip', 'pip3'] $pip_provider = 'pip', - $url = false, - $owner = 'root', - $group = 'root', - $umask = undef, - $index = false, - $proxy = false, - $egg = false, - $editable = false, - $environment = [], - $extras = [], - $install_args = '', - $uninstall_args = '', - $timeout = 1800, - $log_dir = '/tmp', - $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + String $pkgname = $name, + Enum[present, absent, latest] $ensure = present, + String $virtualenv = 'system', + Enum['pip', 'pip3'] $pip_provider = 'pip', + Variant[Boolean, String] $url = false, + String $owner = 'root', + String $group = 'root', + $umask = undef, + $index = false, + Variant[Boolean, String] $proxy = false, + $egg = false, + Boolean $editable = false, + $environment = [], + $extras = [], + String $install_args = '', + String $uninstall_args = '', + Numeric $timeout = 1800, + String $log_dir = '/tmp', + Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], ) { $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') From 84f46b542bb2a9cd320966fd470ff4d6fb4df122 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 00:36:20 -0400 Subject: [PATCH 086/380] Update forge reference.md documentation for remaning manifest files --- REFERENCE.md | 530 ++++++++++++++------------------------ manifests/config.pp | 15 +- manifests/dotfile.pp | 45 ++-- manifests/gunicorn.pp | 95 +++---- manifests/init.pp | 73 ++---- manifests/install.pp | 15 +- manifests/params.pp | 3 +- manifests/pyvenv.pp | 61 ++--- manifests/requirements.pp | 90 ++----- manifests/virtualenv.pp | 105 +++----- 10 files changed, 330 insertions(+), 702 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index b5fd1b6e..b16b5302 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -5,25 +5,39 @@ **Classes** -* [`python`](#python): -* [`python::config`](#pythonconfig): -* [`python::install`](#pythoninstall): == Class: python::install Installs core python packages, === Examples include python::install === Authors Sergey Stankevich Ashley Penne -* [`python::params`](#pythonparams): == Class: python::params The python Module default configuration settings. +* [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn. +* [`python::config`](#pythonconfig): Optionally installs the gunicorn service +* [`python::install`](#pythoninstall): Installs core python packages +* [`python::params`](#pythonparams): The python Module default configuration settings. **Defined types** -* [`python::dotfile`](#pythondotfile): == Define: python::dotfile Manages any python dotfiles with a simple config hash. === Parameters [*ensure*] present|absent. Default: pres -* [`python::gunicorn`](#pythongunicorn): == Define: python::gunicorn Manages Gunicorn virtual hosts. === Parameters [*ensure*] present|absent. Default: present [*config_dir*] C +* [`python::dotfile`](#pythondotfile): Manages any python dotfiles with a simple config hash. +* [`python::gunicorn`](#pythongunicorn): Manages Gunicorn virtual hosts. * [`python::pip`](#pythonpip): Installs and manages packages from pip. -* [`python::pyvenv`](#pythonpyvenv): [*environment*] Optionally specify environment variables for pyvenv === Examples python::venv { '/var/www/project1': ensure => pres -* [`python::requirements`](#pythonrequirements): == Define: python::requirements Installs and manages Python packages from requirements file. === Parameters [*requirements*] Path to the -* [`python::virtualenv`](#pythonvirtualenv): == Define: python::virtualenv Creates Python virtualenv. === Parameters [*ensure*] present|absent. Default: present [*version*] Python +* [`python::pyvenv`](#pythonpyvenv): +* [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. +* [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv. ## Classes ### python -The python class. +Installs and manages python, python-dev, python-virtualenv and gunicorn. + +#### Examples + +##### ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present + +```puppet +class { 'python': + version => 'system', + pip => 'present', + dev => 'present', + virtualenv => 'present', + gunicorn => 'present', +} +``` #### Parameters @@ -33,7 +47,8 @@ The following parameters are available in the `python` class. Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for the Python package. +Allowed values: absent, present and latest Default value: $python::params::ensure @@ -41,7 +56,14 @@ Default value: $python::params::ensure Data type: `Any` - +Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. +Allowed values: + - provider == pip: everything pip allows as a version after the 'python==' + - else: 'system', 'pypy', 3/3.3/... + - Be aware that 'system' usually means python 2.X. + - 'pypy' actually lets us use pypy as python. + - 3/3.3/... means you are going to install the python3/python3.3/... + package, if available on your osfamily. Default value: $python::params::version @@ -49,7 +71,8 @@ Default value: $python::params::version Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for python-pip. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::pip @@ -57,7 +80,8 @@ Default value: $python::params::pip Data type: `Any` - +Desired installation state for python-dev. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::dev @@ -65,7 +89,8 @@ Default value: $python::params::dev Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for python-virtualenv. Boolean values are deprecated +Allowed values: 'absent', 'present', 'latest Default value: $python::params::virtualenv @@ -73,7 +98,8 @@ Default value: $python::params::virtualenv Data type: `Enum['absent', 'present', 'latest']` - +Desired installation state for Gunicorn. Boolean values are deprecated. +Allowed values: 'absent', 'present', 'latest' Default value: $python::params::gunicorn @@ -81,25 +107,34 @@ Default value: $python::params::gunicorn Data type: `Boolean` - +Allow Installation / Removal of Gunicorn. Default: true Default value: $python::params::manage_gunicorn -##### `gunicorn_package_name` +##### `provider` -Data type: `Any` +Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` +What provider to use for installation of the packages, except gunicorn and Python itself. +Allowed values: 'pip' +Default value: $python::params::provider -Default value: $python::params::gunicorn_package_name +##### `use_epel` -##### `provider` +Data type: `Boolean` -Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` +to determine if the epel class is used. + +Default value: $python::params::use_epel +##### `gunicorn_package_name` +Data type: `Any` -Default value: $python::params::provider + + +Default value: $python::params::gunicorn_package_name ##### `valid_versions` @@ -149,14 +184,6 @@ Data type: `Hash` Default value: { } -##### `use_epel` - -Data type: `Boolean` - - - -Default value: $python::params::use_epel - ##### `rhscl_use_public_repository` Data type: `Any` @@ -183,28 +210,29 @@ Default value: $python::params::anaconda_install_path ### python::config -The python::config class. +Optionally installs the gunicorn service -### python::install +#### Examples -== Class: python::install +##### -Installs core python packages, +```puppet +include python::config +``` -=== Examples +### python::install -include python::install +Installs core python packages -=== Authors +#### Examples -Sergey Stankevich -Ashley Penney -Fotis Gimian -Garrett Honeycutt +##### -### python::params +```puppet +include python::install +``` -== Class: python::params +### python::params The python Module default configuration settings. @@ -212,30 +240,13 @@ The python Module default configuration settings. ### python::dotfile -== Define: python::dotfile - -Manages any python dotfiles with a simple config hash. - -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*filename*] - Filename. Default: $title - -[*mode*] - File mode. Default: 0644 - -[*owner*] -[*group*] - Owner/group. Default: `root`/`root` +=== Examples -[*config*] - Config hash. This will be expanded to an ini-file. Default: {} +#### Examples -=== Examples +##### Create a pip config in /var/lib/jenkins/.pip/ +```puppet python::dotfile { '/var/lib/jenkins/.pip/pip.conf': ensure => present, owner => 'jenkins', @@ -247,6 +258,7 @@ python::dotfile { '/var/lib/jenkins/.pip/pip.conf': } } } +``` #### Parameters @@ -256,7 +268,7 @@ The following parameters are available in the `python::dotfile` defined type. Data type: `Any` - +present|absent. Default: present Default value: 'present' @@ -264,99 +276,51 @@ Default value: 'present' Data type: `Any` - +Filename. Default: $title Default value: $title -##### `owner` +##### `mode` Data type: `Any` +File mode. Default: 0644 +Default value: '0644' -Default value: 'root' - -##### `group` +##### `owner` Data type: `Any` - +user owner of dotfile Default value: 'root' -##### `mode` +##### `group` Data type: `Any` +group owner of dotfile - -Default value: '0644' +Default value: 'root' ##### `config` Data type: `Any` - +Config hash. This will be expanded to an ini-file. Default: {} Default value: {} ### python::gunicorn -== Define: python::gunicorn - Manages Gunicorn virtual hosts. -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*config_dir*] - Configure the gunicorn config directory path. Default: /etc/gunicorn.d - -[*manage_config_dir*] - Set if the gunicorn config directory should be created. Default: false - -[*virtualenv*] - Run in virtualenv, specify directory. Default: disabled - -[*mode*] - Gunicorn mode. - wsgi|django. Default: wsgi - -[*dir*] - Application directory. - -[*bind*] - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. - Default: system-wide: unix:/tmp/gunicorn-$name.socket - virtualenv: unix:${virtualenv}/${name}.socket - -[*environment*] - Set ENVIRONMENT variable. Default: none - -[*appmodule*] - Set the application module name for gunicorn to load when not using Django. - Default: app:app - -[*osenv*] - Allows setting environment variables for the gunicorn service. Accepts a - hash of 'key': 'value' pairs. - Default: false - -[*timeout*] - Allows setting the gunicorn idle worker process time before being killed. - The unit of time is seconds. - Default: 30 - -[*template*] - Which ERB template to use. Default: python/gunicorn.erb - -[*args*] - Custom arguments to add in gunicorn config file. Default: [] +#### Examples -=== Examples +##### run gunicorn on vhost in virtualenv /var/www/project1 +```puppet python::gunicorn { 'vhost': ensure => present, virtualenv => '/var/www/project1', @@ -371,12 +335,7 @@ python::gunicorn { 'vhost': timeout => 30, template => 'python/gunicorn.erb', } - -=== Authors - -Sergey Stankevich -Ashley Penney -Marc Fournier +``` #### Parameters @@ -394,7 +353,7 @@ Default value: present Data type: `Any` - +Configure the gunicorn config directory path. Default: /etc/gunicorn.d Default value: '/etc/gunicorn.d' @@ -402,7 +361,7 @@ Default value: '/etc/gunicorn.d' Data type: `Any` - +Set if the gunicorn config directory should be created. Default: false Default value: `false` @@ -410,7 +369,7 @@ Default value: `false` Data type: `Any` - +Run in virtualenv, specify directory. Default: disabled Default value: `false` @@ -418,7 +377,8 @@ Default value: `false` Data type: `Any` - +Gunicorn mode. +wsgi|django. Default: wsgi Default value: 'wsgi' @@ -426,7 +386,7 @@ Default value: 'wsgi' Data type: `Any` - +Application directory. Default value: `false` @@ -434,7 +394,9 @@ Default value: `false` Data type: `Any` - +Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. +Default: system-wide: unix:/tmp/gunicorn-$name.socket + virtualenv: unix:${virtualenv}/${name}.socket Default value: `false` @@ -442,67 +404,72 @@ Default value: `false` Data type: `Any` - +Set ENVIRONMENT variable. Default: none Default value: `false` -##### `owner` +##### `appmodule` Data type: `Any` +Set the application module name for gunicorn to load when not using Django. +Default: app:app +Default value: 'app:app' -Default value: 'www-data' - -##### `group` +##### `osenv` Data type: `Any` +Allows setting environment variables for the gunicorn service. Accepts a +hash of 'key': 'value' pairs. +Default: false +Default value: `false` -Default value: 'www-data' - -##### `appmodule` +##### `timeout` Data type: `Any` +Allows setting the gunicorn idle worker process time before being killed. +The unit of time is seconds. +Default: 30 +Default value: 30 -Default value: 'app:app' - -##### `osenv` +##### `template` Data type: `Any` +Which ERB template to use. Default: python/gunicorn.erb +Default value: 'python/gunicorn.erb' -Default value: `false` - -##### `timeout` +##### `args` Data type: `Any` +Custom arguments to add in gunicorn config file. Default: [] +Default value: [] -Default value: 30 - -##### `workers` +##### `owner` Data type: `Any` -Default value: `false` +Default value: 'www-data' -##### `access_log_format` +##### `group` Data type: `Any` -Default value: `false` +Default value: 'www-data' -##### `accesslog` +##### `workers` Data type: `Any` @@ -510,7 +477,7 @@ Data type: `Any` Default value: `false` -##### `errorlog` +##### `access_log_format` Data type: `Any` @@ -518,29 +485,29 @@ Data type: `Any` Default value: `false` -##### `log_level` +##### `accesslog` Data type: `Any` -Default value: 'error' +Default value: `false` -##### `template` +##### `errorlog` Data type: `Any` -Default value: 'python/gunicorn.erb' +Default value: `false` -##### `args` +##### `log_level` Data type: `Any` -Default value: [] +Default value: 'error' ### python::pip @@ -726,24 +693,19 @@ Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] ### python::pyvenv -[*environment*] -Optionally specify environment variables for pyvenv +The python::pyvenv class. -=== Examples +#### Examples + +##### +```puppet python::venv { '/var/www/project1': ensure => present, version => 'system', systempkgs => true, } - -=== Authors - -Sergey Stankevich -Ashley Penney -Marc Fournier -Fotis Gimian -Seth Cleveland +``` #### Parameters @@ -761,7 +723,7 @@ Default value: present Data type: `Any` - +Python version to use. Default: system default Default value: 'system' @@ -769,7 +731,7 @@ Default value: 'system' Data type: `Any` - +Copy system site-packages into virtualenv Default value: `false` @@ -777,7 +739,7 @@ Default value: `false` Data type: `Any` - +Directory to install virtualenv to Default value: $name @@ -785,7 +747,7 @@ Default value: $name Data type: `Any` - +The owner of the virtualenv being manipulated Default value: 'root' @@ -793,7 +755,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated Default value: 'root' @@ -801,7 +763,7 @@ Default value: 'root' Data type: `Any` - +Optionally specify directory mode Default value: '0755' @@ -809,7 +771,7 @@ Default value: '0755' Data type: `Any` - +Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] @@ -817,80 +779,24 @@ Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] Data type: `Any` - +Optionally specify environment variables for pyvenv Default value: [] ### python::requirements -== Define: python::requirements - Installs and manages Python packages from requirements file. -=== Parameters - -[*requirements*] - Path to the requirements file. Defaults to the resource name - -[*virtualenv*] - virtualenv to run pip in. Default: system-wide - -[*pip_provider*] - version of pip you wish to use. Default: pip - -[*owner*] - The owner of the virtualenv being manipulated. Default: root - -[*group*] - The group relating to the virtualenv being manipulated. Default: root - -[*proxy*] - Proxy server to use for outbound connections. Default: none - -[*src*] -Pip --src parameter; if the requirements file contains --editable resources, -this parameter specifies where they will be installed. See the pip -documentation for more. Default: none (i.e. use the pip default). - -[*environment*] - Additional environment variables required to install the packages. Default: none - -[*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) - -[*cwd*] - The directory from which to run the "pip install" command. Default: undef - -[*extra_pip_args*] -Extra arguments to pass to pip after the requirements file - -[*manage_requirements*] -Create the requirements file if it doesn't exist. Default: true - -[*fix_requirements_owner*] -Change owner and group of requirements file. Default: true - -[*log_dir*] -String. Log directory. - -[*timeout*] - The maximum time in seconds the "pip install" command should take. Default: 1800 +#### Examples -=== Examples +##### install pip requirements from /var/www/project1/requirements.txt +```puppet python::requirements { '/var/www/project1/requirements.txt': virtualenv => '/var/www/project1', proxy => 'http://proxy.domain.com:3128', } - -=== Authors - -Sergey Stankevich -Ashley Penney -Fotis Gimian -Daniel Quackenbush +``` #### Parameters @@ -900,7 +806,7 @@ The following parameters are available in the `python::requirements` defined typ Data type: `Any` - +Path to the requirements file. Defaults to the resource name Default value: $name @@ -908,7 +814,7 @@ Default value: $name Data type: `Any` - +virtualenv to run pip in. Default: system-wide Default value: 'system' @@ -916,7 +822,7 @@ Default value: 'system' Data type: `Enum['pip', 'pip3']` - +version of pip you wish to use. Default: pip Default value: 'pip' @@ -924,7 +830,7 @@ Default value: 'pip' Data type: `Any` - +The owner of the virtualenv being manipulated. Default value: 'root' @@ -932,7 +838,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated. Default value: 'root' @@ -940,7 +846,7 @@ Default value: 'root' Data type: `Any` - +Proxy server to use for outbound connections. Default value: `false` @@ -948,7 +854,7 @@ Default value: `false` Data type: `Any` - +Pip --src parameter; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. Default value: `false` @@ -956,7 +862,7 @@ Default value: `false` Data type: `Any` - +Additional environment variables required to install the packages. Default value: [] @@ -964,7 +870,7 @@ Default value: [] Data type: `Any` - +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) Default value: `false` @@ -972,7 +878,7 @@ Default value: `false` Data type: `Any` - +The directory from which to run the "pip install" command. Default value: `undef` @@ -980,7 +886,7 @@ Default value: `undef` Data type: `Any` - +Extra arguments to pass to pip after the requirements file Default value: '' @@ -988,7 +894,7 @@ Default value: '' Data type: `Any` - +Create the requirements file if it doesn't exist. Default value: `true` @@ -996,7 +902,7 @@ Default value: `true` Data type: `Any` - +Change owner and group of requirements file. Default value: `true` @@ -1004,7 +910,7 @@ Default value: `true` Data type: `Any` - +Log directory. Default value: '/tmp' @@ -1012,75 +918,19 @@ Default value: '/tmp' Data type: `Any` - +The maximum time in seconds the "pip install" command should take. Default value: 1800 ### python::virtualenv -== Define: python::virtualenv - Creates Python virtualenv. -=== Parameters - -[*ensure*] - present|absent. Default: present - -[*version*] - Python version to use. Default: system default - -[*requirements*] - Path to pip requirements.txt file. Default: none - -[*systempkgs*] - Copy system site-packages into virtualenv. Default: don't - If virtualenv version < 1.7 this flag has no effect since - -[*venv_dir*] - Directory to install virtualenv to. Default: $name - -[*ensure_venv_dir*] -Create $venv_dir. Default: true - -[*distribute*] - Include distribute in the virtualenv. Default: true - -[*index*] - Base URL of Python package index. Default: none (http://pypi.python.org/simple/) - -[*owner*] - The owner of the virtualenv being manipulated. Default: root - -[*group*] - The group relating to the virtualenv being manipulated. Default: root - -[*mode*] -Optionally specify directory mode. Default: 0755 - -[*proxy*] - Proxy server to use for outbound connections. Default: none - -[*environment*] - Additional environment variables required to install the packages. Default: none - -[*path*] - Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] - -[*cwd*] - The directory from which to run the "pip install" command. Default: undef - -[*timeout*] - The maximum time in seconds the "pip install" command should take. Default: 1800 - -[*pip_args*] - Arguments to pass to pip during initialization. Default: blank - -[*extra_pip_args*] - Extra arguments to pass to pip after requirements file. Default: blank +#### Examples -=== Examples +##### install a virtual env at /var/www/project1 +```puppet python::virtualenv { '/var/www/project1': ensure => present, version => 'system', @@ -1089,11 +939,7 @@ python::virtualenv { '/var/www/project1': systempkgs => true, index => 'http://www.example.com/simple/', } - -=== Authors - -Sergey Stankevich -Shiva Poudel +``` #### Parameters @@ -1111,7 +957,7 @@ Default value: present Data type: `Any` - +Python version to use. Default value: 'system' @@ -1119,7 +965,7 @@ Default value: 'system' Data type: `Any` - +Path to pip requirements.txt file Default value: `false` @@ -1127,7 +973,7 @@ Default value: `false` Data type: `Any` - +Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since Default value: `false` @@ -1135,7 +981,7 @@ Default value: `false` Data type: `Any` - +Directory to install virtualenv to Default value: $name @@ -1143,7 +989,7 @@ Default value: $name Data type: `Any` - +reate $venv_dir Default value: `true` @@ -1151,7 +997,7 @@ Default value: `true` Data type: `Any` - +Include distribute in the virtualenv Default value: `true` @@ -1159,7 +1005,7 @@ Default value: `true` Data type: `Any` - +Base URL of Python package index Default value: `false` @@ -1167,7 +1013,7 @@ Default value: `false` Data type: `Any` - +The owner of the virtualenv being manipulated Default value: 'root' @@ -1175,7 +1021,7 @@ Default value: 'root' Data type: `Any` - +The group relating to the virtualenv being manipulated Default value: 'root' @@ -1183,7 +1029,7 @@ Default value: 'root' Data type: `Any` - +Optionally specify directory mode Default value: '0755' @@ -1191,7 +1037,7 @@ Default value: '0755' Data type: `Any` - +Proxy server to use for outbound connections Default value: `false` @@ -1199,7 +1045,7 @@ Default value: `false` Data type: `Any` - +Additional environment variables required to install the packages Default value: [] @@ -1207,7 +1053,7 @@ Default value: [] Data type: `Any` - +Specifies the PATH variable Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] @@ -1215,7 +1061,7 @@ Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] Data type: `Any` - +The directory from which to run the "pip install" command Default value: `undef` @@ -1223,7 +1069,7 @@ Default value: `undef` Data type: `Any` - +The maximum time in seconds the "pip install" command should take Default value: 1800 @@ -1231,7 +1077,7 @@ Default value: 1800 Data type: `Any` - +Arguments to pass to pip during initialization Default value: '' @@ -1239,7 +1085,7 @@ Default value: '' Data type: `Any` - +Extra arguments to pass to pip after requirements file Default value: '' diff --git a/manifests/config.pp b/manifests/config.pp index 78a424b9..9788838d 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,18 +1,9 @@ -# == Define: python::config # -# Optionally installs the gunicorn service +# @summary Optionally installs the gunicorn service # -# === Examples +# @example +# include python::config # -# include python::config -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# - class python::config { Class['python::install'] -> Python::Pip <| |> diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 5bc70ae9..de1bd096 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -1,38 +1,27 @@ -# == Define: python::dotfile # -# Manages any python dotfiles with a simple config hash. +# @summary Manages any python dotfiles with a simple config hash. # -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*filename*] -# Filename. Default: $title -# -# [*mode*] -# File mode. Default: 0644 -# -# [*owner*] -# [*group*] -# Owner/group. Default: `root`/`root` -# -# [*config*] -# Config hash. This will be expanded to an ini-file. Default: {} +# @param ensure present|absent. Default: present +# @param filename Filename. Default: $title +# @param mode File mode. Default: 0644 +# @param owner user owner of dotfile +# @param group group owner of dotfile +# @param config Config hash. This will be expanded to an ini-file. Default: {} # # === Examples # -# python::dotfile { '/var/lib/jenkins/.pip/pip.conf': -# ensure => present, -# owner => 'jenkins', -# group => 'jenkins', -# config => { -# 'global' => { -# 'index-url => 'https://mypypi.acme.com/simple/' -# 'extra-index-url => https://pypi.risedev.at/simple/ +# @example Create a pip config in /var/lib/jenkins/.pip/ +# python::dotfile { '/var/lib/jenkins/.pip/pip.conf': +# ensure => present, +# owner => 'jenkins', +# group => 'jenkins', +# config => { +# 'global' => { +# 'index-url => 'https://mypypi.acme.com/simple/' +# 'extra-index-url => https://pypi.risedev.at/simple/ +# } # } # } -# } # # define python::dotfile ( diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index bc996e6e..74e3251a 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -1,78 +1,43 @@ -# == Define: python::gunicorn # -# Manages Gunicorn virtual hosts. +# @summary Manages Gunicorn virtual hosts. # -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*config_dir*] -# Configure the gunicorn config directory path. Default: /etc/gunicorn.d -# -# [*manage_config_dir*] -# Set if the gunicorn config directory should be created. Default: false -# -# [*virtualenv*] -# Run in virtualenv, specify directory. Default: disabled -# -# [*mode*] -# Gunicorn mode. +# @param ensure +# @param config_dir Configure the gunicorn config directory path. Default: /etc/gunicorn.d +# @param manage_config_dir Set if the gunicorn config directory should be created. Default: false +# @param virtualenv Run in virtualenv, specify directory. Default: disabled +# @param mode Gunicorn mode. # wsgi|django. Default: wsgi -# -# [*dir*] -# Application directory. -# -# [*bind*] -# Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. +# @param dir Application directory. +# @param bind Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. # Default: system-wide: unix:/tmp/gunicorn-$name.socket # virtualenv: unix:${virtualenv}/${name}.socket -# -# [*environment*] -# Set ENVIRONMENT variable. Default: none -# -# [*appmodule*] -# Set the application module name for gunicorn to load when not using Django. +# @param environment Set ENVIRONMENT variable. Default: none +# @param appmodule Set the application module name for gunicorn to load when not using Django. # Default: app:app -# -# [*osenv*] -# Allows setting environment variables for the gunicorn service. Accepts a +# @param osenv Allows setting environment variables for the gunicorn service. Accepts a # hash of 'key': 'value' pairs. # Default: false -# -# [*timeout*] -# Allows setting the gunicorn idle worker process time before being killed. +# @param timeout Allows setting the gunicorn idle worker process time before being killed. # The unit of time is seconds. # Default: 30 -# -# [*template*] -# Which ERB template to use. Default: python/gunicorn.erb -# -# [*args*] -# Custom arguments to add in gunicorn config file. Default: [] -# -# === Examples -# -# python::gunicorn { 'vhost': -# ensure => present, -# virtualenv => '/var/www/project1', -# mode => 'wsgi', -# dir => '/var/www/project1/current', -# bind => 'unix:/tmp/gunicorn.socket', -# environment => 'prod', -# owner => 'www-data', -# group => 'www-data', -# appmodule => 'app:app', -# osenv => { 'DBHOST' => 'dbserver.example.com' }, -# timeout => 30, -# template => 'python/gunicorn.erb', -# } -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Marc Fournier +# @param template Which ERB template to use. Default: python/gunicorn.erb +# @param args Custom arguments to add in gunicorn config file. Default: [] +# +# @example run gunicorn on vhost in virtualenv /var/www/project1 +# python::gunicorn { 'vhost': +# ensure => present, +# virtualenv => '/var/www/project1', +# mode => 'wsgi', +# dir => '/var/www/project1/current', +# bind => 'unix:/tmp/gunicorn.socket', +# environment => 'prod', +# owner => 'www-data', +# group => 'www-data', +# appmodule => 'app:app', +# osenv => { 'DBHOST' => 'dbserver.example.com' }, +# timeout => 30, +# template => 'python/gunicorn.erb', +# } # define python::gunicorn ( $ensure = present, diff --git a/manifests/init.pp b/manifests/init.pp index 258d0677..212ea90c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,17 +1,8 @@ -# == Class: python +# @summary Installs and manages python, python-dev, python-virtualenv and gunicorn. # -# Installs and manages python, python-dev, python-virtualenv and Gunicorn. -# -# === Parameters -# -# [*ensure*] -# Desired installation state for the Python package. Valid options are absent, -# present and latest. Default: present -# -# [*version*] -# Python version to install. Beware that valid values for this differ a) by -# the provider you choose and b) by the osfamily/operatingsystem you are using. -# Default: system default +# @param ensure Desired installation state for the Python package. +# Allowed values: absent, present and latest +# @param version Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. # Allowed values: # - provider == pip: everything pip allows as a version after the 'python==' # - else: 'system', 'pypy', 3/3.3/... @@ -19,54 +10,28 @@ # - 'pypy' actually lets us use pypy as python. # - 3/3.3/... means you are going to install the python3/python3.3/... # package, if available on your osfamily. -# -# [*pip*] -# Desired installation state for python-pip. Boolean values are deprecated. -# Default: present +# @param pip Desired installation state for python-pip. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*dev*] -# Desired installation state for python-dev. Boolean values are deprecated. -# Default: absent +# @param dev Desired installation state for python-dev. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*virtualenv*] -# Desired installation state for python-virtualenv. Boolean values are -# deprecated. Default: absent +# @param virtualenv Desired installation state for python-virtualenv. Boolean values are deprecated # Allowed values: 'absent', 'present', 'latest -# -# [*gunicorn*] -# Desired installation state for Gunicorn. Boolean values are deprecated. -# Default: absent +# @param gunicorn Desired installation state for Gunicorn. Boolean values are deprecated. # Allowed values: 'absent', 'present', 'latest' -# -# [*manage_gunicorn*] -# Allow Installation / Removal of Gunicorn. Default: true -# -# [*provider*] -# What provider to use for installation of the packages, except gunicorn and -# Python itself. Default: system default provider +# @param manage_gunicorn Allow Installation / Removal of Gunicorn. Default: true +# @param provider What provider to use for installation of the packages, except gunicorn and Python itself. # Allowed values: 'pip' +# @param use_epel to determine if the epel class is used. # -# [*use_epel*] -# Boolean to determine if the epel class is used. Default: true -# -# === Examples -# -# class { 'python': -# version => 'system', -# pip => 'present', -# dev => 'present', -# virtualenv => 'present', -# gunicorn => 'present', -# } +# @example ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present +# class { 'python': +# version => 'system', +# pip => 'present', +# dev => 'present', +# virtualenv => 'present', +# gunicorn => 'present', +# } # -# === Authors -# -# Sergey Stankevich -# Garrett Honeycutt -# - class python ( Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, $version = $python::params::version, diff --git a/manifests/install.pp b/manifests/install.pp index bddfd0ec..28505472 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,17 +1,8 @@ -# == Class: python::install # -# Installs core python packages, +# @summary Installs core python packages # -# === Examples -# -# include python::install -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# Garrett Honeycutt +# @example +# include python::install # class python::install { diff --git a/manifests/params.pp b/manifests/params.pp index 5dacfc08..b68ed9ea 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,6 +1,5 @@ -# == Class: python::params # -# The python Module default configuration settings. +# @summary The python Module default configuration settings. # class python::params { $ensure = 'present' diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 587f1baa..b2e3d29a 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -1,51 +1,22 @@ -# == Define: python::pyvenv # -# Create a Python3 virtualenv using pyvenv. +# @summary Create a Python3 virtualenv using pyvenv. # -# === Parameters +# @param ensure +# @param version Python version to use. Default: system default +# @param systempkgs Copy system site-packages into virtualenv +# @param venv_dir Directory to install virtualenv to +# @param owner The owner of the virtualenv being manipulated +# @param group The group relating to the virtualenv being manipulated +# @param mode Optionally specify directory mode +# @param path Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +# @param environment Optionally specify environment variables for pyvenv # -# [*ensure*] -# present|absent. Default: present -# -# [*version*] -# Python version to use. Default: system default -# -# [*systempkgs*] -# Copy system site-packages into virtualenv. Default: don't -# -# [*venv_dir*] -# Directory to install virtualenv to. Default: $name -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*mode*] -# Optionally specify directory mode. Default: 0755 -# -# [*path*] -# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] - -# [*environment*] -# Optionally specify environment variables for pyvenv -# -# === Examples -# -# python::venv { '/var/www/project1': -# ensure => present, -# version => 'system', -# systempkgs => true, -# } -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Marc Fournier -# Fotis Gimian -# Seth Cleveland +# @example +# python::venv { '/var/www/project1': +# ensure => present, +# version => 'system', +# systempkgs => true, +# } # define python::pyvenv ( $ensure = present, diff --git a/manifests/requirements.pp b/manifests/requirements.pp index ffdfd420..1127f5db 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -1,71 +1,27 @@ -# == Define: python::requirements # -# Installs and manages Python packages from requirements file. -# -# === Parameters -# -# [*requirements*] -# Path to the requirements file. Defaults to the resource name -# -# [*virtualenv*] -# virtualenv to run pip in. Default: system-wide -# -# [*pip_provider*] -# version of pip you wish to use. Default: pip -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# -# [*src*] -# Pip --src parameter; if the requirements file contains --editable resources, -# this parameter specifies where they will be installed. See the pip -# documentation for more. Default: none (i.e. use the pip default). -# -# [*environment*] -# Additional environment variables required to install the packages. Default: none -# -# [*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) -# -# [*cwd*] -# The directory from which to run the "pip install" command. Default: undef -# -# [*extra_pip_args*] -# Extra arguments to pass to pip after the requirements file -# -# [*manage_requirements*] -# Create the requirements file if it doesn't exist. Default: true -# -# [*fix_requirements_owner*] -# Change owner and group of requirements file. Default: true -# -# [*log_dir*] -# String. Log directory. -# -# [*timeout*] -# The maximum time in seconds the "pip install" command should take. Default: 1800 -# -# === Examples -# -# python::requirements { '/var/www/project1/requirements.txt': -# virtualenv => '/var/www/project1', -# proxy => 'http://proxy.domain.com:3128', -# } -# -# === Authors -# -# Sergey Stankevich -# Ashley Penney -# Fotis Gimian -# Daniel Quackenbush +# @summary Installs and manages Python packages from requirements file. +# +# @param requirements Path to the requirements file. Defaults to the resource name +# @param virtualenv virtualenv to run pip in. Default: system-wide +# @param pip_provider version of pip you wish to use. Default: pip +# @param owner The owner of the virtualenv being manipulated. +# @param group The group relating to the virtualenv being manipulated. +# @param proxy Proxy server to use for outbound connections. +# @param src Pip --src parameter; 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 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. +# @param log_dir Log directory. +# @param timeout The maximum time in seconds the "pip install" command should take. +# +# @example install pip requirements from /var/www/project1/requirements.txt +# python::requirements { '/var/www/project1/requirements.txt': +# virtualenv => '/var/www/project1', +# proxy => 'http://proxy.domain.com:3128', +# } # define python::requirements ( $requirements = $name, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ad526678..c1a06ffe 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -1,79 +1,34 @@ -# == Define: python::virtualenv # -# Creates Python virtualenv. -# -# === Parameters -# -# [*ensure*] -# present|absent. Default: present -# -# [*version*] -# Python version to use. Default: system default -# -# [*requirements*] -# Path to pip requirements.txt file. Default: none -# -# [*systempkgs*] -# Copy system site-packages into virtualenv. Default: don't -# If virtualenv version < 1.7 this flag has no effect since -# -# [*venv_dir*] -# Directory to install virtualenv to. Default: $name -# -# [*ensure_venv_dir*] -# Create $venv_dir. Default: true -# -# [*distribute*] -# Include distribute in the virtualenv. Default: true -# -# [*index*] -# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) -# -# [*owner*] -# The owner of the virtualenv being manipulated. Default: root -# -# [*group*] -# The group relating to the virtualenv being manipulated. Default: root -# -# [*mode*] -# Optionally specify directory mode. Default: 0755 -# -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# -# [*environment*] -# Additional environment variables required to install the packages. Default: none -# -# [*path*] -# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] -# -# [*cwd*] -# The directory from which to run the "pip install" command. Default: undef -# -# [*timeout*] -# The maximum time in seconds the "pip install" command should take. Default: 1800 -# -# [*pip_args*] -# Arguments to pass to pip during initialization. Default: blank -# -# [*extra_pip_args*] -# Extra arguments to pass to pip after requirements file. Default: blank -# -# === Examples -# -# python::virtualenv { '/var/www/project1': -# ensure => present, -# version => 'system', -# requirements => '/var/www/project1/requirements.txt', -# proxy => 'http://proxy.domain.com:3128', -# systempkgs => true, -# index => 'http://www.example.com/simple/', -# } -# -# === Authors -# -# Sergey Stankevich -# Shiva Poudel +# @summary Creates Python virtualenv. +# +# @param ensure +# @param version Python version to use. +# @param requirements Path to pip requirements.txt file +# @param systempkgs Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since +# @param venv_dir Directory to install virtualenv to +# @param ensure_venv_dir reate $venv_dir +# @param distribute Include distribute in the virtualenv +# @param index Base URL of Python package index +# @param owner The owner of the virtualenv being manipulated +# @param group The group relating to the virtualenv being manipulated +# @param mode Optionally specify directory mode +# @param proxy Proxy server to use for outbound connections +# @param environment Additional environment variables required to install the packages +# @param path Specifies the PATH variable +# @param cwd The directory from which to run the "pip install" command +# @param timeout The maximum time in seconds the "pip install" command should take +# @param pip_args Arguments to pass to pip during initialization +# @param extra_pip_args Extra arguments to pass to pip after requirements file +# +# @example install a virtual env at /var/www/project1 +# python::virtualenv { '/var/www/project1': +# ensure => present, +# version => 'system', +# requirements => '/var/www/project1/requirements.txt', +# proxy => 'http://proxy.domain.com:3128', +# systempkgs => true, +# index => 'http://www.example.com/simple/', +# } # define python::virtualenv ( $ensure = present, From 0faf83acdd59a14f4779e1393d3554573def2dd7 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 09:52:33 -0400 Subject: [PATCH 087/380] Added string type to defined type pip, ensure --- REFERENCE.md | 6 +++--- manifests/pip.pp | 38 +++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index b16b5302..95389ba7 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -15,7 +15,7 @@ * [`python::dotfile`](#pythondotfile): Manages any python dotfiles with a simple config hash. * [`python::gunicorn`](#pythongunicorn): Manages Gunicorn virtual hosts. * [`python::pip`](#pythonpip): Installs and manages packages from pip. -* [`python::pyvenv`](#pythonpyvenv): +* [`python::pyvenv`](#pythonpyvenv): Create a Python3 virtualenv using pyvenv. * [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. * [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv. @@ -543,7 +543,7 @@ Default value: $name ##### `ensure` -Data type: `Enum[present, absent, latest]` +Data type: `Variant[Enum[present, absent, latest], String]` Require pip to be available. @@ -693,7 +693,7 @@ Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] ### python::pyvenv -The python::pyvenv class. +Create a Python3 virtualenv using pyvenv. #### Examples diff --git a/manifests/pip.pp b/manifests/pip.pp index 04d956b8..6eab00bd 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -32,25 +32,25 @@ # # define python::pip ( - String $pkgname = $name, - Enum[present, absent, latest] $ensure = present, - String $virtualenv = 'system', - Enum['pip', 'pip3'] $pip_provider = 'pip', - Variant[Boolean, String] $url = false, - String $owner = 'root', - String $group = 'root', - $umask = undef, - $index = false, - Variant[Boolean, String] $proxy = false, - $egg = false, - Boolean $editable = false, - $environment = [], - $extras = [], - String $install_args = '', - String $uninstall_args = '', - Numeric $timeout = 1800, - String $log_dir = '/tmp', - Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + String $pkgname = $name, + Variant[Enum[present, absent, latest], String] $ensure = present, + String $virtualenv = 'system', + Enum['pip', 'pip3'] $pip_provider = 'pip', + Variant[Boolean, String] $url = false, + String $owner = 'root', + String $group = 'root', + $umask = undef, + $index = false, + Variant[Boolean, String] $proxy = false, + $egg = false, + Boolean $editable = false, + $environment = [], + $extras = [], + String $install_args = '', + String $uninstall_args = '', + Numeric $timeout = 1800, + String $log_dir = '/tmp', + Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], ) { $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') From 22e3b3b8ea40e539ad43bccaf8d47096c7a8c33c Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 17:33:46 -0400 Subject: [PATCH 088/380] Removed default comments, install/param -> private, typed mode/dev vars --- REFERENCE.md | 58 ++++++++++++++----------------------------- manifests/gunicorn.pp | 50 ++++++++++++++++--------------------- manifests/init.pp | 17 +++++-------- manifests/install.pp | 2 +- manifests/params.pp | 2 +- manifests/pyvenv.pp | 4 +-- 6 files changed, 50 insertions(+), 83 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 95389ba7..f3295d3b 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -5,10 +5,15 @@ **Classes** +_Public Classes_ + * [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn. * [`python::config`](#pythonconfig): Optionally installs the gunicorn service -* [`python::install`](#pythoninstall): Installs core python packages -* [`python::params`](#pythonparams): The python Module default configuration settings. + +_Private Classes_ + +* `python::install`: Installs core python packages +* `python::params`: The python Module default configuration settings. **Defined types** @@ -71,17 +76,15 @@ Default value: $python::params::version Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-pip. Boolean values are deprecated. -Allowed values: 'absent', 'present', 'latest' +Desired installation state for python-pip. Default value: $python::params::pip ##### `dev` -Data type: `Any` +Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-dev. Boolean values are deprecated. -Allowed values: 'absent', 'present', 'latest' +Desired installation state for python-dev. Default value: $python::params::dev @@ -89,8 +92,7 @@ Default value: $python::params::dev Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-virtualenv. Boolean values are deprecated -Allowed values: 'absent', 'present', 'latest +Desired installation state for python-virtualenv. Default value: $python::params::virtualenv @@ -98,8 +100,7 @@ Default value: $python::params::virtualenv Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for Gunicorn. Boolean values are deprecated. -Allowed values: 'absent', 'present', 'latest' +Desired installation state for Gunicorn. Default value: $python::params::gunicorn @@ -107,7 +108,7 @@ Default value: $python::params::gunicorn Data type: `Boolean` -Allow Installation / Removal of Gunicorn. Default: true +Allow Installation / Removal of Gunicorn. Default value: $python::params::manage_gunicorn @@ -116,7 +117,6 @@ Default value: $python::params::manage_gunicorn Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` What provider to use for installation of the packages, except gunicorn and Python itself. -Allowed values: 'pip' Default value: $python::params::provider @@ -220,22 +220,6 @@ Optionally installs the gunicorn service include python::config ``` -### python::install - -Installs core python packages - -#### Examples - -##### - -```puppet -include python::install -``` - -### python::params - -The python Module default configuration settings. - ## Defined types ### python::dotfile @@ -375,10 +359,9 @@ Default value: `false` ##### `mode` -Data type: `Any` +Data type: `Enum['wsgi', 'django']` Gunicorn mode. -wsgi|django. Default: wsgi Default value: 'wsgi' @@ -413,7 +396,6 @@ Default value: `false` Data type: `Any` Set the application module name for gunicorn to load when not using Django. -Default: app:app Default value: 'app:app' @@ -421,9 +403,7 @@ Default value: 'app:app' Data type: `Any` -Allows setting environment variables for the gunicorn service. Accepts a -hash of 'key': 'value' pairs. -Default: false +Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. Default value: `false` @@ -431,9 +411,7 @@ Default value: `false` Data type: `Any` -Allows setting the gunicorn idle worker process time before being killed. -The unit of time is seconds. -Default: 30 +Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. Default value: 30 @@ -723,7 +701,7 @@ Default value: present Data type: `Any` -Python version to use. Default: system default +Python version to use. Default value: 'system' @@ -771,7 +749,7 @@ Default value: '0755' Data type: `Any` -Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +Specifies the PATH variable. Default value: [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ] diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 74e3251a..b6a9542c 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -6,20 +6,14 @@ # @param manage_config_dir Set if the gunicorn config directory should be created. Default: false # @param virtualenv Run in virtualenv, specify directory. Default: disabled # @param mode Gunicorn mode. -# wsgi|django. Default: wsgi # @param dir Application directory. # @param bind Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. # Default: system-wide: unix:/tmp/gunicorn-$name.socket # virtualenv: unix:${virtualenv}/${name}.socket # @param environment Set ENVIRONMENT variable. Default: none # @param appmodule Set the application module name for gunicorn to load when not using Django. -# Default: app:app -# @param osenv Allows setting environment variables for the gunicorn service. Accepts a -# hash of 'key': 'value' pairs. -# Default: false -# @param timeout Allows setting the gunicorn idle worker process time before being killed. -# The unit of time is seconds. -# Default: 30 +# @param osenv Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. +# @param timeout Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. # @param template Which ERB template to use. Default: python/gunicorn.erb # @param args Custom arguments to add in gunicorn config file. Default: [] # @@ -40,26 +34,26 @@ # } # define python::gunicorn ( - $ensure = present, - $config_dir = '/etc/gunicorn.d', - $manage_config_dir = false, - $virtualenv = false, - $mode = 'wsgi', - $dir = false, - $bind = false, - $environment = false, - $owner = 'www-data', - $group = 'www-data', - $appmodule = 'app:app', - $osenv = false, - $timeout = 30, - $workers = false, - $access_log_format = false, - $accesslog = false, - $errorlog = false, - $log_level = 'error', - $template = 'python/gunicorn.erb', - $args = [], + $ensure = present, + $config_dir = '/etc/gunicorn.d', + $manage_config_dir = false, + $virtualenv = false, + Enum['wsgi', 'django'] $mode = 'wsgi', + $dir = false, + $bind = false, + $environment = false, + $owner = 'www-data', + $group = 'www-data', + $appmodule = 'app:app', + $osenv = false, + $timeout = 30, + $workers = false, + $access_log_format = false, + $accesslog = false, + $errorlog = false, + $log_level = 'error', + $template = 'python/gunicorn.erb', + $args = [], ) { # Parameter validation diff --git a/manifests/init.pp b/manifests/init.pp index 212ea90c..a0c5a8be 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -10,17 +10,12 @@ # - 'pypy' actually lets us use pypy as python. # - 3/3.3/... means you are going to install the python3/python3.3/... # package, if available on your osfamily. -# @param pip Desired installation state for python-pip. Boolean values are deprecated. -# Allowed values: 'absent', 'present', 'latest' -# @param dev Desired installation state for python-dev. Boolean values are deprecated. -# Allowed values: 'absent', 'present', 'latest' -# @param virtualenv Desired installation state for python-virtualenv. Boolean values are deprecated -# Allowed values: 'absent', 'present', 'latest -# @param gunicorn Desired installation state for Gunicorn. Boolean values are deprecated. -# Allowed values: 'absent', 'present', 'latest' -# @param manage_gunicorn Allow Installation / Removal of Gunicorn. Default: true +# @param pip Desired installation state for python-pip. +# @param dev Desired installation state for python-dev. +# @param virtualenv Desired installation state for python-virtualenv. +# @param gunicorn Desired installation state for Gunicorn. +# @param manage_gunicorn Allow Installation / Removal of Gunicorn. # @param provider What provider to use for installation of the packages, except gunicorn and Python itself. -# Allowed values: 'pip' # @param use_epel to determine if the epel class is used. # # @example ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present @@ -36,7 +31,7 @@ Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, $version = $python::params::version, Enum['absent', 'present', 'latest'] $pip = $python::params::pip, - $dev = $python::params::dev, + Enum['absent', 'present', 'latest'] $dev = $python::params::dev, Enum['absent', 'present', 'latest'] $virtualenv = $python::params::virtualenv, Enum['absent', 'present', 'latest'] $gunicorn = $python::params::gunicorn, Boolean $manage_gunicorn = $python::params::manage_gunicorn, diff --git a/manifests/install.pp b/manifests/install.pp index 28505472..fe0e1911 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,4 +1,4 @@ -# +# @api private # @summary Installs core python packages # # @example diff --git a/manifests/params.pp b/manifests/params.pp index b68ed9ea..d8e5d5d4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,4 +1,4 @@ -# +# @api private # @summary The python Module default configuration settings. # class python::params { diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index b2e3d29a..509926c7 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -2,13 +2,13 @@ # @summary Create a Python3 virtualenv using pyvenv. # # @param ensure -# @param version Python version to use. Default: system default +# @param version Python version to use. # @param systempkgs Copy system site-packages into virtualenv # @param venv_dir Directory to install virtualenv to # @param owner The owner of the virtualenv being manipulated # @param group The group relating to the virtualenv being manipulated # @param mode Optionally specify directory mode -# @param path Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +# @param path Specifies the PATH variable. # @param environment Optionally specify environment variables for pyvenv # # @example From e63659e3d34c4c2fb5555f033f62ae8b78b3a7c3 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Mon, 22 Oct 2018 19:05:32 -0400 Subject: [PATCH 089/380] fixed typos in comments added some more types, config.pp -> private, removed remaining defaults --- REFERENCE.md | 57 +++++++++++++++------------------------ manifests/config.pp | 2 +- manifests/dotfile.pp | 24 ++++++++--------- manifests/gunicorn.pp | 12 ++++----- manifests/init.pp | 1 - manifests/requirements.pp | 6 ++--- manifests/virtualenv.pp | 4 +-- 7 files changed, 46 insertions(+), 60 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index f3295d3b..9acfb173 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -8,10 +8,10 @@ _Public Classes_ * [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn. -* [`python::config`](#pythonconfig): Optionally installs the gunicorn service _Private Classes_ +* `python::config`: Optionally installs the gunicorn service * `python::install`: Installs core python packages * `python::params`: The python Module default configuration settings. @@ -53,7 +53,6 @@ The following parameters are available in the `python` class. Data type: `Enum['absent', 'present', 'latest']` Desired installation state for the Python package. -Allowed values: absent, present and latest Default value: $python::params::ensure @@ -208,18 +207,6 @@ Data type: `Stdlib::Absolutepath` Default value: $python::params::anaconda_install_path -### python::config - -Optionally installs the gunicorn service - -#### Examples - -##### - -```puppet -include python::config -``` - ## Defined types ### python::dotfile @@ -237,8 +224,8 @@ python::dotfile { '/var/lib/jenkins/.pip/pip.conf': group => 'jenkins', config => { 'global' => { - 'index-url => 'https://mypypi.acme.com/simple/' - 'extra-index-url => https://pypi.risedev.at/simple/ + 'index-url' => 'https://mypypi.acme.com/simple/' + 'extra-index-url' => 'https://pypi.risedev.at/simple/' } } } @@ -250,9 +237,9 @@ The following parameters are available in the `python::dotfile` defined type. ##### `ensure` -Data type: `Any` +Data type: `Enum['absent', 'present']` + -present|absent. Default: present Default value: 'present' @@ -260,21 +247,21 @@ Default value: 'present' Data type: `Any` -Filename. Default: $title +Filename. Default value: $title ##### `mode` -Data type: `Any` +Data type: `String` -File mode. Default: 0644 +File mode. Default value: '0644' ##### `owner` -Data type: `Any` +Data type: `String` user owner of dotfile @@ -282,7 +269,7 @@ Default value: 'root' ##### `group` -Data type: `Any` +Data type: `String` group owner of dotfile @@ -292,7 +279,7 @@ Default value: 'root' Data type: `Any` -Config hash. This will be expanded to an ini-file. Default: {} +Config hash. This will be expanded to an ini-file. Default value: {} @@ -337,7 +324,7 @@ Default value: present Data type: `Any` -Configure the gunicorn config directory path. Default: /etc/gunicorn.d +Configure the gunicorn config directory path. Default value: '/etc/gunicorn.d' @@ -345,7 +332,7 @@ Default value: '/etc/gunicorn.d' Data type: `Any` -Set if the gunicorn config directory should be created. Default: false +Set if the gunicorn config directory should be created. Default value: `false` @@ -353,7 +340,7 @@ Default value: `false` Data type: `Any` -Run in virtualenv, specify directory. Default: disabled +Run in virtualenv, specify directory. Default value: `false` @@ -387,7 +374,7 @@ Default value: `false` Data type: `Any` -Set ENVIRONMENT variable. Default: none +Set ENVIRONMENT variable. Default value: `false` @@ -419,7 +406,7 @@ Default value: 30 Data type: `Any` -Which ERB template to use. Default: python/gunicorn.erb +Which ERB template to use. Default value: 'python/gunicorn.erb' @@ -427,7 +414,7 @@ Default value: 'python/gunicorn.erb' Data type: `Any` -Custom arguments to add in gunicorn config file. Default: [] +Custom arguments to add in gunicorn config file. Default value: [] @@ -784,7 +771,7 @@ The following parameters are available in the `python::requirements` defined typ Data type: `Any` -Path to the requirements file. Defaults to the resource name +Path to the requirements file. Default value: $name @@ -792,7 +779,7 @@ Default value: $name Data type: `Any` -virtualenv to run pip in. Default: system-wide +virtualenv to run pip in. Default value: 'system' @@ -800,7 +787,7 @@ Default value: 'system' Data type: `Enum['pip', 'pip3']` -version of pip you wish to use. Default: pip +version of pip you wish to use. Default value: 'pip' @@ -951,7 +938,7 @@ Default value: `false` Data type: `Any` -Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since +Copy system site-packages into virtualenv. Default value: `false` @@ -967,7 +954,7 @@ Default value: $name Data type: `Any` -reate $venv_dir +Create $venv_dir Default value: `true` diff --git a/manifests/config.pp b/manifests/config.pp index 9788838d..73a346d7 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,4 +1,4 @@ -# +# @api private # @summary Optionally installs the gunicorn service # # @example diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index de1bd096..dd9eb37c 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -1,12 +1,12 @@ # # @summary Manages any python dotfiles with a simple config hash. # -# @param ensure present|absent. Default: present -# @param filename Filename. Default: $title -# @param mode File mode. Default: 0644 +# @param ensure +# @param filename Filename. +# @param mode File mode. # @param owner user owner of dotfile # @param group group owner of dotfile -# @param config Config hash. This will be expanded to an ini-file. Default: {} +# @param config Config hash. This will be expanded to an ini-file. # # === Examples # @@ -17,20 +17,20 @@ # group => 'jenkins', # config => { # 'global' => { -# 'index-url => 'https://mypypi.acme.com/simple/' -# 'extra-index-url => https://pypi.risedev.at/simple/ +# 'index-url' => 'https://mypypi.acme.com/simple/' +# 'extra-index-url' => 'https://pypi.risedev.at/simple/' # } # } # } # # define python::dotfile ( - $ensure = 'present', - $filename = $title, - $owner = 'root', - $group = 'root', - $mode = '0644', - $config = {}, + Enum['absent', 'present'] $ensure = 'present', + $filename = $title, + String $owner = 'root', + String $group = 'root', + String $mode = '0644', + $config = {}, ) { $parent_dir = dirname($filename) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index b6a9542c..994bf08c 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -2,20 +2,20 @@ # @summary Manages Gunicorn virtual hosts. # # @param ensure -# @param config_dir Configure the gunicorn config directory path. Default: /etc/gunicorn.d -# @param manage_config_dir Set if the gunicorn config directory should be created. Default: false -# @param virtualenv Run in virtualenv, specify directory. Default: disabled +# @param config_dir Configure the gunicorn config directory path. +# @param manage_config_dir Set if the gunicorn config directory should be created. +# @param virtualenv Run in virtualenv, specify directory. # @param mode Gunicorn mode. # @param dir Application directory. # @param bind Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. # Default: system-wide: unix:/tmp/gunicorn-$name.socket # virtualenv: unix:${virtualenv}/${name}.socket -# @param environment Set ENVIRONMENT variable. Default: none +# @param environment Set ENVIRONMENT variable. # @param appmodule Set the application module name for gunicorn to load when not using Django. # @param osenv Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. # @param timeout Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. -# @param template Which ERB template to use. Default: python/gunicorn.erb -# @param args Custom arguments to add in gunicorn config file. Default: [] +# @param template Which ERB template to use. +# @param args Custom arguments to add in gunicorn config file. # # @example run gunicorn on vhost in virtualenv /var/www/project1 # python::gunicorn { 'vhost': diff --git a/manifests/init.pp b/manifests/init.pp index a0c5a8be..0a03faf8 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,6 @@ # @summary Installs and manages python, python-dev, python-virtualenv and gunicorn. # # @param ensure Desired installation state for the Python package. -# Allowed values: absent, present and latest # @param version Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. # Allowed values: # - provider == pip: everything pip allows as a version after the 'python==' diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 1127f5db..615b091b 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -1,9 +1,9 @@ # # @summary Installs and manages Python packages from requirements file. # -# @param requirements Path to the requirements file. Defaults to the resource name -# @param virtualenv virtualenv to run pip in. Default: system-wide -# @param pip_provider version of pip you wish to use. Default: pip +# @param requirements Path to the requirements file. +# @param virtualenv virtualenv to run pip in. +# @param pip_provider version of pip you wish to use. # @param owner The owner of the virtualenv being manipulated. # @param group The group relating to the virtualenv being manipulated. # @param proxy Proxy server to use for outbound connections. diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index c1a06ffe..23c3a7d7 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -4,9 +4,9 @@ # @param ensure # @param version Python version to use. # @param requirements Path to pip requirements.txt file -# @param systempkgs Copy system site-packages into virtualenv. Default: don't If virtualenv version < 1.7 this flag has no effect since +# @param systempkgs Copy system site-packages into virtualenv. # @param venv_dir Directory to install virtualenv to -# @param ensure_venv_dir reate $venv_dir +# @param ensure_venv_dir Create $venv_dir # @param distribute Include distribute in the virtualenv # @param index Base URL of Python package index # @param owner The owner of the virtualenv being manipulated From d8cd414221ae0004266c5f3cf6d8e68e08397a3c Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Tue, 23 Oct 2018 12:08:28 -0400 Subject: [PATCH 090/380] moved examples, variable info from READme to REFERENCE. --- README.md | 281 +------------------------------------- REFERENCE.md | 72 +++++++--- manifests/dotfile.pp | 2 - manifests/gunicorn.pp | 40 +++--- manifests/init.pp | 15 +- manifests/pip.pp | 26 +++- manifests/pyvenv.pp | 5 +- manifests/requirements.pp | 6 +- 8 files changed, 119 insertions(+), 328 deletions(-) diff --git a/README.md b/README.md index e24ed058..22f8ff1f 100644 --- a/README.md +++ b/README.md @@ -38,284 +38,9 @@ puppet module install stankevich-python ``` ## Usage - -### python - -Installs and manages python, python-pip, python-dev, python-virtualenv and Gunicorn. - -**ensure** - Desired installation state for the Python package. Options are absent, present and latest. Default: present - -**version** - Python version to install. Default: system - -**pip** - Desired installation state for the python-pip package. Options are absent, present and latest. Default: present - -**dev** - Desired installation state for the python-dev package. Options are absent, present and latest. Default: absent - -**virtualenv** - Desired installation state for the virtualenv package. Options are absent, present and latest. Default: absent - -**gunicorn** - Desired installation state for Gunicorn. Options are absent, present and latest. Default: absent - -**manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true - -**use_epel** - Boolean to determine if the epel class is used. Default: true on RHEL like systems, false otherwise - -*Install Python from system python* -```puppet - class { 'python' : - version => 'system', - pip => 'present', - dev => 'absent', - virtualenv => 'absent', - gunicorn => 'absent', - } -``` -*Install Python 3 from the scl repo* -```puppet - class { 'python' : - ensure => 'present', - version => 'rh-python36-python', - dev => 'present', - virtualenv => 'present', - } -``` - -### python::pip - -Installs and manages packages from pip. - -**pkgname** - the name of the package to install. Required. - -**ensure** - present/latest/absent. You can also specify the version. Default: present - -**virtualenv** - virtualenv to run pip in. Default: system (no virtualenv) - -**pip_provider** - pip provider to execute pip with. Default: pip. - -**url** - URL to install from. Default: none - -**owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root - -**proxy** - Proxy server to use for outbound connections. Default: none - -**environment** - Additional environment variables required to install the packages. Default: none - -**extras** - Extra features provided by the package which should be installed. Default: none - -**egg** - The egg name to use. Default: `$name` of the class, e.g. cx_Oracle - -**install_args** - String of additional flags to pass to pip during installaton. Default: none - -**uninstall_args** - String of additional flags to pass to pip during uninstall. Default: none - -**timeout** - Timeout for the pip install command. Defaults to 1800. - -*Install cx_Oracle with pip* -```puppet - python::pip { 'cx_Oracle' : - pkgname => 'cx_Oracle', - ensure => '5.1.2', - virtualenv => '/var/www/project1', - owner => 'appuser', - proxy => 'http://proxy.domain.com:3128', - environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', - install_args => '-e', - timeout => 1800, - } -``` -*Install Requests with pip3* -```puppet - python::pip { 'requests' : - ensure => 'present', - pkgname => 'requests', - pip_provider => 'pip3', - virtualenv => '/var/www/project1', - owner => 'root', - timeout => 1800 - } -``` - -### python::requirements - -Installs and manages Python packages from requirements file. - -**virtualenv** - virtualenv to run pip in. Default: system-wide - -**proxy** - Proxy server to use for outbound connections. Default: none - -**owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root - -**src** - The `--src` parameter to `pip`, used to specify where to install `--editable` resources; by default no `--src` parameter is passed to `pip`. - -**group** - The group that was used to create the virtualenv. This is used to create the requirements file with correct permissions if it's not present already. - -**manage_requirements** - Create the requirements file if it doesn't exist. Default: true - -```puppet - python::requirements { '/var/www/project1/requirements.txt' : - virtualenv => '/var/www/project1', - proxy => 'http://proxy.domain.com:3128', - owner => 'appuser', - group => 'apps', - } -``` - -### python::virtualenv - -Creates Python virtualenv. - -**ensure** - present/absent. Default: present - -**version** - Python version to use. Default: system default - -**requirements** - Path to pip requirements.txt file. Default: none - -**systempkgs** - Copy system site-packages into virtualenv. Default: don't - -**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name - -**ensure_venv_dir** - Create virtualenv directory. Default: true - -**distribute** - Include distribute in the virtualenv. Default: true - -**index** - Base URL of Python package index. Default: none - -**owner** - Specify the owner of this virtualenv - -**group** - Specify the group for this virtualenv - -**mode** - Specify the directory mode. Default: 0755 - -**proxy** - Proxy server to use for outbound connections. Default: none - -**environment** - Additional environment variables required to install the packages. Default: none - -**path** - Set the $PATH environment variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] - -**cwd** - The directory from which to run the "pip install" command. Default: undef - -**timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800 - -**pip_args** - Arguments to pass to pip during installation. Default: blank - -**extra_pip_args** - Arguments to pass to pip for package install. These are included in the pip command *after* the requirements file. Default: blank - -```puppet - python::virtualenv { '/var/www/project1' : - ensure => present, - version => 'system', - requirements => '/var/www/project1/requirements.txt', - systempkgs => true, - venv_dir => '/home/appuser/virtualenvs', - ensure_venv_dir => false, - distribute => false, - index => 'appuser', - owner => 'appuser', - group => 'apps', - proxy => 'http://proxy.domain.com:3128', - cwd => '/var/www/project1', - timeout => 0, - extra_pip_args => '--no-binary :none:', - } -``` - -### python::pyvenv - -Creates Python3 virtualenv. - -**ensure** - present/absent. Default: present - -**version** - Python version to use. Default: system default - -**systempkgs** - Copy system site-packages into virtualenv. Default: don't - -**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name - -**owner** - Specify the owner of this virtualenv - -**group** - Specify the group for this virtualenv - -**path** - Specifies the PATH variable that contains `pyvenv` executable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] - -**environment** - Specify any environment variables to use when creating pyvenv - -```puppet - python::pyvenv { '/var/www/project1' : - ensure => present, - version => 'system', - systempkgs => true, - venv_dir => '/home/appuser/virtualenvs', - owner => 'appuser', - group => 'apps', - } -``` - -### python::gunicorn - -Manages Gunicorn virtual hosts. - -**ensure** - present/absent. Default: present - -**virtualenv** - Run in virtualenv, specify directory. Default: disabled - -**mode** - Gunicorn mode. wsgi/django. Default: wsgi - -**dir** - Application directory. - -**bind** - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: `unix:/tmp/gunicorn-$name.socket` or `unix:${virtualenv}/${name}.socket` - -**environment** - Set ENVIRONMENT variable. Default: none - -**appmodule** - Set the application module name for gunicorn to load when not using Django. Default: `app:app` - -**osenv** - Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. Default: false - -**timeout** - Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. Default: 30 - -**template** - Which ERB template to use. Default: python/gunicorn.erb - -```puppet - python::gunicorn { 'vhost' : - ensure => present, - virtualenv => '/var/www/project1', - mode => 'wsgi', - dir => '/var/www/project1/current', - bind => 'unix:/tmp/gunicorn.socket', - environment => 'prod', - appmodule => 'app:app', - osenv => { 'DBHOST' => 'dbserver.example.com' }, - timeout => 30, - template => 'python/gunicorn.erb', - } -``` - -### python::dotfile - -Manages arbitrary python dotiles with a simple config hash. - -**ensure** - present/absent. Default: present - -**filename** - Default: $title - -**mode** - Default: 0644 - -**owner** - Default: root - -**group** - Default: root - -**config** Config hash. This will be expanded to an ini-file. Default: {} - -```puppet -python::dotfile { '/var/lib/jenkins/.pip/pip.conf': - ensure => present, - owner => 'jenkins', - group => 'jenkins', - config => { - 'global' => { - 'index-url => 'https://mypypi.acme.com/simple/' - 'extra-index-url => https://pypi.risedev.at/simple/ - } - } -} +For class usage refer to the REFERENCE.md. If contributing, this is updated with +```shell +bundle exec rake strings:generate\[',,,,false,true'] ``` ### hiera configuration diff --git a/REFERENCE.md b/REFERENCE.md index 9acfb173..732c49ba 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -32,7 +32,7 @@ Installs and manages python, python-dev, python-virtualenv and gunicorn. #### Examples -##### ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present +##### install python from system python ```puppet class { 'python': @@ -44,6 +44,17 @@ class { 'python': } ``` +##### install python3 from scl report + +```puppet +class { 'python' : + ensure => 'present', + version => 'rh-python36-python', + dev => 'present', + virtualenv => 'present', +} +``` + #### Parameters The following parameters are available in the `python` class. @@ -75,7 +86,7 @@ Default value: $python::params::version Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-pip. +Desired installation state for the python-pip package. Default value: $python::params::pip @@ -83,7 +94,7 @@ Default value: $python::params::pip Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-dev. +Desired installation state for the python-dev package. Default value: $python::params::dev @@ -91,7 +102,7 @@ Default value: $python::params::dev Data type: `Enum['absent', 'present', 'latest']` -Desired installation state for python-virtualenv. +Desired installation state for the virtualenv package Default value: $python::params::virtualenv @@ -211,7 +222,7 @@ Default value: $python::params::anaconda_install_path ### python::dotfile -=== Examples +Manages any python dotfiles with a simple config hash. #### Examples @@ -314,7 +325,7 @@ The following parameters are available in the `python::gunicorn` defined type. ##### `ensure` -Data type: `Any` +Data type: `Enum['present', 'abesent']` @@ -490,6 +501,34 @@ python::pip { 'flask': } ``` +##### Install cx_Oracle with pip + +```puppet +python::pip { 'cx_Oracle' : + pkgname => 'cx_Oracle', + ensure => '5.1.2', + virtualenv => '/var/www/project1', + owner => 'appuser', + proxy => 'http://proxy.domain.com:3128', + environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', + install_args => '-e', + timeout => 1800, +} +``` + +##### Install Requests with pip3 + +```puppet +python::pip { 'requests' : + ensure => 'present', + pkgname => 'requests', + pip_provider => 'pip3', + virtualenv => '/var/www/project1', + owner => 'root', + timeout => 1800 +} +``` + #### Parameters The following parameters are available in the `python::pip` defined type. @@ -502,7 +541,7 @@ must be unique Data type: `String` -name of the package. +the name of the package. Default value: $name @@ -630,7 +669,7 @@ Default value: '/tmp' Data type: `Any` - +The egg name to use Default value: `false` @@ -642,12 +681,6 @@ Data type: `Any` Default value: `undef` -##### `egg` - - - -Default value: `false` - ##### `path` Data type: `Array[String]` @@ -665,10 +698,13 @@ Create a Python3 virtualenv using pyvenv. ##### ```puppet -python::venv { '/var/www/project1': +python::pyvenv { '/var/www/project1' : ensure => present, version => 'system', systempkgs => true, + venv_dir => '/home/appuser/virtualenvs', + owner => 'appuser', + group => 'apps', } ``` @@ -757,9 +793,11 @@ Installs and manages Python packages from requirements file. ##### install pip requirements from /var/www/project1/requirements.txt ```puppet -python::requirements { '/var/www/project1/requirements.txt': +python::requirements { '/var/www/project1/requirements.txt' : virtualenv => '/var/www/project1', proxy => 'http://proxy.domain.com:3128', + owner => 'appuser', + group => 'apps', } ``` @@ -819,7 +857,7 @@ Default value: `false` Data type: `Any` -Pip --src parameter; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. +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. Default value: `false` diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index dd9eb37c..fcff6e10 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -8,8 +8,6 @@ # @param group group owner of dotfile # @param config Config hash. This will be expanded to an ini-file. # -# === Examples -# # @example Create a pip config in /var/lib/jenkins/.pip/ # python::dotfile { '/var/lib/jenkins/.pip/pip.conf': # ensure => present, diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 994bf08c..d15bfa78 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -34,26 +34,26 @@ # } # define python::gunicorn ( - $ensure = present, - $config_dir = '/etc/gunicorn.d', - $manage_config_dir = false, - $virtualenv = false, - Enum['wsgi', 'django'] $mode = 'wsgi', - $dir = false, - $bind = false, - $environment = false, - $owner = 'www-data', - $group = 'www-data', - $appmodule = 'app:app', - $osenv = false, - $timeout = 30, - $workers = false, - $access_log_format = false, - $accesslog = false, - $errorlog = false, - $log_level = 'error', - $template = 'python/gunicorn.erb', - $args = [], + Enum['present', 'abesent'] $ensure = present, + $config_dir = '/etc/gunicorn.d', + $manage_config_dir = false, + $virtualenv = false, + Enum['wsgi', 'django'] $mode = 'wsgi', + $dir = false, + $bind = false, + $environment = false, + $owner = 'www-data', + $group = 'www-data', + $appmodule = 'app:app', + $osenv = false, + $timeout = 30, + $workers = false, + $access_log_format = false, + $accesslog = false, + $errorlog = false, + $log_level = 'error', + $template = 'python/gunicorn.erb', + $args = [], ) { # Parameter validation diff --git a/manifests/init.pp b/manifests/init.pp index 0a03faf8..583c2d59 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,15 +9,15 @@ # - 'pypy' actually lets us use pypy as python. # - 3/3.3/... means you are going to install the python3/python3.3/... # package, if available on your osfamily. -# @param pip Desired installation state for python-pip. -# @param dev Desired installation state for python-dev. -# @param virtualenv Desired installation state for python-virtualenv. +# @param pip Desired installation state for the python-pip package. +# @param dev Desired installation state for the python-dev package. +# @param virtualenv Desired installation state for the virtualenv package # @param gunicorn Desired installation state for Gunicorn. # @param manage_gunicorn Allow Installation / Removal of Gunicorn. # @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. # -# @example ensure system python is installed, with pip,dev, virtualenv, and gunicorn packages present +# @example install python from system python # class { 'python': # version => 'system', # pip => 'present', @@ -25,6 +25,13 @@ # virtualenv => 'present', # gunicorn => 'present', # } +# @example install python3 from scl report +# class { 'python' : +# ensure => 'present', +# version => 'rh-python36-python', +# dev => 'present', +# virtualenv => 'present', +# } # class python ( Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, diff --git a/manifests/pip.pp b/manifests/pip.pp index 6eab00bd..5e983187 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -3,7 +3,7 @@ # @summary Installs and manages packages from pip. # # @param name must be unique -# @param pkgname name of the package. +# @param pkgname the name of the package. # @param ensure Require pip to be available. # @param virtualenv virtualenv to run pip in. # @param pip_provider version of pip you wish to use. @@ -19,9 +19,8 @@ # @param install_args Any additional installation arguments that will be supplied when running pip install. # @param uninstall_args Any additional arguments that will be supplied when running pip uninstall. # @param log_dir Log directory -# @param egg +# @param egg The egg name to use # @param umask -# @param egg # # @example Install Flask to /var/www/project1 using a proxy # python::pip { 'flask': @@ -29,7 +28,26 @@ # proxy => 'http://proxy.domain.com:3128', # index => 'http://www.example.com/simple/', # } -# +# @example Install cx_Oracle with pip +# python::pip { 'cx_Oracle' : +# pkgname => 'cx_Oracle', +# ensure => '5.1.2', +# virtualenv => '/var/www/project1', +# owner => 'appuser', +# proxy => 'http://proxy.domain.com:3128', +# environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', +# install_args => '-e', +# timeout => 1800, +# } +# @example Install Requests with pip3 +# python::pip { 'requests' : +# ensure => 'present', +# pkgname => 'requests', +# pip_provider => 'pip3', +# virtualenv => '/var/www/project1', +# owner => 'root', +# timeout => 1800 +# } # define python::pip ( String $pkgname = $name, diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 509926c7..66957731 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -12,10 +12,13 @@ # @param environment Optionally specify environment variables for pyvenv # # @example -# python::venv { '/var/www/project1': +# python::pyvenv { '/var/www/project1' : # ensure => present, # version => 'system', # systempkgs => true, +# venv_dir => '/home/appuser/virtualenvs', +# owner => 'appuser', +# group => 'apps', # } # define python::pyvenv ( diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 615b091b..d592ebfe 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -7,7 +7,7 @@ # @param owner The owner of the virtualenv being manipulated. # @param group The group relating to the virtualenv being manipulated. # @param proxy Proxy server to use for outbound connections. -# @param src Pip --src parameter; if the requirements file contains --editable resources, this parameter specifies where they will be installed. See the pip documentation for more. +# @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. @@ -18,9 +18,11 @@ # @param timeout The maximum time in seconds the "pip install" command should take. # # @example install pip requirements from /var/www/project1/requirements.txt -# python::requirements { '/var/www/project1/requirements.txt': +# python::requirements { '/var/www/project1/requirements.txt' : # virtualenv => '/var/www/project1', # proxy => 'http://proxy.domain.com:3128', +# owner => 'appuser', +# group => 'apps', # } # define python::requirements ( From 8bcfb17c14bc5605b68f80ffb0eba740bf50d082 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Wed, 24 Oct 2018 08:58:53 -0400 Subject: [PATCH 091/380] fixed typo/indentation in gunicorn.pp, update readme for module install --- README.md | 2 +- REFERENCE.md | 2 +- manifests/gunicorn.pp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 22f8ff1f..d407bdd7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ git submodule add https://github.com/stankevich/puppet-python.git /path/to/pytho OR ``` shell -puppet module install stankevich-python +puppet module install puppet-python ``` ## Usage diff --git a/REFERENCE.md b/REFERENCE.md index 732c49ba..81c49743 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -325,7 +325,7 @@ The following parameters are available in the `python::gunicorn` defined type. ##### `ensure` -Data type: `Enum['present', 'abesent']` +Data type: `Enum['present', 'absent']` diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index d15bfa78..da14dd0e 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -34,7 +34,7 @@ # } # define python::gunicorn ( - Enum['present', 'abesent'] $ensure = present, + Enum['present', 'absent'] $ensure = present, $config_dir = '/etc/gunicorn.d', $manage_config_dir = false, $virtualenv = false, @@ -51,7 +51,7 @@ $access_log_format = false, $accesslog = false, $errorlog = false, - $log_level = 'error', + $log_level = 'error', $template = 'python/gunicorn.erb', $args = [], ) { From 0e5ea07d76f09829191bb07fabba8800b50124aa Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Wed, 24 Oct 2018 09:02:54 -0400 Subject: [PATCH 092/380] readme update to point release notes to changelog --- README.md | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d407bdd7..4bb1ab8f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ puppet module install puppet-python ``` ## Usage -For class usage refer to the REFERENCE.md. If contributing, this is updated with +For class usage refer to the [Reference]("https://github.com/voxpupuli/puppet-python/blob/master/REFERENCE.md). If contributing, this is updated with ```shell bundle exec rake strings:generate\[',,,,false,true'] ``` @@ -75,24 +75,7 @@ from softwarecollections.org, set python::provider to 'rhscl' and python::versio of the collection you want to use (e.g., 'python27', 'python33', or 'rh-python34'). ## Release Notes - -**Version 1.9.8 Notes** -The `pip`, `virtualenv` and `gunicorn` parameters of `Class['python']` have changed. These parameters now accept `absent`, `present` and `latest` rather than `true` and `false`. The boolean values are still supported and are equivalent to `present` and `absent` respectively. Support for these boolean parameters is deprecated and will be removed in a later release. - -**Version 1.7.10 Notes** - -Installation of python-pip previously defaulted to `false` and was not installed. This default is now `true` and python-pip is installed. To prevent the installation of python-pip specify `pip => false` as a parameter when instantiating the `python` puppet class. - -**Version 1.1.x Notes** - -Version `1.1.x` makes several fundamental changes to the core of this module, adding some additional features, improving performance and making operations more robust in general. - -Please note that several changes have been made in `v1.1.x` which make manifests incompatible with the previous version. However, modifying your manifests to suit is trivial. Please see the notes below. - -Currently, the changes you need to make are as follows: - -* All pip definitions MUST include the owner field which specifies which user owns the virtualenv that packages will be installed in. Adding this greatly improves performance and efficiency of this module. -* You must explicitly specify pip => true in the python class if you want pip installed. As such, the pip package is now independent of the dev package and so one can exist without the other. +See [Changelog](https://github.com/voxpupuli/puppet-python/blob/master/CHANGELOG.md) ## Contributors From a990c0b91343d9a706bd8aa4848ad49c4cf309a3 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush Date: Wed, 24 Oct 2018 18:53:06 -0400 Subject: [PATCH 093/380] String to String[1] --- .DS_Store | Bin 0 -> 6148 bytes README.md | 1 + REFERENCE.md | 18 +++++++++--------- manifests/dotfile.pp | 10 +++++----- manifests/pip.pp | 38 +++++++++++++++++++------------------- 5 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Fri, 26 Oct 2018 11:55:46 +0200 Subject: [PATCH 094/380] Replace deprecated validate_* functions --- manifests/gunicorn.pp | 48 +++++++++++++++++----------------------- manifests/init.pp | 9 ++++---- manifests/pip.pp | 8 +------ metadata.json | 2 +- spec/defines/pip_spec.rb | 2 +- 5 files changed, 27 insertions(+), 42 deletions(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index da14dd0e..9daa7ff1 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -34,35 +34,27 @@ # } # define python::gunicorn ( - Enum['present', 'absent'] $ensure = present, - $config_dir = '/etc/gunicorn.d', - $manage_config_dir = false, - $virtualenv = false, - Enum['wsgi', 'django'] $mode = 'wsgi', - $dir = false, - $bind = false, - $environment = false, - $owner = 'www-data', - $group = 'www-data', - $appmodule = 'app:app', - $osenv = false, - $timeout = 30, - $workers = false, - $access_log_format = false, - $accesslog = false, - $errorlog = false, - $log_level = 'error', - $template = 'python/gunicorn.erb', - $args = [], + Stdlib::Absolutepath $dir, + Enum['present', 'absent'] $ensure = present, + $config_dir = '/etc/gunicorn.d', + $manage_config_dir = false, + $virtualenv = false, + Enum['wsgi', 'django'] $mode = 'wsgi', + $bind = false, + $environment = false, + $owner = 'www-data', + $group = 'www-data', + $appmodule = 'app:app', + $osenv = false, + $timeout = 30, + $workers = false, + $access_log_format = false, + $accesslog = false, + $errorlog = false, + Enum['debug', 'info', 'warning', 'error', 'critical'] $log_level = 'error', + $template = 'python/gunicorn.erb', + $args = [], ) { - - # Parameter validation - if ! $dir { - fail('python::gunicorn: dir parameter must not be empty') - } - - validate_re($log_level, 'debug|info|warning|error|critical', "Invalid \$log_level value ${log_level}") - if $manage_config_dir { file { $config_dir: ensure => directory, diff --git a/manifests/init.pp b/manifests/init.pp index 583c2d59..7ac93c0b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -61,11 +61,10 @@ default => '', } - #$allowed_versions = concat(['system', 'pypy'], $valid_versions) - #unless $version =~ Enum[allowed_versions] { - #fail("version needs to be within${allowed_versions}") - #} - validate_re($version, concat(['system', 'pypy'], $valid_versions)) + $allowed_versions = concat(['system', 'pypy'], $valid_versions) + unless $version =~ Enum[$allowed_versions] { + fail("version needs to be within${allowed_versions}") + } # Module compatibility check $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo' ] diff --git a/manifests/pip.pp b/manifests/pip.pp index 333455a6..7c61cc25 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -52,7 +52,7 @@ define python::pip ( String $pkgname = $name, Variant[Enum[present, absent, latest], String[1]] $ensure = present, - String $virtualenv = 'system', + Variant[Enum['system'], Stdlib::Absolutepath] $virtualenv = 'system', Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', @@ -87,10 +87,6 @@ } # Parameter validation - if ! $virtualenv { - fail('python::pip: virtualenv parameter must not be empty') - } - if $virtualenv == 'system' and $owner != 'root' { fail('python::pip: root user must be used when virtualenv is system') } @@ -100,8 +96,6 @@ default => $virtualenv, } - validate_absolute_path($cwd) - $log = $virtualenv ? { 'system' => $log_dir, default => $virtualenv, diff --git a/metadata.json b/metadata.json index c1c42664..3f3f2eaf 100644 --- a/metadata.json +++ b/metadata.json @@ -56,7 +56,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.6.0 < 6.0.0" + "version_requirement": ">= 4.13.1 < 6.0.0" }, { "name": "stahnma/epel", diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index a040beec..087395f3 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -24,7 +24,7 @@ context 'fails with non qualified path' do let(:params) { { virtualenv: 'venv' } } - it { is_expected.to raise_error(%r{"venv" is not an absolute path.}) } + it { is_expected.to raise_error(%r{expects a match for Variant\[Enum\['system'\].*Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]}) } end context 'suceeds with qualified path' do let(:params) { { virtualenv: '/opt/venv' } } From 69dea593d6acf72518d65148103a47a2d724f719 Mon Sep 17 00:00:00 2001 From: Greg Dubicki Date: Fri, 5 Oct 2018 10:41:11 +0200 Subject: [PATCH 095/380] Stop using 'pip search' for ensure => latest because it does not work properly with devpi as own repo/PyPi mirror and is being considered to be deprecated in pip --- manifests/pip.pp | 23 ++++++++---- spec/acceptance/virtualenv_spec.rb | 56 ++++++++++++++++++++++++++++++ spec/defines/pip_spec.rb | 31 ++++++++--------- 3 files changed, 87 insertions(+), 23 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 7c61cc25..1ac36773 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -111,11 +111,6 @@ default => "--index-url=${index}", } - $pypi_search_index = $index ? { - false => '', - default => "--index=${index}", - } - $proxy_flag = $proxy ? { false => '', default => "--proxy=${proxy}", @@ -243,10 +238,26 @@ } 'latest': { + # Unfortunately this is the smartest way of getting the latest available package version with pip as of now + # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns + # more than one line with paretheses. + $latest_version = join(["${pip_env} install ${proxy_flag} ${pkgname}==notreallyaversion 2>&1", + ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + ' | tr -d "[:space:]"']) + + # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output + $pkgname_with_dashes = regsubst($pkgname, '_', '-', 'G') + $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" + $installed_version = join(["${pip_env} freeze --all", + " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", + " | tr -d '[:space:]'"]) + + $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" + # Latest version. exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", - unless => "${pip_env} search ${pypi_search_index} ${proxy_flag} ${source} | grep -i INSTALLED.*latest", + unless => $unless_command, user => $owner, group => $group, umask => $umask, diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 5412bee3..4e4e4529 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -55,5 +55,61 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + it 'works with ensure=>latest' do + pp = <<-EOS + class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> + python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv3', + owner => 'root', + group => 'root', + } + -> + python::pip { 'rpyc' : + ensure => 'latest', + virtualenv => '/opt/venv3', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + # Of course this test will fail if between the applies a new version of the package will be released, + # but probability of this happening is minimal, so it should be acceptable. + apply_manifest(pp, catch_changes: true) + end + it 'works with ensure=>latest for package with underscore in its name' do + pp = <<-EOS + class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> + python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv4', + owner => 'root', + group => 'root', + } + -> + python::pip { 'Randomized_Requests' : + ensure => 'latest', + virtualenv => '/opt/venv4', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + # Of course this test will fail if between the applies a new version of the package will be released, + # but probability of this happening is minimal, so it should be acceptable. + apply_manifest(pp, catch_changes: true) + end end end diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 087395f3..1548b7b6 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -64,23 +64,11 @@ it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } end - context 'does not add proxy to search command if set to latest and proxy is unset' do - let(:params) { { ensure: 'latest' } } - - it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } - it { is_expected.to contain_exec('pip_install_rpyc').without_unless(%r{--proxy}) } - end context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } end - context 'adds proxy to search command if set to latest' do - let(:params) { { proxy: 'http://my.proxy:3128', ensure: 'latest' } } - - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --upgrade --proxy=http://my.proxy:3128 rpyc ;}") } - it { is_expected.to contain_exec('pip_install_rpyc').with_unless('pip search --proxy=http://my.proxy:3128 rpyc | grep -i INSTALLED.*latest') } - end end describe 'index as' do @@ -94,11 +82,6 @@ it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } end - context 'adds index to search command if set to latest' do - let(:params) { { index: 'http://www.example.com/simple/', ensure: 'latest' } } - - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install --upgrade $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --upgrade --index-url=http://www.example.com/simple/ rpyc ;}") } - end end describe 'path as' do @@ -109,6 +92,20 @@ it { is_expected.to contain_exec('pip_install_rpyc').with_path(['/opt/python3/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin']) } end end + + describe 'install latest' do + context 'does not use pip search in unless' do + let(:params) { { ensure: 'latest' } } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_unless(%r{search}) } + end + context 'checks installed version of a package by converting underscores in its name to dashes' do + let(:params) { { ensure: 'latest', pkgname: 'wordpress_json' } } + + # yes, the exec title does not change if we use different pgkname + it { is_expected.to contain_exec('pip_install_rpyc').with_unless(%r{wordpress-json}) } + end + end end end From 2bfe404bcfd5bf057e045d675620310184159aeb Mon Sep 17 00:00:00 2001 From: Greg Dubicki Date: Sun, 4 Nov 2018 10:11:35 +0000 Subject: [PATCH 096/380] Fix $filename and $mode types erroneously changed in a990c0b and add tests to ensure this kind of breakage will not repeat --- manifests/dotfile.pp | 4 +-- spec/defines/dotfile_spec.rb | 50 ++++++++++++++++++++++++++++++++++++ spec/defines/pyvenv_spec.rb | 2 +- 3 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 spec/defines/dotfile_spec.rb diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 9d6e3923..47556fea 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -24,10 +24,10 @@ # define python::dotfile ( Enum['absent', 'present'] $ensure = 'present', - Stdlib::Filemode $filename = $title, + String[1] $filename = $title, String[1] $owner = 'root', String[1] $group = 'root', - String[1] $mode = '0644', + Stdlib::Filemode $mode = '0644', Hash $config = {}, ) { $parent_dir = dirname($filename) diff --git a/spec/defines/dotfile_spec.rb b/spec/defines/dotfile_spec.rb new file mode 100644 index 00000000..d7d469e4 --- /dev/null +++ b/spec/defines/dotfile_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +describe 'python::dotfile', type: :define do + on_supported_os.each do |os, facts| + context("on #{os} ") do + let :facts do + facts + end + + describe 'dotfile as' do + context 'fails with empty string filename' do + let(:title) { '' } + + it { is_expected.to raise_error(%r{Evaluation Error: Empty string title at 0. Title strings must have a length greater than zero.}) } + end + context 'fails with incorrect mode' do + let(:title) { '/etc/pip.conf' } + let(:params) { { mode: 'not-a-mode' } } + + it { is_expected.to raise_error(%r{Evaluation Error: Error while evaluating a Resource}) } + end + context 'succeeds with filename in existing path' do + let(:title) { '/etc/pip.conf' } + + it { is_expected.to contain_file('/etc/pip.conf').with_mode('0644') } + end + context 'succeeds with filename in a non-existing path' do + let(:title) { '/home/someuser/.pip/pip.conf' } + + it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o root -g root -d /home/someuser/.pip') } + it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_mode('0644') } + end + context 'succeeds when set owner' do + let(:title) { '/home/someuser/.pip/pip.conf' } + let(:params) { { owner: 'someuser' } } + + it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o someuser -g root -d /home/someuser/.pip') } + it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_owner('someuser') } + end + context 'succeeds when set group set' do + let(:title) { '/home/someuser/.pip/pip.conf' } + let(:params) { { group: 'somegroup' } } + + it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o root -g somegroup -d /home/someuser/.pip') } + it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_group('somegroup') } + end + end + end + end +end diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 876afe12..285a0de5 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -2,7 +2,7 @@ describe 'python::pyvenv', type: :define do on_supported_os.each do |os, facts| - context "on #{os} " do + context("on #{os} ") do let :facts do facts end From bba65fe926d0f813fa796e2c5e5fdc9b4944c9bf Mon Sep 17 00:00:00 2001 From: Greg Dubicki Date: Thu, 8 Nov 2018 00:05:01 +0100 Subject: [PATCH 097/380] Temporarily disable broken test setup as it fails long before running any code test --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index db8ac85a..90d238a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,12 +97,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required - - rvm: 2.5.1 - bundler_args: --without development release - dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker - services: docker - sudo: required +# - rvm: 2.5.1 +# bundler_args: --without development release +# dist: trusty +# env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker +# services: docker +# sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty From 40a8949e647c42cd4df17e5899f887ea0ffeef35 Mon Sep 17 00:00:00 2001 From: Greg Dubicki Date: Sat, 10 Nov 2018 23:39:36 +0100 Subject: [PATCH 098/380] Revert "Temporarily disable broken test setup" This reverts commit bba65fe926d0f813fa796e2c5e5fdc9b4944c9bf. --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90d238a7..db8ac85a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,12 +97,12 @@ matrix: env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker services: docker sudo: required -# - rvm: 2.5.1 -# bundler_args: --without development release -# dist: trusty -# env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker -# services: docker -# sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty From 9e93b41516917bea1be74586dc5528ab7443fa37 Mon Sep 17 00:00:00 2001 From: Jochen Radmacher Date: Thu, 15 Nov 2018 19:13:49 +0100 Subject: [PATCH 099/380] Change default indent to 2 Spaces in .editorconfig The "de facto" coding style seems to be 2 spaces indent in *.pp files. Make this the default for supported editors --- .editorconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index b79ef58d..0661db27 100644 --- a/.editorconfig +++ b/.editorconfig @@ -5,9 +5,9 @@ root = true [*] charset = utf-8 end_of_line = lf -indent_size = 4 -tab_width = 4 -indent_style = tab +indent_size = 2 +tab_width = 2 +indent_style = space insert_final_newline = true trim_trailing_whitespace = true From b0111c24ede38be91b09e03e53e6feb09866a393 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 16 Nov 2018 16:19:44 +0100 Subject: [PATCH 100/380] Fix Ubuntu bionic package installation This rewrites the OS-specific installation to a more generic case statement. It now only lists the trusty exception for the old naming which makes it future proof. --- manifests/install.pp | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index fe0e1911..cb2076ee 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -204,31 +204,34 @@ } } - if $::osfamily == 'RedHat' { - if $pip_ensure != 'absent' { - if $python::use_epel == true { - include 'epel' - Class['epel'] -> Package['pip'] + case $facts['os']['family'] { + 'RedHat': { + if $pip_ensure != 'absent' { + if $python::use_epel == true { + include 'epel' + Class['epel'] -> Package['pip'] + } } + if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) { + if $python::use_epel == true { + include 'epel' + Class['epel'] -> Package['virtualenv'] + } + } + + $virtualenv_package = "${python}-virtualenv" } - if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) { - if $python::use_epel == true { - include 'epel' - Class['epel'] -> Package['virtualenv'] + 'Debian': { + if fact('lsbdistcodename') == 'trusty' { + $virtualenv_package = 'python-virtualenv' + } else { + $virtualenv_package = 'virtualenv' } } - - $virtualenv_package = "${python}-virtualenv" - } else { - if fact('lsbdistcodename') == 'jessie' { + 'Gentoo': { $virtualenv_package = 'virtualenv' - } elsif fact('lsbdistcodename') == 'stretch' { - $virtualenv_package = 'virtualenv' - } elsif fact('lsbdistcodename') == 'xenial' { - $virtualenv_package = 'virtualenv' - } elsif $facts['os']['family'] == 'Gentoo' { - $virtualenv_package = 'virtualenv' - } else { + } + default: { $virtualenv_package = 'python-virtualenv' } } From 1ef8ee31ea45e3bc4354c86f51360acc6e4db99d Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Wed, 12 Dec 2018 18:06:14 +0000 Subject: [PATCH 101/380] remove .DS_Store That was inadvertently added. --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Wed, 12 Dec 2018 18:43:37 +0000 Subject: [PATCH 102/380] README.md: remove obsolete Installation section Puppet Forge has installation instructions on each module's page already. --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index a36feb5b..5a3081b9 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,6 @@ This module has been tested to work on the following systems. * Ubuntu 16.04 * Ubuntu 18.04 -## Installation - -```shell -git submodule add https://github.com/stankevich/puppet-python.git /path/to/python -``` -OR - -``` shell -puppet module install puppet-python -``` - ## Usage For class usage refer to the [Reference]("https://github.com/voxpupuli/puppet-python/blob/master/REFERENCE.md). If contributing, this is updated with ```shell From fe1a53f6605de2cab12fae11c2b74ddabc29a6db Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Wed, 12 Dec 2018 18:45:46 +0000 Subject: [PATCH 103/380] README.md: remove Compatibility section This section duplicates data already stored in metadata.json (which is displayed on Puppet Forge), so will inevitably become out of sync (as it already is, since Puppet v6 is supported but not listed). --- README.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/README.md b/README.md index 5a3081b9..f905a36f 100644 --- a/README.md +++ b/README.md @@ -4,28 +4,6 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn **Please note:** The module [stankevich/python](https://forge.puppet.com/stankevich/python) has been deprecated and is now available under Vox Pupuli: [puppet/python](https://forge.puppet.com/puppet/python). -## Compatibility # - -See `.travis.yml` for compatibility matrix. - -* Puppet v4 -* Puppet v5 - -### OS Distributions ## - -This module has been tested to work on the following systems. - -* Debian 8 -* Debian 9 -* EL 6 -* EL 7 -* CentOS 7 -* Gentoo (and Sabayon) -* Suse 11 -* Ubuntu 14.04 -* Ubuntu 16.04 -* Ubuntu 18.04 - ## Usage For class usage refer to the [Reference]("https://github.com/voxpupuli/puppet-python/blob/master/REFERENCE.md). If contributing, this is updated with ```shell From 5d311d1d3abb061f1c77e8f0c390f484e13b4ef0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 16 Dec 2018 00:49:15 +0100 Subject: [PATCH 104/380] modulesync 2.3.1 --- .editorconfig | 10 +---- .github/CONTRIBUTING.md | 15 ++++++++ .msync.yml | 2 +- .pmtignore | 1 + .travis.yml | 38 +++++++++---------- Dockerfile | 21 ++++++++++ Gemfile | 7 ++-- spec/acceptance/nodesets/centos-511-x64.yml | 15 -------- spec/acceptance/nodesets/centos-6-x64.yml | 15 -------- spec/acceptance/nodesets/centos-66-x64-pe.yml | 17 --------- spec/acceptance/nodesets/centos-7-x64.yml | 15 -------- spec/acceptance/nodesets/debian-78-x64.yml | 15 -------- spec/acceptance/nodesets/debian-82-x64.yml | 15 -------- spec/acceptance/nodesets/fedora-25-x64.yml | 16 -------- spec/acceptance/nodesets/fedora-26-x64.yml | 16 -------- spec/acceptance/nodesets/fedora-27-x64.yml | 18 --------- .../nodesets/ubuntu-server-1204-x64.yml | 15 -------- .../nodesets/ubuntu-server-1404-x64.yml | 15 -------- .../nodesets/ubuntu-server-1604-x64.yml | 15 -------- 19 files changed, 63 insertions(+), 218 deletions(-) create mode 100644 Dockerfile delete mode 100644 spec/acceptance/nodesets/centos-511-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-6-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml delete mode 100644 spec/acceptance/nodesets/centos-7-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-78-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-82-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-25-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-26-x64.yml delete mode 100644 spec/acceptance/nodesets/fedora-27-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml diff --git a/.editorconfig b/.editorconfig index 0661db27..d77700e3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,7 @@ # editorconfig.org +# MANAGED BY MODULESYNC + root = true [*] @@ -10,11 +12,3 @@ tab_width = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true - -[*.txt] -trim_trailing_whitespace = false - -[*.{md,json,yml}] -trim_trailing_whitespace = false -indent_style = space -indent_size = 2 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 832578e1..4a519698 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -109,6 +109,21 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` +### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + ## Integration tests The unit tests just check the code runs, not that it does exactly what diff --git a/.msync.yml b/.msync.yml index 1d2221fa..648cf244 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.2.0' +modulesync_config_version: '2.3.1' diff --git a/.pmtignore b/.pmtignore index fb589575..4e6d54b8 100644 --- a/.pmtignore +++ b/.pmtignore @@ -18,3 +18,4 @@ Puppetfile.lock *.iml .*.sw? .yardoc/ +Dockerfile diff --git a/.travis.yml b/.travis.yml index db8ac85a..06169e38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,109 +28,109 @@ matrix: - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required - rvm: 2.5.1 bundler_args: --without development release dist: trusty - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker sudo: required branches: @@ -148,7 +148,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" + secure: "" on: tags: true # all_branches is required to use tags diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..27a33cf6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:2.5.1 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index 7ed69d4e..9648d7de 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,8 @@ group :test do gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', :require => false + gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' + gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' end group :development do @@ -43,7 +44,7 @@ group :system_tests do if beaker_version = ENV['BEAKER_VERSION'] gem 'beaker', *location_for(beaker_version) else - gem 'beaker', '>= 3.9.0', :require => false + gem 'beaker', '>= 4.2.0', :require => false end if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] gem 'beaker-rspec', *location_for(beaker_rspec_version) @@ -51,7 +52,7 @@ group :system_tests do gem 'beaker-rspec', :require => false end gem 'serverspec', :require => false - gem 'beaker-hostgenerator', '>= 1.1.10', :require => false + gem 'beaker-hostgenerator', '>= 1.1.22', :require => false gem 'beaker-docker', :require => false gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml deleted file mode 100644 index 089d646a..00000000 --- a/spec/acceptance/nodesets/centos-511-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-511-x64: - roles: - - master - platform: el-5-x86_64 - box: puppetlabs/centos-5.11-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-6-x64.yml b/spec/acceptance/nodesets/centos-6-x64.yml deleted file mode 100644 index 16abc8f1..00000000 --- a/spec/acceptance/nodesets/centos-6-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-6-x64: - roles: - - master - platform: el-6-x86_64 - box: centos/6 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml deleted file mode 100644 index 1e7aea6d..00000000 --- a/spec/acceptance/nodesets/centos-66-x64-pe.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-66-x64: - roles: - - master - - database - - dashboard - platform: el-6-x86_64 - box: puppetlabs/centos-6.6-64-puppet-enterprise - hypervisor: vagrant -CONFIG: - type: pe -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/centos-7-x64.yml b/spec/acceptance/nodesets/centos-7-x64.yml deleted file mode 100644 index e05a3ae1..00000000 --- a/spec/acceptance/nodesets/centos-7-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - centos-7-x64: - roles: - - master - platform: el-7-x86_64 - box: centos/7 - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml deleted file mode 100644 index 6ef6de8c..00000000 --- a/spec/acceptance/nodesets/debian-78-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-78-x64: - roles: - - master - platform: debian-7-amd64 - box: puppetlabs/debian-7.8-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml deleted file mode 100644 index 9897a8fc..00000000 --- a/spec/acceptance/nodesets/debian-82-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - debian-82-x64: - roles: - - master - platform: debian-8-amd64 - box: puppetlabs/debian-8.2-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-25-x64.yml b/spec/acceptance/nodesets/fedora-25-x64.yml deleted file mode 100644 index 54dd3305..00000000 --- a/spec/acceptance/nodesets/fedora-25-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-25-x64: - roles: - - master - platform: fedora-25-x86_64 - box: fedora/25-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-26-x64.yml b/spec/acceptance/nodesets/fedora-26-x64.yml deleted file mode 100644 index 598822b0..00000000 --- a/spec/acceptance/nodesets/fedora-26-x64.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -HOSTS: - fedora-26-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/26-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/fedora-27-x64.yml b/spec/acceptance/nodesets/fedora-27-x64.yml deleted file mode 100644 index c2b61ebb..00000000 --- a/spec/acceptance/nodesets/fedora-27-x64.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# platform is fedora 26 because there is no puppet-agent -# for fedora 27 as of 2017-11-17 -HOSTS: - fedora-27-x64: - roles: - - master - platform: fedora-26-x86_64 - box: fedora/27-cloud-base - hypervisor: vagrant -CONFIG: - type: aio -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml deleted file mode 100644 index 29102c56..00000000 --- a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1204-x64: - roles: - - master - platform: ubuntu-12.04-amd64 - box: puppetlabs/ubuntu-12.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml deleted file mode 100644 index 054e6588..00000000 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1404-x64: - roles: - - master - platform: ubuntu-14.04-amd64 - box: puppetlabs/ubuntu-14.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml deleted file mode 100644 index bc85e0e8..00000000 --- a/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml +++ /dev/null @@ -1,15 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - ubuntu-server-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - box: puppetlabs/ubuntu-16.04-64-nocm - hypervisor: vagrant -CONFIG: - type: foss -... -# vim: syntax=yaml From bddf0491d18b70fc8028b6ec76f457178f7c8cb5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 26 Dec 2018 00:25:44 +0100 Subject: [PATCH 105/380] fix Gentoo support The hardcoded package name wasn't available on Gentoo. The tests correctly discover this, but the Gentoo parts weren't executed for a long time, because of missing facts in facterdb. --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index cb2076ee..e93388ed 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -96,7 +96,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', - require => Package['python-dev'] + require => Package[$pythondev], } } 'scl': { From 1da4a7420f47663d28e9720f7a1026e9945b82a0 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Fri, 11 Jan 2019 15:25:26 -0200 Subject: [PATCH 106/380] Allow bootstrap pip without managing python packages --- manifests/install.pp | 15 ++--------- manifests/params.pp | 5 ++++ manifests/pip/bootstrap.pp | 52 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 manifests/pip/bootstrap.pp diff --git a/manifests/install.pp b/manifests/install.pp index e93388ed..5ac326ae 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -72,19 +72,8 @@ } # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - exec { 'bootstrap pip': - command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python', - unless => 'which pip', - path => [ '/bin', '/usr/bin', '/usr/local/bin' ], - require => Package['python'], - } - - # Puppet is opinionated about the pip command name - file { 'pip-python': - ensure => link, - path => '/usr/bin/pip-python', - target => '/usr/bin/pip', - require => Exec['bootstrap pip'], + class { 'python::pip::boostrap': + version => 'pip', } Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> diff --git a/manifests/params.pp b/manifests/params.pp index d8e5d5d4..4819278f 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,6 +27,11 @@ $use_epel = false } + $pip_lookup_path = $::osfamily ? { + 'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ], + default => [ '/bin', '/usr/bin', '/usr/local/bin' ] + } + $gunicorn_package_name = $::osfamily ? { 'RedHat' => 'python-gunicorn', default => 'gunicorn', diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp new file mode 100644 index 00000000..ea3e70b7 --- /dev/null +++ b/manifests/pip/bootstrap.pp @@ -0,0 +1,52 @@ +# +# @summary allow to bootstrap pip when python is managed from other module +# +# @param version should be pip or pip3 +# @param manage_python if python module will manage deps +# +# @example +# class { 'python::pip::bootstrap': +# version => 'pip', +# } +class python::pip::bootstrap ( + Enum['pip', 'pip3'] $version = 'pip', + Variant[Boolean, String] $manage_python = false, +) inherits ::python::params { + if $manage_python { + include ::python + } else { + $target_src_pip_path = $facts['os']['family'] ? { + 'AIX' => '/opt/freeware/bin', + default => '/usr/bin' + } + if $version == 'pip3' { + exec { 'bootstrap pip3': + command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python3', + unless => 'which pip3', + path => $python::params::pip_lookup_path, + require => Package['python3'], + } + # puppet is opinionated about the pip command name + file { 'pip3-python': + ensure => link, + path => '/usr/bin/pip3', + target => "${target_src_pip_path}/pip${::facts['python3_release']}", + require => Exec['bootstrap pip3'], + } + } else { + exec { 'bootstrap pip': + command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python', + unless => 'which pip', + path => $python::params::pip_lookup_path, + require => Package['python'], + } + # puppet is opinionated about the pip command name + file { 'pip-python': + ensure => link, + path => '/usr/bin/pip', + target => "${target_src_pip_path}/pip${::facts['python2_release']}", + require => Exec['bootstrap pip'], + } + } + } +} From 69df496049d2d5eae49b1276bd2612bc0c697a25 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Fri, 11 Jan 2019 15:26:42 -0200 Subject: [PATCH 107/380] following previous recommendation --- manifests/params.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 4819278f..b0e095e5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -27,7 +27,7 @@ $use_epel = false } - $pip_lookup_path = $::osfamily ? { + $pip_lookup_path = $facts['os']['family'] ? { 'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ], default => [ '/bin', '/usr/bin', '/usr/local/bin' ] } From 3f6f7bb31acedd7fbaae8a6a0d82d5de0a13af41 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 17:47:47 -0200 Subject: [PATCH 108/380] removed version since this is the default value --- manifests/install.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 5ac326ae..0a1e1419 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -72,9 +72,7 @@ } # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - class { 'python::pip::boostrap': - version => 'pip', - } + class { 'python::pip::boostrap':; } Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> From d64b27366d0ccca27d230f60fcc4d4f9928df334 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 14 Jan 2019 17:55:31 -0200 Subject: [PATCH 109/380] Update manifests/install.pp Co-Authored-By: feltra --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 0a1e1419..07fa4083 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -72,7 +72,7 @@ } # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - class { 'python::pip::boostrap':; } + include 'python::pip::boostrap' Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> From 431d2971f0ff2c83713ce1f9006c48dcc413ae77 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 14 Jan 2019 19:15:52 -0200 Subject: [PATCH 110/380] Update manifests/install.pp Co-Authored-By: feltra --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 07fa4083..e7b52347 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -72,7 +72,7 @@ } # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - include 'python::pip::boostrap' + include 'python::pip::bootstrap' Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> From f301750c1b6cb9fda79994b14256c3cf7cf5329c Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 22:00:38 -0200 Subject: [PATCH 111/380] Allow pip to work in AIX systems --- manifests/install.pp | 48 ++++++++++++++++++++++++++++++++++---------- manifests/params.pp | 13 +++++++++--- manifests/pip.pp | 24 +++++++++++++--------- 3 files changed, 61 insertions(+), 24 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e7b52347..5b904bbb 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -12,7 +12,8 @@ default => "${python::version}", # lint:ignore:only_variable_string } - $pythondev = $::osfamily ? { + $pythondev = $facts['os']['family'] ? { + 'AIX' => "${python}-devel", 'RedHat' => "${python}-devel", 'Debian' => "${python}-dev", 'Suse' => "${python}-devel", @@ -83,7 +84,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', - require => Package[$pythondev], + require => Package['python-dev'], } } 'scl': { @@ -177,17 +178,42 @@ } } default: { + case $facts['os']['family'] { + 'AIX': { + if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + class { 'python::pip::bootstap': + version => 'pip3', + } + } else { + package { 'python-pip': + ensure => $pip_ensure, + require => Package['python'], + provider => 'yum', + } + } + if $pythondev { + package { 'python-dev': + ensure => $dev_ensure, + name => $pythondev, + alias => $pythondev, + provider => 'yum', + } + } - package { 'pip': - ensure => $pip_ensure, - require => Package['python'], - } + } + default: { + package { 'pip': + ensure => $pip_ensure, + require => Package['python'], + } + if $pythondev { + package { 'python-dev': + ensure => $dev_ensure, + name => $pythondev, + alias => $pythondev, + } + } - if $pythondev { - package { 'python-dev': - ensure => $dev_ensure, - name => $pythondev, - alias => $pythondev, } } diff --git a/manifests/params.pp b/manifests/params.pp index b0e095e5..25b27e2c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,5 +1,6 @@ -# @api private -# @summary The python Module default configuration settings. +# == Class: python::params +# +# The python Module default configuration settings. # class python::params { $ensure = 'present' @@ -14,6 +15,7 @@ 'RedHat' => ['3','27','33'], 'Debian' => ['3', '3.3', '2.7'], 'Suse' => [], + 'AIX' => ['python3'], 'Gentoo' => ['2.7', '3.3', '3.4', '3.5'] } @@ -27,12 +29,17 @@ $use_epel = false } + $group = $facts['os']['family'] ? { + 'AIX' => 'system', + default => 'root' + } + $pip_lookup_path = $facts['os']['family'] ? { 'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ], default => [ '/bin', '/usr/bin', '/usr/local/bin' ] } - $gunicorn_package_name = $::osfamily ? { + $gunicorn_package_name = $facts['os']['family'] ? { 'RedHat' => 'python-gunicorn', default => 'gunicorn', } diff --git a/manifests/pip.pp b/manifests/pip.pp index 1ac36773..43a9c968 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,5 +1,4 @@ -# # @summary Installs and manages packages from pip. # # @param name must be unique @@ -56,7 +55,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', - String[1] $group = 'root', + $group = undef, $umask = undef, $index = false, Variant[Boolean, String] $proxy = false, @@ -69,10 +68,15 @@ Numeric $timeout = 1800, String[1] $log_dir = '/tmp', Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], -) { +){ $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') - + if $group { + $_group = $group + } else { + include ::python::params + $_group = $python::params::group + } # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell $exec_prefix = $python_provider ? { @@ -184,7 +188,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, @@ -196,7 +200,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, @@ -213,7 +217,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, @@ -228,7 +232,7 @@ command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, @@ -259,7 +263,7 @@ command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", unless => $unless_command, user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, @@ -274,7 +278,7 @@ command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $group, + group => $_group, umask => $umask, cwd => $cwd, environment => $environment, From 635e9240b82be1f913f76fac5c20221014326dab Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:29:54 -0200 Subject: [PATCH 112/380] lint --- manifests/init.pp | 2 +- manifests/install.pp | 2 +- manifests/params.pp | 3 ++- manifests/pip.pp | 5 ++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7ac93c0b..4d946ebc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -67,7 +67,7 @@ } # Module compatibility check - $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo' ] + $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX' ] if ! ($facts['os']['family'] in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } diff --git a/manifests/install.pp b/manifests/install.pp index 5b904bbb..ea2a08ba 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -13,7 +13,7 @@ } $pythondev = $facts['os']['family'] ? { - 'AIX' => "${python}-devel", + 'AIX' => "${python}-devel", 'RedHat' => "${python}-devel", 'Debian' => "${python}-dev", 'Suse' => "${python}-devel", diff --git a/manifests/params.pp b/manifests/params.pp index 25b27e2c..e028dc21 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,4 +1,5 @@ -# == Class: python::params +# @api private +# @summary The python Module default configuration settings. # # The python Module default configuration settings. # diff --git a/manifests/pip.pp b/manifests/pip.pp index 43a9c968..be8c2c8c 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,4 +1,4 @@ - +getparam(Class['python'], 'version') # @summary Installs and manages packages from pip. # # @param name must be unique @@ -74,8 +74,7 @@ if $group { $_group = $group } else { - include ::python::params - $_group = $python::params::group + $_group = getparam(Class['python'], 'group') } # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell From 9239cc208d4daa8594845de2d1921edf71476efd Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:50:39 -0200 Subject: [PATCH 113/380] adjust pythondev --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index ea2a08ba..e2749b51 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -84,7 +84,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', - require => Package['python-dev'], + require => Package[$pythondev], } } 'scl': { From 55cae980086622ab8eede727b6d01e9ef1f04d14 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:55:20 -0200 Subject: [PATCH 114/380] remove the need of _group --- manifests/pip.pp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index be8c2c8c..20193b5c 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -55,7 +55,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', - $group = undef, + $group = getparam(Class['python'], 'group'), $umask = undef, $index = false, Variant[Boolean, String] $proxy = false, @@ -71,11 +71,7 @@ ){ $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') - if $group { - $_group = $group - } else { - $_group = getparam(Class['python'], 'group') - } + # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell $exec_prefix = $python_provider ? { @@ -187,7 +183,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, @@ -199,7 +195,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, @@ -216,7 +212,7 @@ command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, @@ -231,7 +227,7 @@ command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, @@ -262,7 +258,7 @@ command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", unless => $unless_command, user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, @@ -277,7 +273,7 @@ command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, - group => $_group, + group => $group, umask => $umask, cwd => $cwd, environment => $environment, From 4de7e11295750032c4ccb2435f66151cf7970c1f Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Mon, 14 Jan 2019 23:55:37 -0200 Subject: [PATCH 115/380] adjust ::python::version --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index e2749b51..d7af925f 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -180,7 +180,7 @@ default: { case $facts['os']['family'] { 'AIX': { - if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + if "${python::version}" =~ /^python3/ { #lint:ignore:only_variable_string class { 'python::pip::bootstap': version => 'pip3', } From c070b1d60b9289284defbc41a09d1c2598157332 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 10:29:22 -0200 Subject: [PATCH 116/380] add operatingsystem to metadata.json --- metadata.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metadata.json b/metadata.json index 3f3f2eaf..e6536cd6 100644 --- a/metadata.json +++ b/metadata.json @@ -15,6 +15,9 @@ "gunicorn" ], "operatingsystem_support": [ + { + "operatingsystem": "AIX" + }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ From 9ac732376ccd5530315e1d954c2ae11bce8d8d20 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 10:41:05 -0200 Subject: [PATCH 117/380] fix typo --- manifests/pip.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 20193b5c..304b4863 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -1,4 +1,3 @@ -getparam(Class['python'], 'version') # @summary Installs and manages packages from pip. # # @param name must be unique From 7cd9f6d79f61dab4cbcda9757750cd38fa47698c Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 11:20:11 -0200 Subject: [PATCH 118/380] adjust python version --- manifests/install.pp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index d7af925f..88109484 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,10 +6,11 @@ # class python::install { - $python = $::python::version ? { + $python_version = getparam(Class['python'], 'version') + $python = $python_version ? { 'system' => 'python', 'pypy' => 'pypy', - default => "${python::version}", # lint:ignore:only_variable_string + default => "${python_version}", # lint:ignore:only_variable_string } $pythondev = $facts['os']['family'] ? { @@ -180,7 +181,7 @@ default: { case $facts['os']['family'] { 'AIX': { - if "${python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string class { 'python::pip::bootstap': version => 'pip3', } From 3a3026e6bf548d85ce95140e3a20b8a8d8956bc6 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Tue, 15 Jan 2019 18:51:03 -0200 Subject: [PATCH 119/380] replaced getparam by getvar on retrieving default group --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 304b4863..e2ab11c6 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -54,7 +54,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', - $group = getparam(Class['python'], 'group'), + $group = getvar('python::params::group'), $umask = undef, $index = false, Variant[Boolean, String] $proxy = false, From 0b03102af69bb8357f08b1198cc18b904e638a59 Mon Sep 17 00:00:00 2001 From: Jean Michel Feltrin Date: Thu, 17 Jan 2019 11:42:53 -0200 Subject: [PATCH 120/380] added AIX releases --- metadata.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e6536cd6..dbf0c3a4 100644 --- a/metadata.json +++ b/metadata.json @@ -16,7 +16,11 @@ ], "operatingsystem_support": [ { - "operatingsystem": "AIX" + "operatingsystem": "AIX", + "operatingsystemrelease": [ + "6100-09-11-1810", + "7100-05-03-1837" + ] }, { "operatingsystem": "CentOS", From 72c34fabd1b3a2bf3e7f2a52c4bdd1ccd9b392cb Mon Sep 17 00:00:00 2001 From: Jochen Radmacher Date: Thu, 22 Nov 2018 18:52:34 +0100 Subject: [PATCH 121/380] pyvenv is deprecated "python3 -m venv" is the recommended replacement since 3.6 pyvenv will be removed in 3.8 Debian (+Ubuntu) need an extra package for the script and the _not deprecated_ python module --- manifests/pyvenv.pp | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 66957731..08703585 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -37,9 +37,31 @@ if $ensure == 'present' { - $virtualenv_cmd = $version ? { - 'system' => "${python::exec_prefix}pyvenv", - default => "${python::exec_prefix}pyvenv-${version}", + # Debian splits the venv module into a seperate package + if ( $facts['os']['family'] == 'Debian'){ + $python3_venv_package="python${version}-venv" + case $facts['os']['distro']['codename'] { + 'xenial','bionic','cosmic','disco', + 'jessie','stretch','buster': { + package {$python3_venv_package: + before => File[$venv_dir], + } + } + default: {} + } + } + + # pyvenv is deprecated since 3.6 and will be removed in 3.8 + if (versioncmp($::python3_version, '3.6') >=0) { + $virtualenv_cmd = $version ? { + 'system' => "${python::exec_prefix}python3 -m venv", + default => "${python::exec_prefix}python${version} -m venv", + } + } else { + $virtualenv_cmd = $version ? { + 'system' => "${python::exec_prefix}pyvenv", + default => "${python::exec_prefix}pyvenv-${version}", + } } $_path = $::python::provider ? { From 3d102f4cf1d057aaaf13b47608d9724575ce2c9a Mon Sep 17 00:00:00 2001 From: Jochen Radmacher Date: Fri, 23 Nov 2018 15:20:14 +0100 Subject: [PATCH 122/380] use explicit python version --- manifests/pyvenv.pp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 08703585..9c6d58a6 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -36,13 +36,19 @@ include ::python if $ensure == 'present' { + $python_version = $version ? { + 'system' => "$::python3_version", + default => "${version}", + } # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian'){ - $python3_venv_package="python${version}-venv" + $python3_venv_package="python${python_version}-venv" case $facts['os']['distro']['codename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { + notify {"python3_venv_package: $python3_venv_package": + } package {$python3_venv_package: before => File[$venv_dir], } @@ -53,15 +59,9 @@ # pyvenv is deprecated since 3.6 and will be removed in 3.8 if (versioncmp($::python3_version, '3.6') >=0) { - $virtualenv_cmd = $version ? { - 'system' => "${python::exec_prefix}python3 -m venv", - default => "${python::exec_prefix}python${version} -m venv", - } + $virtualenv_cmd = "${python::exec_prefix}python${python_version} -m venv" } else { - $virtualenv_cmd = $version ? { - 'system' => "${python::exec_prefix}pyvenv", - default => "${python::exec_prefix}pyvenv-${version}", - } + $virtualenv_cmd = "${python::exec_prefix}pyvenv-${python_version}" } $_path = $::python::provider ? { From 250c7ad855aaa90e68043231670930cb43038eca Mon Sep 17 00:00:00 2001 From: Jochen Radmacher Date: Wed, 28 Nov 2018 13:33:36 +0100 Subject: [PATCH 123/380] require virtualenv to be ready before installing packages with pip This should fix the first part of issue #430 "pip3 missing in the virtualenv ?" using a proxy for download is not addressed here --- manifests/pip.pp | 5 +++++ manifests/pyvenv.pp | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index e2ab11c6..2171f0dc 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -71,6 +71,11 @@ $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') + if $virtualenv != 'system' { + Python::Pyvenv <| |> -> Python::Pip[$name] + Python::Virtualenv <| |> -> Python::Pip[$name] + } + # Get SCL exec prefix # NB: this will not work if you are running puppet from scl enabled shell $exec_prefix = $python_provider ? { diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 9c6d58a6..b6304530 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -47,8 +47,6 @@ case $facts['os']['distro']['codename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { - notify {"python3_venv_package: $python3_venv_package": - } package {$python3_venv_package: before => File[$venv_dir], } From e784147a70ef9d7517d046a14b9618bcbc9f278e Mon Sep 17 00:00:00 2001 From: Jochen Radmacher Date: Fri, 30 Nov 2018 19:14:49 +0100 Subject: [PATCH 124/380] allow all python versions Fixes issue #448, "Impossible to use version number in Ubuntu 16.04" 1) It does not make sense to restrict the allowed python versions per distribution. Newer distribution releases add new python versions and you can add repositories containing backports. 2) The List was outdated. Note: python version is needed for spec test --- manifests/init.pp | 6 +++--- manifests/install.pp | 3 ++- manifests/params.pp | 8 +------- manifests/pyvenv.pp | 10 +++++----- spec/default_module_facts.yml | 3 +++ spec/defines/pyvenv_spec.rb | 9 ++++++--- 6 files changed, 20 insertions(+), 19 deletions(-) create mode 100644 spec/default_module_facts.yml diff --git a/manifests/init.pp b/manifests/init.pp index 4d946ebc..e267ce16 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -61,9 +61,9 @@ default => '', } - $allowed_versions = concat(['system', 'pypy'], $valid_versions) - unless $version =~ Enum[$allowed_versions] { - fail("version needs to be within${allowed_versions}") + unless $version =~ Pattern[/\A(python)?[0-9](\.[0-9])+/, + /\Apypy\Z/, /\Asystem\Z/] { + fail("version needs to be pypy, system or a version string like '3.5' or 'python3.5)") } # Module compatibility check diff --git a/manifests/install.pp b/manifests/install.pp index 88109484..b6911259 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,7 +10,8 @@ $python = $python_version ? { 'system' => 'python', 'pypy' => 'pypy', - default => "${python_version}", # lint:ignore:only_variable_string + /\A(python)?([0-9](\.?[0-9])+)/ => "python${1}", + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? { diff --git a/manifests/params.pp b/manifests/params.pp index e028dc21..d7bfdaa2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,13 +12,7 @@ $gunicorn = 'absent' $manage_gunicorn = true $provider = undef - $valid_versions = $::osfamily ? { - 'RedHat' => ['3','27','33'], - 'Debian' => ['3', '3.3', '2.7'], - 'Suse' => [], - 'AIX' => ['python3'], - 'Gentoo' => ['2.7', '3.3', '3.4', '3.5'] - } + $valid_versions = undef if $::osfamily == 'RedHat' { if $::operatingsystem != 'Fedora' { diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index b6304530..eed7f4c4 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -37,15 +37,15 @@ if $ensure == 'present' { $python_version = $version ? { - 'system' => "$::python3_version", - default => "${version}", + 'system' => $facts['python3_version'], + default => $version, } # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian'){ $python3_venv_package="python${python_version}-venv" - case $facts['os']['distro']['codename'] { - 'xenial','bionic','cosmic','disco', + case $facts['lsbdistcodename'] { + 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { package {$python3_venv_package: before => File[$venv_dir], @@ -56,7 +56,7 @@ } # pyvenv is deprecated since 3.6 and will be removed in 3.8 - if (versioncmp($::python3_version, '3.6') >=0) { + if (versioncmp($facts['python3_version'], '3.6') >=0) { $virtualenv_cmd = "${python::exec_prefix}python${python_version} -m venv" } else { $virtualenv_cmd = "${python::exec_prefix}pyvenv-${python_version}" diff --git a/spec/default_module_facts.yml b/spec/default_module_facts.yml new file mode 100644 index 00000000..3f8d54e2 --- /dev/null +++ b/spec/default_module_facts.yml @@ -0,0 +1,3 @@ +--- +python_version: "2.7" +python3_version: ~ diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 285a0de5..6e8a1849 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -4,7 +4,10 @@ on_supported_os.each do |os, facts| context("on #{os} ") do let :facts do - facts + # python3 is required to use pyvenv + facts.merge( + python3_version: '3.4' + ) end let :title do '/opt/env' @@ -12,7 +15,7 @@ it { is_expected.to contain_file('/opt/env') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv --clear /opt/env') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.4 --clear /opt/env') } describe 'when ensure' do @@ -28,6 +31,6 @@ } end end - end + end # context end end From 5ea5621905a55008696b76aa2d681d93bae66079 Mon Sep 17 00:00:00 2001 From: Kristin Kuche Date: Tue, 5 Feb 2019 10:38:11 +0100 Subject: [PATCH 125/380] Use ensure_packages to create two or more venvs without duplicate declaration error --- manifests/pyvenv.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index eed7f4c4..51524722 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -47,9 +47,9 @@ case $facts['lsbdistcodename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { - package {$python3_venv_package: + ensure_packages ($python3_venv_package, { before => File[$venv_dir], - } + }) } default: {} } From 4fbfc0d5c7de47de37794055c28ca280c4f931bb Mon Sep 17 00:00:00 2001 From: Thai Pham Date: Mon, 25 Feb 2019 17:02:07 +1100 Subject: [PATCH 126/380] Normalize Python version in `python::pyvenv` --- manifests/pyvenv.pp | 9 ++++++--- spec/defines/pyvenv_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 51524722..80142ca8 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -41,9 +41,12 @@ default => $version, } + $python_version_parts = split($python_version, '[.]') + $normalized_python_version = sprintf('%s.%s', $python_version_parts[0], $python_version_parts[1]) + # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian'){ - $python3_venv_package="python${python_version}-venv" + $python3_venv_package="python${normalized_python_version}-venv" case $facts['lsbdistcodename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { @@ -57,9 +60,9 @@ # pyvenv is deprecated since 3.6 and will be removed in 3.8 if (versioncmp($facts['python3_version'], '3.6') >=0) { - $virtualenv_cmd = "${python::exec_prefix}python${python_version} -m venv" + $virtualenv_cmd = "${python::exec_prefix}python${normalized_python_version} -m venv" } else { - $virtualenv_cmd = "${python::exec_prefix}pyvenv-${python_version}" + $virtualenv_cmd = "${python::exec_prefix}pyvenv-${normalized_python_version}" } $_path = $::python::provider ? { diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 6e8a1849..aa66aac5 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -6,7 +6,7 @@ let :facts do # python3 is required to use pyvenv facts.merge( - python3_version: '3.4' + python3_version: '3.5.1' ) end let :title do @@ -15,7 +15,7 @@ it { is_expected.to contain_file('/opt/env') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.4 --clear /opt/env') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env') } describe 'when ensure' do From 2f4f671b94d9d1ea484e5c153cd98c927e2e5e7e Mon Sep 17 00:00:00 2001 From: Thai Pham Date: Tue, 26 Feb 2019 14:57:22 +1100 Subject: [PATCH 127/380] More fixes and tests --- manifests/install.pp | 34 ++++++++++++++++++++++------------ manifests/pip.pp | 2 +- spec/classes/python_spec.rb | 4 ++-- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index b6911259..04cb7081 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,7 +10,7 @@ $python = $python_version ? { 'system' => 'python', 'pypy' => 'pypy', - /\A(python)?([0-9](\.?[0-9])+)/ => "python${1}", + /\A(python)?([0-9](\.?[0-9])+)/ => "python${2}", default => "python${python::version}", } @@ -74,19 +74,29 @@ } } - # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - include 'python::pip::bootstrap' + # Respect the $pip_ensure setting + unless $pip_ensure == 'absent' { + # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. + include 'python::pip::bootstrap' - Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> + Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> - Package <| title == 'pip' |> { - name => 'pip', - provider => 'pip', - } - Package <| title == 'virtualenv' |> { - name => 'virtualenv', - provider => 'pip', - require => Package[$pythondev], + Package <| title == 'pip' |> { + name => 'pip', + provider => 'pip', + } + if $pythondev { + Package <| title == 'virtualenv' |> { + name => 'virtualenv', + provider => 'pip', + require => Package['python-dev'], + } + } else { + Package <| title == 'virtualenv' |> { + name => 'virtualenv', + provider => 'pip', + } + } } } 'scl': { diff --git a/manifests/pip.pp b/manifests/pip.pp index 2171f0dc..56413f74 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -244,7 +244,7 @@ # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join(["${pip_env} install ${proxy_flag} ${pkgname}==notreallyaversion 2>&1", + $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${pkgname}==notreallyaversion 2>&1", ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', ' | tr -d "[:space:]"']) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d5ee2771..8deac5a0 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -61,7 +61,7 @@ describe 'with python::provider' do context 'pip' do - let(:params) { { provider: 'pip' } } + let(:params) { { pip: 'present', provider: 'pip' } } it { is_expected.to contain_package('virtualenv').with( @@ -384,7 +384,7 @@ describe 'with python::provider' do context 'pip' do - let(:params) { { provider: 'pip' } } + let(:params) { { pip: 'present', provider: 'pip' } } it { is_expected.to contain_package('virtualenv').with( From caad10ba0ed4e00e6efc3b274ea23c46d60bcdd6 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Fri, 22 Feb 2019 12:14:56 +0000 Subject: [PATCH 128/380] Add manage_scl boolean to control managing SCL --- manifests/init.pp | 4 +++- manifests/install.pp | 34 ++++++++++++++++++++-------------- manifests/params.pp | 1 + spec/classes/python_spec.rb | 17 +++++++++++++++++ 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e267ce16..a62975b5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,6 +16,7 @@ # @param manage_gunicorn Allow Installation / Removal of Gunicorn. # @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. # # @example install python from system python # class { 'python': @@ -25,7 +26,7 @@ # virtualenv => 'present', # gunicorn => 'present', # } -# @example install python3 from scl report +# @example install python3 from scl repo # class { 'python' : # ensure => 'present', # version => 'rh-python36-python', @@ -53,6 +54,7 @@ $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, 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, ) inherits python::params { $exec_prefix = $provider ? { diff --git a/manifests/install.pp b/manifests/install.pp index b6911259..50990f01 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -93,18 +93,26 @@ # SCL is only valid in the RedHat family. If RHEL, package must be # enabled using the subscription manager outside of puppet. If CentOS, # the centos-release-SCL will install the repository. - $install_scl_repo_package = $::operatingsystem ? { - 'CentOS' => 'present', - default => 'absent', - } + if $python::manage_scl { + $install_scl_repo_package = $facts['os']['name'] ? { + 'CentOS' => 'present', + default => 'absent', + } - package { 'centos-release-scl': - ensure => $install_scl_repo_package, - before => Package['scl-utils'], - } - package { 'scl-utils': - ensure => 'latest', - before => Package['python'], + package { 'centos-release-scl': + ensure => $install_scl_repo_package, + before => Package['scl-utils'], + } + package { 'scl-utils': + ensure => 'present', + before => Package['python'], + } + + Package['scl-utils'] -> Package["${python}-scldevel"] + + if $pip_ensure != 'absent' { + Package['scl-utils'] -> Exec['python-scl-pip-install'] + } } # This gets installed as a dependency anyway @@ -113,15 +121,13 @@ # require => Package['scl-utils'], # } package { "${python}-scldevel": - ensure => $dev_ensure, - require => Package['scl-utils'], + ensure => $dev_ensure, } if $pip_ensure != 'absent' { exec { 'python-scl-pip-install': command => "${python::exec_prefix}easy_install pip", path => ['/usr/bin', '/bin'], creates => "/opt/rh/${python::version}/root/usr/bin/pip", - require => Package['scl-utils'], } } } diff --git a/manifests/params.pp b/manifests/params.pp index d7bfdaa2..6aa9f996 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -13,6 +13,7 @@ $manage_gunicorn = true $provider = undef $valid_versions = undef + $manage_scl = true if $::osfamily == 'RedHat' { if $::operatingsystem != 'Fedora' { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d5ee2771..547feb29 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -204,6 +204,23 @@ } end + context 'scl' do + describe 'with manage_scl' do + context 'true' do + let(:params) { { provider: 'scl', manage_scl: true } } + + it { is_expected.to contain_package('centos-release-scl') } + it { is_expected.to contain_package('scl-utils') } + end + context 'false' do + let(:params) { { provider: 'scl', manage_scl: false } } + + it { is_expected.not_to contain_package('centos-release-scl') } + it { is_expected.not_to contain_package('scl-utils') } + end + end + end + # python::provider context 'default' do let(:params) { { provider: '' } } From c53df84d2d235482338393ac2d726b94fb43ba6f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 00:46:06 +0100 Subject: [PATCH 129/380] modulesync 2.5.1 --- .github/CONTRIBUTING.md | 6 +-- .github/PULL_REQUEST_TEMPLATE.md | 10 ++-- .msync.yml | 2 +- .travis.yml | 86 +++++++++----------------------- Gemfile | 17 +++---- Rakefile | 20 +++++++- spec/default_facts.yml | 13 ----- spec/spec_helper.rb | 14 ++++-- 8 files changed, 68 insertions(+), 100 deletions(-) delete mode 100644 spec/default_facts.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4a519698..5d047472 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -51,19 +51,19 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development --without system_tests --without release +bundle install --path .vendor/ --without development system_tests release ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release +bundle install --path .vendor/ --with system_tests --without development release ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --without development --with system_tests --without release; bundle update; bundle clean +bundle install --path .vendor/ --with system_tests --without development release; bundle update; bundle clean ``` ## Syntax and style diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ef25cdbf..342807bc 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -8,13 +8,13 @@ Thank you for contributing to this project! --> #### Pull Request (PR) description #### This Pull Request (PR) fixes the following issues diff --git a/.msync.yml b/.msync.yml index 648cf244..4c6463a5 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.3.1' +modulesync_config_version: '2.5.1' diff --git a/.travis.yml b/.travis.yml index 06169e38..a9f30f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,138 +1,100 @@ --- -sudo: false -dist: trusty +dist: xenial language: ruby cache: bundler before_install: - - rm -f Gemfile.lock + - gem update --system + - gem update bundler + - bundle --version script: - 'bundle exec rake $CHECK' matrix: fast_finish: true include: - - rvm: 2.1.9 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12 - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required - - rvm: 2.5.1 + - rvm: 2.5.3 bundler_args: --without development release - dist: trusty env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - sudo: required branches: only: - master diff --git a/Gemfile b/Gemfile index 9648d7de..6a74c57b 100644 --- a/Gemfile +++ b/Gemfile @@ -20,16 +20,15 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'puppet-lint-absolute_classname-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' - gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop', '~> 0.49.1', :require => false + gem 'rubocop-rspec', '~> 1.15.0', :require => false gem 'mocha', '~> 1.4.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' - gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0' - gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0' + gem 'parallel_tests', :require => false end group :development do @@ -57,13 +56,13 @@ group :system_tests do gem 'beaker-puppet', :require => false gem 'beaker-puppet_install_helper', :require => false gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6' - gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6' + gem 'rbnacl', '>= 4', :require => false + gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' gem 'puppet-strings', '>= 1.0', :require => false @@ -77,7 +76,7 @@ else gem 'facter', :require => false, :groups => [:test] end -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 279580ac..a6cf0acc 100644 --- a/Rakefile +++ b/Rakefile @@ -11,6 +11,7 @@ end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.absolute_classname_reverse = true PuppetLint.configuration.send('relative') PuppetLint.configuration.send('disable_140chars') PuppetLint.configuration.send('disable_class_inherits_from_params_class') @@ -37,12 +38,27 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests metadata_lint, release_checks' +desc 'Run tests release_checks' task test: [ - :metadata_lint, :release_checks, ] +namespace :check do + desc 'Check for trailing whitespace' + task :trailing_whitespace do + Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| + next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} + File.foreach(filename).each_with_index do |line, index| + if line =~ %r{\s\n$} + puts "#{filename} has trailing whitespace on line #{index + 1}" + exit 1 + end + end + end + end +end +Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] + desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index 2f6698d5..00000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,13 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# use default_module_facts.yaml for module specific -# facts. -# -# Hint if using with rspec-puppet-facts ("on_supported_os.each"): -# if a same named fact exists in facterdb it will be overridden. ---- -ipaddress: "172.16.254.254" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 88bca595..2f2279d2 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,15 @@ require 'rspec-puppet-facts' include RspecPuppetFacts +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + if facts + facts.each do |name, value| + add_custom_fact name.to_sym, value + end + end +end + if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'coveralls' require 'simplecov' @@ -22,11 +31,6 @@ end RSpec.configure do |c| - default_facts = {} - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__)) - default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__)) - c.default_facts = default_facts - # Coverage generation c.after(:suite) do RSpec::Puppet::Coverage.report! From caa53c0acdfee93ce9d4ec5da5e9d3168efcdfd3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 00:48:03 +0100 Subject: [PATCH 130/380] drop puppet 4 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index dbf0c3a4..53705035 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 5.5.8 < 7.0.0" } ], "dependencies": [ From 1c174171cb56cfcc9cf69f7a346fbf1896060299 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 3 Mar 2019 22:19:44 +0100 Subject: [PATCH 131/380] puppet-lint: fix relative_classname_inclusion --- manifests/pip/bootstrap.pp | 2 +- manifests/pyvenv.pp | 2 +- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index ea3e70b7..10b3c348 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -13,7 +13,7 @@ Variant[Boolean, String] $manage_python = false, ) inherits ::python::params { if $manage_python { - include ::python + include python } else { $target_src_pip_path = $facts['os']['family'] ? { 'AIX' => '/opt/freeware/bin', diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 80142ca8..579f7b11 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -33,7 +33,7 @@ $environment = [], ) { - include ::python + include python if $ensure == 'present' { $python_version = $version ? { diff --git a/manifests/requirements.pp b/manifests/requirements.pp index d592ebfe..7d2a54a9 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -43,7 +43,7 @@ $timeout = 1800, ) { - include ::python + include python if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { fail('python::pip: root user must be used when virtualenv is system') diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 23c3a7d7..48885c56 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -51,7 +51,7 @@ $extra_pip_args = '', $virtualenv = undef ) { - include ::python + include python $python_provider = getparam(Class['python'], 'provider') $anaconda_path = getparam(Class['python'], 'anaconda_install_path') From 7eae51bd3447c9db9317ea081ef31db2180dd610 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Wed, 3 Apr 2019 14:01:30 +0100 Subject: [PATCH 132/380] Update version validation Fixes #471 --- manifests/init.pp | 4 ++-- manifests/install.pp | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a62975b5..d3c276fc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,7 +29,7 @@ # @example install python3 from scl repo # class { 'python' : # ensure => 'present', -# version => 'rh-python36-python', +# version => 'rh-python36', # dev => 'present', # virtualenv => 'present', # } @@ -64,7 +64,7 @@ } unless $version =~ Pattern[/\A(python)?[0-9](\.[0-9])+/, - /\Apypy\Z/, /\Asystem\Z/] { + /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}\Z/] { fail("version needs to be pypy, system or a version string like '3.5' or 'python3.5)") } diff --git a/manifests/install.pp b/manifests/install.pp index 22ae9e4a..63c88079 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -8,10 +8,11 @@ $python_version = getparam(Class['python'], 'version') $python = $python_version ? { - 'system' => 'python', - 'pypy' => 'pypy', + 'system' => 'python', + 'pypy' => 'pypy', /\A(python)?([0-9](\.?[0-9])+)/ => "python${2}", - default => "python${python::version}", + /\Arh-python[0-9]{2}/ => $python_version, + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? { From 6045313a9cec4bba5683b52a56a5b8792016e2a0 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Mon, 8 Apr 2019 10:42:47 +0100 Subject: [PATCH 133/380] Add tests for setting SCL package version Move SCL checks to the EL6/7 contexts as EL5 is neither tested against nor does it support SCL repositories. --- spec/classes/python_spec.rb | 72 +++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index ab5b549d..f3ca5a34 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -129,7 +129,7 @@ end end end - when 'RedHat' + when 'RedHat', 'CentOS' case facts[:os]['release']['major'] when '5' # written for RHEL 5 @@ -204,23 +204,6 @@ } end - context 'scl' do - describe 'with manage_scl' do - context 'true' do - let(:params) { { provider: 'scl', manage_scl: true } } - - it { is_expected.to contain_package('centos-release-scl') } - it { is_expected.to contain_package('scl-utils') } - end - context 'false' do - let(:params) { { provider: 'scl', manage_scl: false } } - - it { is_expected.not_to contain_package('centos-release-scl') } - it { is_expected.not_to contain_package('scl-utils') } - end - end - end - # python::provider context 'default' do let(:params) { { provider: '' } } @@ -262,12 +245,65 @@ context 'on a Redhat 6 OS' do it { is_expected.to contain_class('python::install') } it { is_expected.to contain_package('pip').with_name('python-pip') } + + describe 'with python::provider' do + context 'scl' do + describe 'with version' do + context '3.6 SCL package' do + let(:params) { { version: 'rh-python36' } } + + it { is_expected.to compile } + end + end + describe 'with manage_scl' do + context 'true' do + let(:params) { { provider: 'scl', manage_scl: true } } + + it { is_expected.to contain_package('centos-release-scl') } + it { is_expected.to contain_package('scl-utils') } + end + context 'false' do + let(:params) { { provider: 'scl', manage_scl: false } } + + it { is_expected.not_to contain_package('centos-release-scl') } + it { is_expected.not_to contain_package('scl-utils') } + end + end + end + end end + when '7' context 'on a Redhat 7 OS' do it { is_expected.to contain_class('python::install') } it { is_expected.to contain_package('pip').with_name('python2-pip') } + + describe 'with python::provider' do + context 'scl' do + describe 'with version' do + context '3.6 SCL package' do + let(:params) { { version: 'rh-python36' } } + + it { is_expected.to compile } + end + end + describe 'with manage_scl' do + context 'true' do + let(:params) { { provider: 'scl', manage_scl: true } } + + it { is_expected.to contain_package('centos-release-scl') } + it { is_expected.to contain_package('scl-utils') } + end + context 'false' do + let(:params) { { provider: 'scl', manage_scl: false } } + + it { is_expected.not_to contain_package('centos-release-scl') } + it { is_expected.not_to contain_package('scl-utils') } + end + end + end + end end end end From b83aa36de75a333180df9504a6d5e5a3f380d4f9 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Tue, 9 Apr 2019 09:58:16 +0100 Subject: [PATCH 134/380] Be more specific with compilation tests --- spec/classes/python_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index f3ca5a34..ac0e3ca9 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -252,7 +252,7 @@ context '3.6 SCL package' do let(:params) { { version: 'rh-python36' } } - it { is_expected.to compile } + it { is_expected.to compile.with_all_deps } end end describe 'with manage_scl' do @@ -285,7 +285,7 @@ context '3.6 SCL package' do let(:params) { { version: 'rh-python36' } } - it { is_expected.to compile } + it { is_expected.to compile.with_all_deps } end end describe 'with manage_scl' do From 5f6f76f14886f50434f5612012f0a12b810b5dc0 Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Tue, 9 Apr 2019 11:28:49 +0100 Subject: [PATCH 135/380] Allow rh-python36-python as a version --- manifests/init.pp | 4 ++-- spec/classes/python_spec.rb | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d3c276fc..8b5ae4b6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -29,7 +29,7 @@ # @example install python3 from scl repo # class { 'python' : # ensure => 'present', -# version => 'rh-python36', +# version => 'rh-python36-python', # dev => 'present', # virtualenv => 'present', # } @@ -64,7 +64,7 @@ } unless $version =~ Pattern[/\A(python)?[0-9](\.[0-9])+/, - /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}\Z/] { + /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { fail("version needs to be pypy, system or a version string like '3.5' or 'python3.5)") } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index ac0e3ca9..208462ca 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -249,9 +249,14 @@ describe 'with python::provider' do context 'scl' do describe 'with version' do - context '3.6 SCL package' do + context '3.6 SCL meta package' do let(:params) { { version: 'rh-python36' } } + it { is_expected.to compile.with_all_deps } + end + context '3.6 SCL python package' do + let(:params) { { version: 'rh-python36-python' } } + it { is_expected.to compile.with_all_deps } end end @@ -282,9 +287,14 @@ describe 'with python::provider' do context 'scl' do describe 'with version' do - context '3.6 SCL package' do + context '3.6 SCL meta package' do let(:params) { { version: 'rh-python36' } } + it { is_expected.to compile.with_all_deps } + end + context '3.6 SCL python package' do + let(:params) { { version: 'rh-python36-python' } } + it { is_expected.to compile.with_all_deps } end end From 4d65c1c9a0ae0049ce05b29f98dfdbd366669b4f Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Wed, 10 Apr 2019 11:43:41 +0100 Subject: [PATCH 136/380] Use normalized version number with versioncmp() Allows the python3_version fact to be bypassed fully. --- manifests/pyvenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 579f7b11..59b582ed 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -59,7 +59,7 @@ } # pyvenv is deprecated since 3.6 and will be removed in 3.8 - if (versioncmp($facts['python3_version'], '3.6') >=0) { + if (versioncmp($normalized_python_version, '3.6') >=0) { $virtualenv_cmd = "${python::exec_prefix}python${normalized_python_version} -m venv" } else { $virtualenv_cmd = "${python::exec_prefix}pyvenv-${normalized_python_version}" From 3644bd9871a09a7d7b3a3cc5c9649bf9952f3bc0 Mon Sep 17 00:00:00 2001 From: Geromy Harper Date: Wed, 24 Apr 2019 14:10:07 -0700 Subject: [PATCH 137/380] Update pip url regex to support 'git+git://' --- manifests/pip.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 56413f74..741f7a35 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -158,7 +158,7 @@ $source = $url ? { false => "${pkgname}${extras_string}", /^(\/|[a-zA-Z]\:)/ => $url, - /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ => $url, + /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ => $url, default => "${url}#egg=${egg_name}", } @@ -181,7 +181,7 @@ $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided - if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ { + if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ { if $ensure != present and $ensure != latest { exec { "pip_install_${name}": command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", From 5a3fa33b3debd1cfe6e8c7637c526038b4f2ac41 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Tue, 7 May 2019 03:56:43 -0700 Subject: [PATCH 138/380] Allow arbitrary pip providers --- REFERENCE.md | 15 ++++++++++++++- manifests/pip.pp | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 8ba1fa5f..adf7cd9b 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -529,6 +529,19 @@ 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. @@ -563,7 +576,7 @@ Default value: 'system' ##### `pip_provider` -Data type: `Enum['pip', 'pip3']` +Data type: `String[1]` version of pip you wish to use. diff --git a/manifests/pip.pp b/manifests/pip.pp index 56413f74..bfc269a7 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -51,7 +51,7 @@ String $pkgname = $name, Variant[Enum[present, absent, latest], String[1]] $ensure = present, Variant[Enum['system'], Stdlib::Absolutepath] $virtualenv = 'system', - Enum['pip', 'pip3'] $pip_provider = 'pip', + String[1] $pip_provider = 'pip', Variant[Boolean, String] $url = false, String[1] $owner = 'root', $group = getvar('python::params::group'), From c3bb6b37e7711f816faba3ea8fb98b72286830e1 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 21 May 2019 11:13:48 -0700 Subject: [PATCH 139/380] Modern pip can install wheels without wheel installed --- manifests/pip.pp | 25 +++++-------------------- spec/defines/pip_spec.rb | 8 ++++---- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index bfc269a7..86c28d4c 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -162,21 +162,6 @@ default => "${url}#egg=${egg_name}", } - # We need to jump through hoops to make sure we issue the correct pip command - # depending on wheel support and versions. - # - # Pip does not support wheels prior to version 1.4.0 - # Pip wheels require setuptools/distribute > 0.8 - # Python 2.6 and older does not support setuptools/distribute > 0.8 - # Pip >= 1.5 tries to use wheels by default, even if wheel package is not - # installed, in this case the --no-use-wheel flag needs to be passed - # Versions prior to 1.5 don't support the --no-use-wheel flag - # - # To check for this we test for wheel parameter using help and then using - # show, this makes sure we only use wheels if they are supported and - # installed - $wheel_check = "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; }" - $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" @@ -184,7 +169,7 @@ if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp)(:\/\/).+$/ { if $ensure != present and $ensure != latest { exec { "pip_install_${name}": - command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}@${ensure}#egg=${egg_name} || ${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name} ;}", + command => "${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -196,7 +181,7 @@ } } else { exec { "pip_install_${name}": - command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${install_args} ${pip_common_args} ;}", + command => "${pip_install} ${install_args} ${pip_common_args}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -213,7 +198,7 @@ # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. exec { "pip_install_${name}": - command => "${wheel_check} ; { ${pip_install} ${install_args} \$wheel_support_flag ${pip_common_args}==${ensure} || ${pip_install} ${install_args} ${pip_common_args}==${ensure} ;}", + command => "${pip_install} ${install_args} ${pip_common_args}==${ensure}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -228,7 +213,7 @@ 'present': { # Whatever version is available. exec { "pip_install_${name}": - command => "${wheel_check} ; { ${pip_install} \$wheel_support_flag ${pip_common_args} || ${pip_install} ${pip_common_args} ;}", + command => "${pip_install} ${pip_common_args}", unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", user => $owner, group => $group, @@ -259,7 +244,7 @@ # Latest version. exec { "pip_install_${name}": - command => "${wheel_check} ; { ${pip_install} --upgrade \$wheel_support_flag ${pip_common_args} || ${pip_install} --upgrade ${pip_common_args} ;}", + command => "${pip_install} --upgrade ${pip_common_args}", unless => $unless_command, user => $owner, group => $group, diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 1548b7b6..345de99b 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -67,7 +67,7 @@ context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --proxy=http://my.proxy:3128 rpyc || pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } end end @@ -80,7 +80,7 @@ context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag --index-url=http://www.example.com/simple/ rpyc || pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc ;}") } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } end end @@ -133,12 +133,12 @@ context 'suceeds with no extras' do let(:params) { {} } - it { is_expected.to contain_exec('pip_install_requests').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests || pip --log /tmp/pip.log install requests ;}") } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests') } end context 'succeeds with extras' do let(:params) { { extras: ['security'] } } - it { is_expected.to contain_exec('pip_install_requests').with_command("pip wheel --help > /dev/null 2>&1 && { pip show wheel > /dev/null 2>&1 || wheel_support_flag='--no-binary :all:'; } ; { pip --log /tmp/pip.log install $wheel_support_flag requests[security] || pip --log /tmp/pip.log install requests[security] ;}") } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests[security]') } end end end From 035056628bc31b30970f5a8582f5fc5fda99aaab Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Wed, 22 May 2019 12:31:04 +0000 Subject: [PATCH 140/380] 486 Set permissive umask. --- REFERENCE.md | 82 ++++++++++++++++++++++++++++++++++------------- manifests/init.pp | 7 ++++ 2 files changed, 66 insertions(+), 23 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index adf7cd9b..e526dc66 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -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_ @@ -44,7 +45,7 @@ class { 'python': } ``` -##### install python3 from scl report +##### install python3 from scl repo ```puppet class { 'python' : @@ -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` @@ -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 @@ -256,7 +307,7 @@ Default value: 'present' ##### `filename` -Data type: `Stdlib::Filemode` +Data type: `String[1]` Filename. @@ -264,7 +315,7 @@ Default value: $title ##### `mode` -Data type: `String[1]` +Data type: `Stdlib::Filemode` File mode. @@ -365,12 +416,10 @@ Default value: 'wsgi' ##### `dir` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Application directory. -Default value: `false` - ##### `bind` Data type: `Any` @@ -479,7 +528,7 @@ Default value: `false` ##### `log_level` -Data type: `Any` +Data type: `Enum['debug', 'info', 'warning', 'error', 'critical']` @@ -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. @@ -568,7 +604,7 @@ Default value: present ##### `virtualenv` -Data type: `String` +Data type: `Variant[Enum['system'], Stdlib::Absolutepath]` virtualenv to run pip in. @@ -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` diff --git a/manifests/init.pp b/manifests/init.pp index 8b5ae4b6..0a8b16c3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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': @@ -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 ? { @@ -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) From 745308b4045f73cb17da5122d355c9011bd65924 Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Wed, 22 May 2019 12:12:11 +0000 Subject: [PATCH 141/380] Bump stdlib to 4.19 where the fact() function was introduced. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 53705035..9f76d497 100644 --- a/metadata.json +++ b/metadata.json @@ -63,7 +63,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.13.1 < 6.0.0" + "version_requirement": ">= 4.19.0 < 7.0.0" }, { "name": "stahnma/epel", From 7de58f426a5cb43b300fe76e788215b7c5988e70 Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Wed, 22 May 2019 13:09:01 +0000 Subject: [PATCH 142/380] Allow HTTP_PROXY on bootstrap and also fix #473 --- REFERENCE.md | 22 +++++++++++----- manifests/pip.pp | 4 +-- manifests/pip/bootstrap.pp | 49 ++++++++++++++++++++++------------- manifests/requirements.pp | 6 ++--- manifests/virtualenv.pp | 51 ++++++++++++++++++++----------------- spec/classes/python_spec.rb | 30 ++++++++++++++++++++++ 6 files changed, 108 insertions(+), 54 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index e526dc66..69e58da4 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -269,6 +269,14 @@ if python module will manage deps Default value: `false` +##### `http_proxy` + +Data type: `Optional[Stdlib::HTTPUrl]` + +Proxy server to use for outbound connections. + +Default value: `undef` + ## Defined types ### python::dotfile @@ -652,11 +660,11 @@ Default value: `false` ##### `proxy` -Data type: `Variant[Boolean, String]` +Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: `false` +Default value: `undef` ##### `editable` @@ -896,11 +904,11 @@ Default value: 'root' ##### `proxy` -Data type: `Any` +Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: `false` +Default value: `undef` ##### `src` @@ -1003,7 +1011,7 @@ Data type: `Any` -Default value: present +Default value: 'present' ##### `version` @@ -1087,11 +1095,11 @@ Default value: '0755' ##### `proxy` -Data type: `Any` +Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections -Default value: `false` +Default value: `undef` ##### `environment` diff --git a/manifests/pip.pp b/manifests/pip.pp index b3f49a8a..569d62f9 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -57,7 +57,7 @@ $group = getvar('python::params::group'), $umask = undef, $index = false, - Variant[Boolean, String] $proxy = false, + Optional[Stdlib::HTTPUrl] $proxy = undef, $egg = false, Boolean $editable = false, $environment = [], @@ -115,7 +115,7 @@ } $proxy_flag = $proxy ? { - false => '', + undef => '', default => "--proxy=${proxy}", } diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index 10b3c348..f5b18c02 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -3,6 +3,7 @@ # # @param version should be pip or pip3 # @param manage_python if python module will manage deps +# @param http_proxy Proxy server to use for outbound connections. # # @example # class { 'python::pip::bootstrap': @@ -11,6 +12,7 @@ class python::pip::bootstrap ( Enum['pip', 'pip3'] $version = 'pip', Variant[Boolean, String] $manage_python = false, + Optional[Stdlib::HTTPUrl] $http_proxy = undef, ) inherits ::python::params { if $manage_python { include python @@ -19,34 +21,45 @@ 'AIX' => '/opt/freeware/bin', default => '/usr/bin' } + + $environ = $http_proxy ? { + undef => [], + default => $facts['os']['family'] ? { + 'AIX' => [ "http_proxy=${http_proxy}", "https_proxy=${http_proxy}" ], + default => [ "HTTP_PROXY=${http_proxy}", "HTTPS_PROXY=${http_proxy}" ], + } + } + if $version == 'pip3' { exec { 'bootstrap pip3': - command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python3', - unless => 'which pip3', - path => $python::params::pip_lookup_path, - require => Package['python3'], + command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python3', + environment => $environ, + unless => 'which pip3', + path => $python::params::pip_lookup_path, + require => Package['python3'], } # puppet is opinionated about the pip command name file { 'pip3-python': ensure => link, path => '/usr/bin/pip3', - target => "${target_src_pip_path}/pip${::facts['python3_release']}", + target => "${target_src_pip_path}/pip${facts['python3_release']}", require => Exec['bootstrap pip3'], } } else { - exec { 'bootstrap pip': - command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python', - unless => 'which pip', - path => $python::params::pip_lookup_path, - require => Package['python'], - } - # puppet is opinionated about the pip command name - file { 'pip-python': - ensure => link, - path => '/usr/bin/pip', - target => "${target_src_pip_path}/pip${::facts['python2_release']}", - require => Exec['bootstrap pip'], - } + exec { 'bootstrap pip': + command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python', + environment => $environ, + unless => 'which pip', + path => $python::params::pip_lookup_path, + require => Package['python'], + } + # puppet is opinionated about the pip command name + file { 'pip-python': + ensure => link, + path => '/usr/bin/pip', + target => "${target_src_pip_path}/pip${facts['python2_release']}", + require => Exec['bootstrap pip'], + } } } } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 7d2a54a9..8afe8568 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -31,7 +31,7 @@ Enum['pip', 'pip3'] $pip_provider = 'pip', $owner = 'root', $group = 'root', - $proxy = false, + Optional[Stdlib::HTTPUrl] $proxy = undef, $src = false, $environment = [], $forceupdate = false, @@ -68,8 +68,8 @@ } $proxy_flag = $proxy ? { - false => '', - default => "--proxy=${proxy}", + undef => '', + default => "--proxy=${proxy}", } $src_flag = $src ? { diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 48885c56..ebc22498 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -31,25 +31,25 @@ # } # define python::virtualenv ( - $ensure = present, - $version = 'system', - $requirements = false, - $systempkgs = false, - $venv_dir = $name, - $ensure_venv_dir = true, - $distribute = true, - $index = false, - $owner = 'root', - $group = 'root', - $mode = '0755', - $proxy = false, - $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], - $cwd = undef, - $timeout = 1800, - $pip_args = '', - $extra_pip_args = '', - $virtualenv = undef + $ensure = 'present', + $version = 'system', + $requirements = false, + $systempkgs = false, + $venv_dir = $name, + $ensure_venv_dir = true, + $distribute = true, + $index = false, + $owner = 'root', + $group = 'root', + $mode = '0755', + Optional[Stdlib::HTTPUrl] $proxy = undef, + $environment = [], + $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], + $cwd = undef, + $timeout = 1800, + $pip_args = '', + $extra_pip_args = '', + $virtualenv = undef, ) { include python $python_provider = getparam(Class['python'], 'provider') @@ -78,9 +78,12 @@ default => "--proxy=${proxy}", } - $proxy_command = $proxy ? { - false => '', - default => "&& export http_proxy=${proxy}", + $proxy_hash = $proxy ? { + undef => {}, + default => $facts['os']['family'] ? { + 'AIX' => { 'http_proxy' => $proxy, 'https_proxy' => $proxy }, + default => { 'HTTP_PROXY' => $proxy, 'HTTPS_PROXY' => $proxy }, + } } # Virtualenv versions prior to 1.7 do not support the @@ -134,12 +137,12 @@ $pip_flags = "${pypi_index} ${proxy_flag} ${pip_args}" exec { "python_virtualenv_${venv_dir}": - command => "true ${proxy_command} && ${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", + command => "${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", path => $_path, cwd => '/tmp', - environment => $environment, + environment => (Hash($environment.map |$val| { $val.split(/=|$/) }) + $proxy_hash).map|$key, $val| { "${key}=${val}" }, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv require => File[$venv_dir], } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 208462ca..76d62c41 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -42,6 +42,36 @@ end end + describe 'with python::python_virtualenvs' do + context 'when `proxy` set' do + let(:params) do + { + python_virtualenvs: { + '/opt/env1' => { + proxy: 'http://example.com:3128' + } + } + } + end + + it { is_expected.to contain_exec('python_virtualenv_/opt/env1').with_environment(['HTTP_PROXY=http://example.com:3128', 'HTTPS_PROXY=http://example.com:3128']) } + end + context 'when `proxy` and `environment` have conflicting parameters' do + let(:params) do + { + python_virtualenvs: { + '/opt/env1' => { + proxy: 'http://example.com:3128', + environment: ['HTTP_PROXY=http://example.com:8080'] + } + } + } + end + + it { is_expected.to contain_exec('python_virtualenv_/opt/env1').with_environment(['HTTP_PROXY=http://example.com:3128', 'HTTPS_PROXY=http://example.com:3128']) } + end + end + describe 'with manage_gunicorn' do context 'true' do let(:params) { { manage_gunicorn: true } } From b88ea1947aafb9d8333d07a6927586baea51fb40 Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Thu, 23 May 2019 13:02:44 +0000 Subject: [PATCH 143/380] Fix version-check. --- manifests/init.pp | 4 ++-- manifests/install.pp | 48 ++++++++++++++++++++++---------------- manifests/pip.pp | 2 +- manifests/pip/bootstrap.pp | 2 +- manifests/pyvenv.pp | 4 ++-- manifests/requirements.pp | 4 ++-- spec/defines/pip_spec.rb | 2 +- 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0a8b16c3..cd3132f5 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -65,9 +65,9 @@ default => '', } - unless $version =~ Pattern[/\A(python)?[0-9](\.[0-9])+/, + unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])+/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { - fail("version needs to be pypy, system or a version string like '3.5' or 'python3.5)") + fail("version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6' )") } # Module compatibility check diff --git a/manifests/install.pp b/manifests/install.pp index 63c88079..70d2f0b6 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,13 +6,12 @@ # class python::install { - $python_version = getparam(Class['python'], 'version') - $python = $python_version ? { - 'system' => 'python', - 'pypy' => 'pypy', - /\A(python)?([0-9](\.?[0-9])+)/ => "python${2}", - /\Arh-python[0-9]{2}/ => $python_version, - default => "python${python::version}", + $python = $python::version ? { + 'system' => 'python', + 'pypy' => 'pypy', + /\A(python)?([0-9]+)/ => "python${2}", + /\Arh-python[0-9]{2}/ => $python::version, + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? { @@ -57,6 +56,7 @@ package { 'virtualenv': ensure => $venv_ensure, + name => "${python}-virtualenv", require => Package['python'], } @@ -144,10 +144,10 @@ } 'rhscl': { # rhscl is RedHat SCLs from softwarecollections.org - if $::python::rhscl_use_public_repository { - $scl_package = "rhscl-${::python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" + if $python::rhscl_use_public_repository { + $scl_package = "rhscl-${python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" package { $scl_package: - source => "https://www.softwarecollections.org/en/scls/rhscl/${::python::version}/epel-${::operatingsystemmajrelease}-${::architecture}/download/${scl_package}.noarch.rpm", + source => "https://www.softwarecollections.org/en/scls/rhscl/${python::version}/epel-${::operatingsystemmajrelease}-${::architecture}/download/${scl_package}.noarch.rpm", provider => 'rpm', tag => 'python-scl-repo', } @@ -171,7 +171,7 @@ tag => 'python-pip-package', } - if $::python::rhscl_use_public_repository { + if $python::rhscl_use_public_repository { Package <| tag == 'python-scl-repo' |> -> Package <| tag == 'python-scl-package' |> } @@ -183,24 +183,24 @@ $installer_path = '/var/tmp/anaconda_installer.sh' file { $installer_path: - source => $::python::anaconda_installer_url, + source => $python::anaconda_installer_url, mode => '0700', } -> exec { 'install_anaconda_python': - command => "${installer_path} -b -p ${::python::anaconda_install_path}", - creates => $::python::anaconda_install_path, + command => "${installer_path} -b -p ${python::anaconda_install_path}", + creates => $python::anaconda_install_path, logoutput => true, } -> exec { 'install_anaconda_virtualenv': - command => "${::python::anaconda_install_path}/bin/pip install virtualenv", - creates => "${::python::anaconda_install_path}/bin/virtualenv", + command => "${python::anaconda_install_path}/bin/pip install virtualenv", + creates => "${python::anaconda_install_path}/bin/virtualenv", } } default: { case $facts['os']['family'] { 'AIX': { - if "${python_version}" =~ /^python3/ { #lint:ignore:only_variable_string - class { 'python::pip::bootstap': + if String($python::version) =~ /^python3/ { + class { 'python::pip::bootstrap': version => 'pip3', } } else { @@ -268,18 +268,22 @@ } } - if "${::python::version}" =~ /^python3/ { #lint:ignore:only_variable_string + if String($python::version) =~ /^python3/ { $pip_category = undef - $pip_package = 'python3-pip' + $pip_package = "${python}-pip" + $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') } elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) { $pip_category = undef $pip_package = 'python2-pip' + $pip_provider = pip2 } elsif $::osfamily == 'Gentoo' { $pip_category = 'dev-python' $pip_package = 'pip' + $pip_provider = 'pip' } else { $pip_category = undef $pip_package = 'python-pip' + $pip_provider = 'pip' } Package <| title == 'pip' |> { @@ -287,6 +291,10 @@ category => $pip_category, } + Python::Pip <| |> { + pip_provider => $pip_provider, + } + Package <| title == 'virtualenv' |> { name => $virtualenv_package, } diff --git a/manifests/pip.pp b/manifests/pip.pp index 569d62f9..1a49c456 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -85,7 +85,7 @@ } $_path = $python_provider ? { - 'anaconda' => concat(["${::python::anaconda_install_path}/bin"], $path), + 'anaconda' => concat(["${python::anaconda_install_path}/bin"], $path), default => $path, } diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index f5b18c02..eff7d568 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -13,7 +13,7 @@ Enum['pip', 'pip3'] $version = 'pip', Variant[Boolean, String] $manage_python = false, Optional[Stdlib::HTTPUrl] $http_proxy = undef, -) inherits ::python::params { +) inherits python::params { if $manage_python { include python } else { diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 59b582ed..7807a6b3 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -65,8 +65,8 @@ $virtualenv_cmd = "${python::exec_prefix}pyvenv-${normalized_python_version}" } - $_path = $::python::provider ? { - 'anaconda' => concat(["${::python::anaconda_install_path}/bin"], $path), + $_path = $python::provider ? { + 'anaconda' => concat(["${python::anaconda_install_path}/bin"], $path), default => $path, } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 8afe8568..d76d71a9 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -63,8 +63,8 @@ } $pip_env = $virtualenv ? { - 'system' => "${::python::exec_prefix} ${pip_provider}", - default => "${::python::exec_prefix} ${virtualenv}/bin/${pip_provider}", + 'system' => "${python::exec_prefix} ${pip_provider}", + default => "${python::exec_prefix} ${virtualenv}/bin/${pip_provider}", } $proxy_flag = $proxy ? { diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 345de99b..68efdd53 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -87,7 +87,7 @@ describe 'path as' do context 'adds anaconda path to pip invocation if provider is anaconda' do let(:params) { {} } - let(:pre_condition) { 'class {"::python": provider => "anaconda", anaconda_install_path => "/opt/python3"}' } + let(:pre_condition) { 'class {"python": provider => "anaconda", anaconda_install_path => "/opt/python3"}' } it { is_expected.to contain_exec('pip_install_rpyc').with_path(['/opt/python3/bin', '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin']) } end From 791ede98b2cd3fb40a2954eaa4758877e53a6e26 Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Mon, 27 May 2019 17:10:28 +0000 Subject: [PATCH 144/380] Add single-quote to pip source. --- manifests/pip.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 1a49c456..06abce8d 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -157,16 +157,16 @@ $source = $url ? { false => "${pkgname}${extras_string}", - /^(\/|[a-zA-Z]\:)/ => $url, - /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ => $url, - default => "${url}#egg=${egg_name}", + /^(\/|[a-zA-Z]\:)/ => "'${url}'", + /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ => "'${url}'", + default => "'${url}#egg=${egg_name}'", } $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided - if $source =~ /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ { + if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { if $ensure != present and $ensure != latest { exec { "pip_install_${name}": command => "${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name}", From 645d247d7895adae23861c1a20b012ab4e90bd5c Mon Sep 17 00:00:00 2001 From: Robert Vincent Date: Wed, 29 May 2019 13:06:19 +0000 Subject: [PATCH 145/380] Add tests. --- spec/classes/python_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 76d62c41..afebca6b 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -314,6 +314,17 @@ it { is_expected.to contain_class('python::install') } it { is_expected.to contain_package('pip').with_name('python2-pip') } + describe 'with python::version' do + context 'python36' do + let(:params) { { version: 'python36' } } + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_package('pip').with_name('python36-pip') } + it { is_expected.to contain_package('python').with_name('python36') } + it { is_expected.to contain_package('python-dev').with_name('python36-devel') } + it { is_expected.to contain_package('virtualenv').with_name('python36-virtualenv') } + end + end describe 'with python::provider' do context 'scl' do describe 'with version' do From 96441ecbf8fa076916f2716fe8e39cf4a886475f Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Thu, 30 May 2019 23:06:31 +1200 Subject: [PATCH 146/380] Fix $subscribe overloading --- manifests/requirements.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index d76d71a9..e1f65878 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -89,9 +89,9 @@ replace => false, content => '# Puppet will install and/or update pip packages listed here', } - $subscribe = File[$requirements] + $local_subscribe = File[$requirements] } else { - $subscribe = undef + $local_subscribe = undef } exec { "python_requirements${name}": @@ -101,7 +101,7 @@ timeout => $timeout, cwd => $cwd, user => $owner, - subscribe => $subscribe, + subscribe => $local_subscribe, environment => $environment, } } From 19f3f3f6af50f3bc5366e5a5e3833288ea24a992 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 9 Jun 2019 17:02:43 +0400 Subject: [PATCH 147/380] Fix python::pip installing $editable VCS packages every puppet run This is due to VCS packages appearing in `pip freeze --all` as: -e git://example.com/package.git@#egg= Updates $grep_regex, which checks whether a given version is installed, to match against the two different output formats of `pip list`. No longer relies on pip freeze. Additionally, this commit: - Removes the multiple exec resources which were mostly the same and replaces with variables $pip_exec_name, $command, and $unless_command, which get used in a single exec resource at the end of the manifest. - Checks if $pkgname contains ==, and if so splits based on == and sets $real_pkgname to the first part, and $_ensure to the second part. Uses of $pkgname have been replaced with $real_pkgname. Fixes #193 --- manifests/pip.pp | 130 ++++++++++++++++++----------------------------- 1 file changed, 49 insertions(+), 81 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 06abce8d..0940f18e 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -135,14 +135,23 @@ fail('python::pip cannot provide uninstall_args with ensure => present') } + if $pkgname =~ /==/ { + $parts = split($pkgname, '==') + $real_pkgname = $parts[0] + $_ensure = $ensure ? { + 'absent' => 'absent', + default => $parts[1], + } + } else { + $real_pkgname = $pkgname + $_ensure = $ensure + } + # Check if searching by explicit version. - if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/ { - $grep_regex = "^${pkgname}==${ensure}\$" + if $_ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/ { + $grep_regex = "^${real_pkgname}[[:space:]]\\+(\\?${_ensure}\\()$\\|$\\|, \\|[[:space:]]\\)" } else { - $grep_regex = $pkgname ? { - /==/ => "^${pkgname}\$", - default => "^${pkgname}==", - } + $grep_regex = "^${real_pkgname}[[:space:]].*$" } $extras_string = empty($extras) ? { @@ -151,12 +160,12 @@ } $egg_name = $egg ? { - false => "${pkgname}${extras_string}", + false => "${real_pkgname}${extras_string}", default => $egg } $source = $url ? { - false => "${pkgname}${extras_string}", + false => "${real_pkgname}${extras_string}", /^(\/|[a-zA-Z]\:)/ => "'${url}'", /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ => "'${url}'", default => "'${url}#egg=${egg_name}'", @@ -165,111 +174,70 @@ $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" + $pip_exec_name = "pip_install_${name}" + # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { - if $ensure != present and $ensure != latest { - exec { "pip_install_${name}": - command => "${pip_install} ${install_args} ${pip_common_args}@${ensure}#egg=${egg_name}", - unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } + if $_ensure != present and $_ensure != latest { + $command = "${pip_install} ${install_args} ${pip_common_args}@${_ensure}#egg=${egg_name}" + $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } else { - exec { "pip_install_${name}": - command => "${pip_install} ${install_args} ${pip_common_args}", - unless => "${pip_env} freeze --all | grep -i -e ${grep_regex}", - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } + $command = "${pip_install} ${install_args} ${pip_common_args}" + $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } } else { - case $ensure { + case $_ensure { /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/: { # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. - exec { "pip_install_${name}": - command => "${pip_install} ${install_args} ${pip_common_args}==${ensure}", - unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } + $command = "${pip_install} ${install_args} ${pip_common_args}==${_ensure}" + $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } -# + 'present': { # Whatever version is available. - exec { "pip_install_${name}": - command => "${pip_install} ${pip_common_args}", - unless => "${pip_env} freeze --all | grep -i -e ${grep_regex} || ${pip_env} list | sed -e 's/[ ]\\+/==/' -e 's/[()]//g' | grep -i -e ${grep_regex}", - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } + $command = "${pip_install} ${pip_common_args}" + $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } 'latest': { # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${pkgname}==notreallyaversion 2>&1", + $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', ' | tr -d "[:space:]"']) # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output - $pkgname_with_dashes = regsubst($pkgname, '_', '-', 'G') + $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" $installed_version = join(["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'"]) + $command = "${pip_install} --upgrade ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" - - # Latest version. - exec { "pip_install_${name}": - command => "${pip_install} --upgrade ${pip_common_args}", - unless => $unless_command, - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } } default: { # Anti-action, uninstall. - exec { "pip_uninstall_${name}": - command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", - onlyif => "${pip_env} freeze --all | grep -i -e ${grep_regex}", - user => $owner, - group => $group, - umask => $umask, - cwd => $cwd, - environment => $environment, - timeout => $timeout, - path => $_path, - } + $pip_exec_name = "pip_uninstall_${name}" + $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" + $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" } } } + + exec { $pip_exec_name: + command => $command, + unless => $unless_command, + user => $owner, + group => $group, + umask => $umask, + cwd => $cwd, + environment => $environment, + timeout => $timeout, + path => $_path, + } + } From 8372013b7684db742b479f6daaac53d171668af0 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Sun, 9 Jun 2019 23:25:50 +0400 Subject: [PATCH 148/380] Acceptance test: works with editable=>true Improve formatting of existing tests --- spec/acceptance/virtualenv_spec.rb | 53 +++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 4e4e4529..5bbb6dbd 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -10,16 +10,14 @@ class { 'python' : pip => 'present', virtualenv => 'present', } - -> - python::virtualenv { 'venv' : + -> python::virtualenv { 'venv' : ensure => 'present', systempkgs => false, venv_dir => '/opt/venv', owner => 'root', group => 'root', } - -> - python::pip { 'rpyc' : + -> python::pip { 'rpyc' : ensure => '3.2.3', virtualenv => '/opt/venv', } @@ -36,16 +34,14 @@ class { 'python' : pip => 'present', virtualenv => 'present', } - -> - python::virtualenv { 'venv' : + -> python::virtualenv { 'venv' : ensure => 'present', systempkgs => false, venv_dir => '/opt/venv2', owner => 'root', group => 'root', } - -> - python::pip { 'pip' : + -> python::pip { 'pip' : ensure => '18.0', virtualenv => '/opt/venv2', } @@ -62,16 +58,14 @@ class { 'python' : pip => 'present', virtualenv => 'present', } - -> - python::virtualenv { 'venv' : + -> python::virtualenv { 'venv' : ensure => 'present', systempkgs => false, venv_dir => '/opt/venv3', owner => 'root', group => 'root', } - -> - python::pip { 'rpyc' : + -> python::pip { 'rpyc' : ensure => 'latest', virtualenv => '/opt/venv3', } @@ -90,16 +84,14 @@ class { 'python' : pip => 'present', virtualenv => 'present', } - -> - python::virtualenv { 'venv' : + -> python::virtualenv { 'venv' : ensure => 'present', systempkgs => false, venv_dir => '/opt/venv4', owner => 'root', group => 'root', } - -> - python::pip { 'Randomized_Requests' : + -> python::pip { 'Randomized_Requests' : ensure => 'latest', virtualenv => '/opt/venv4', } @@ -111,5 +103,34 @@ class { 'python' : # but probability of this happening is minimal, so it should be acceptable. apply_manifest(pp, catch_changes: true) end + it 'works with editable=>true' do + pp = <<-EOS + package{ 'git' : + ensure => 'present', + } + -> class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv5', + owner => 'root', + group => 'root', + } + -> python::pip { 'rpyc' : + ensure => '4.1.0', + url => 'git+https://github.com/tomerfiliba/rpyc.git', + editable => true, + virtualenv => '/opt/venv5', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end end end From 96770aaa5bd899d74c371b0140b8e67fa78e83a2 Mon Sep 17 00:00:00 2001 From: Matt Low Date: Mon, 10 Jun 2019 01:05:50 +0400 Subject: [PATCH 149/380] Acceptance test: works with == in pkgname --- spec/acceptance/virtualenv_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 5bbb6dbd..7c3fba0d 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -27,6 +27,7 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + it 'maintains pip version' do pp = <<-EOS class { 'python' : @@ -51,6 +52,7 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + it 'works with ensure=>latest' do pp = <<-EOS class { 'python' : @@ -77,6 +79,7 @@ class { 'python' : # but probability of this happening is minimal, so it should be acceptable. apply_manifest(pp, catch_changes: true) end + it 'works with ensure=>latest for package with underscore in its name' do pp = <<-EOS class { 'python' : @@ -103,6 +106,7 @@ class { 'python' : # but probability of this happening is minimal, so it should be acceptable. apply_manifest(pp, catch_changes: true) end + it 'works with editable=>true' do pp = <<-EOS package{ 'git' : @@ -132,5 +136,29 @@ class { 'python' : apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + + it 'works with == in pkgname' do + pp = <<-EOS + class { 'python' : + version => 'system', + pip => 'present', + virtualenv => 'present', + } + -> python::virtualenv { 'venv' : + ensure => 'present', + systempkgs => false, + venv_dir => '/opt/venv6', + owner => 'root', + group => 'root', + } + -> python::pip { 'rpyc==4.1.0' : + virtualenv => '/opt/venv6', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end end end From 47e7aeef67c72ce0fb1ab2fc5bf3c873e4024221 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 7 Apr 2019 18:57:50 +0200 Subject: [PATCH 150/380] modulesync 2.7.0 --- .msync.yml | 2 +- .sync.yml | 2 ++ .travis.yml | 24 ------------------------ Dockerfile | 2 +- Gemfile | 4 ++-- Rakefile | 40 +++++++--------------------------------- spec/spec_helper.rb | 4 ++++ 7 files changed, 17 insertions(+), 61 deletions(-) diff --git a/.msync.yml b/.msync.yml index 4c6463a5..55198916 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.5.1' +modulesync_config_version: '2.7.0' diff --git a/.sync.yml b/.sync.yml index b502a785..3aa8e527 100644 --- a/.sync.yml +++ b/.sync.yml @@ -8,3 +8,5 @@ - set: debian8-64 - set: debian9-64 - set: centos7-64 +spec/spec_helper.rb: + mock_with: ':mocha' diff --git a/.travis.yml b/.travis.yml index a9f30f46..f3f66bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -43,10 +39,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -55,10 +47,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -67,10 +55,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -79,10 +63,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker @@ -91,10 +71,6 @@ matrix: bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker branches: only: - master diff --git a/Dockerfile b/Dockerfile index 27a33cf6..67048bb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.1 +FROM ruby:2.5.3 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index 6a74c57b..24dbb7ff 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false + gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false gem 'rspec-puppet-facts', '>= 1.8.0', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false @@ -65,7 +65,7 @@ group :release do gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' - gem 'puppet-strings', '>= 1.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index a6cf0acc..09701d0f 100644 --- a/Rakefile +++ b/Rakefile @@ -3,20 +3,12 @@ require 'puppetlabs_spec_helper/rake_tasks' # load optional tasks for releases # only available if gem group releases is installed begin - require 'puppet_blacksmith/rake_tasks' require 'voxpupuli/release/rake_tasks' - require 'puppet-strings/tasks' rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.absolute_classname_reverse = true -PuppetLint.configuration.send('relative') -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') exclude_paths = %w( pkg/**/* @@ -29,8 +21,7 @@ PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do - PuppetLint.configuration.fix = true - Rake::Task[:lint].invoke + Rake::Task[:lint_fix].invoke end desc 'Run acceptance tests' @@ -38,10 +29,8 @@ RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -desc 'Run tests release_checks' -task test: [ - :release_checks, -] +desc 'Run tests' +task test: [:release_checks] namespace :check do desc 'Check for trailing whitespace' @@ -70,25 +59,10 @@ task test_with_coveralls: [:test] do end end -desc "Print supported beaker sets" -task 'beaker_sets', [:directory] do |t, args| - directory = args[:directory] - - metadata = JSON.load(File.read('metadata.json')) - - (metadata['operatingsystem_support'] || []).each do |os| - (os['operatingsystemrelease'] || []).each do |release| - if directory - beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}" - else - beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64" - end - - filename = "spec/acceptance/nodesets/#{beaker_set}.yml" - - puts beaker_set if File.exists? filename - end - end +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end begin diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 2f2279d2..cbfeb7a6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,10 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config +RSpec.configure do |c| + c.mock_with :mocha +end + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' include RspecPuppetFacts From ba068b1bead50283dfdf003991758701a1d712b7 Mon Sep 17 00:00:00 2001 From: Maurice Meyer Date: Thu, 13 Jun 2019 17:14:43 +0200 Subject: [PATCH 151/380] Release v3.0.0 --- CHANGELOG.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ef5be38..8c5f0757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,68 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v3.0.0](https://github.com/voxpupuli/puppet-python/tree/v3.0.0) (2019-06-13) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.2.2...v3.0.0) + +**Breaking changes:** + +- modulesync 2.5.1 and drop Puppet 4 [\#467](https://github.com/voxpupuli/puppet-python/pull/467) ([bastelfreak](https://github.com/bastelfreak)) + +**Implemented enhancements:** + +- Allow HTTP\_PROXY on bootstrap. [\#488](https://github.com/voxpupuli/puppet-python/pull/488) ([pillarsdotnet](https://github.com/pillarsdotnet)) +- Modern pip can install wheels without wheel installed [\#483](https://github.com/voxpupuli/puppet-python/pull/483) ([asottile](https://github.com/asottile)) +- Allow arbitrary pip providers [\#480](https://github.com/voxpupuli/puppet-python/pull/480) ([ethanhs](https://github.com/ethanhs)) +- Add manage\_scl boolean to control managing SCL [\#464](https://github.com/voxpupuli/puppet-python/pull/464) ([bodgit](https://github.com/bodgit)) +- Allow pip to work in AIX systems [\#461](https://github.com/voxpupuli/puppet-python/pull/461) ([feltra](https://github.com/feltra)) +- move pip bootstrap into a seperate class [\#460](https://github.com/voxpupuli/puppet-python/pull/460) ([feltra](https://github.com/feltra)) +- Allow custom python versions and environments [\#451](https://github.com/voxpupuli/puppet-python/pull/451) ([jradmacher](https://github.com/jradmacher)) + +**Fixed bugs:** + +- Installing from git repo runs install on every Puppet run [\#193](https://github.com/voxpupuli/puppet-python/issues/193) +- Fix python::pip installing $editable VCS packages every Puppet run [\#491](https://github.com/voxpupuli/puppet-python/pull/491) ([wolttam](https://github.com/wolttam)) +- Fix $subscribe overloading [\#490](https://github.com/voxpupuli/puppet-python/pull/490) ([nward](https://github.com/nward)) +- Fix version-check. [\#489](https://github.com/voxpupuli/puppet-python/pull/489) ([pillarsdotnet](https://github.com/pillarsdotnet)) +- Update version validation [\#472](https://github.com/voxpupuli/puppet-python/pull/472) ([bodgit](https://github.com/bodgit)) +- Normalize Python version in `python::pyvenv` [\#466](https://github.com/voxpupuli/puppet-python/pull/466) ([thaiphv](https://github.com/thaiphv)) +- Fix Ubuntu bionic package installation [\#450](https://github.com/voxpupuli/puppet-python/pull/450) ([ekohl](https://github.com/ekohl)) +- Fix $filename and $mode types in python::dotfile [\#446](https://github.com/voxpupuli/puppet-python/pull/446) ([gdubicki](https://github.com/gdubicki)) +- Stop using 'pip search' for ensure =\> latest [\#434](https://github.com/voxpupuli/puppet-python/pull/434) ([gdubicki](https://github.com/gdubicki)) + +**Closed issues:** + +- Should set permissive umask before exec. [\#486](https://github.com/voxpupuli/puppet-python/issues/486) +- When updating pip via puppet-python, an error occurs. [\#484](https://github.com/voxpupuli/puppet-python/issues/484) +- Not possible to install Python-3 with this module [\#482](https://github.com/voxpupuli/puppet-python/issues/482) +- Cannot install pre-commit pip. [\#481](https://github.com/voxpupuli/puppet-python/issues/481) +- Allow the use of pip3.4 and pip3.6 [\#476](https://github.com/voxpupuli/puppet-python/issues/476) +- python3\_version fact doesn't work on SCL [\#475](https://github.com/voxpupuli/puppet-python/issues/475) +- missing https\_proxy when using https pypi of other https indexes [\#473](https://github.com/voxpupuli/puppet-python/issues/473) +- Unable to use SCL version [\#471](https://github.com/voxpupuli/puppet-python/issues/471) +- Variable $subscribe shoud not be overwritten [\#470](https://github.com/voxpupuli/puppet-python/issues/470) +- Add switch to not manage SCL setup [\#463](https://github.com/voxpupuli/puppet-python/issues/463) +- update dependencies to stdlib \>= 4.19 [\#458](https://github.com/voxpupuli/puppet-python/issues/458) +- Impossible to use version number in Ubuntu 16.04 [\#448](https://github.com/voxpupuli/puppet-python/issues/448) +- Documentation still includes the deprecated stankevich-python module for installation [\#441](https://github.com/voxpupuli/puppet-python/issues/441) +- No puppet strings docs/class reference docs [\#439](https://github.com/voxpupuli/puppet-python/issues/439) +- python::pip ensure =\> latest triggers refresh on each puppet run for some packages [\#433](https://github.com/voxpupuli/puppet-python/issues/433) +- Support for Python3.6 executables [\#420](https://github.com/voxpupuli/puppet-python/issues/420) +- Python 3 + virtualenv + centos 7 not working [\#354](https://github.com/voxpupuli/puppet-python/issues/354) +- --no-use-wheel argument fails requirement installation [\#173](https://github.com/voxpupuli/puppet-python/issues/173) + +**Merged pull requests:** + +- 486 Set permissive umask. [\#487](https://github.com/voxpupuli/puppet-python/pull/487) ([pillarsdotnet](https://github.com/pillarsdotnet)) +- Update `puppetlabs/stdlib` dependency to allow 6.x and require at least 4.19.0 \(where the `fact\(\)` function was introduced\) [\#485](https://github.com/voxpupuli/puppet-python/pull/485) ([pillarsdotnet](https://github.com/pillarsdotnet)) +- Update pip url regex to support 'git+git://\' [\#477](https://github.com/voxpupuli/puppet-python/pull/477) ([gharper](https://github.com/gharper)) +- README.md: remove obsolete and redundant sections [\#453](https://github.com/voxpupuli/puppet-python/pull/453) ([kenyon](https://github.com/kenyon)) +- remove .DS\_Store [\#452](https://github.com/voxpupuli/puppet-python/pull/452) ([kenyon](https://github.com/kenyon)) +- Change default indent to 2 Spaces in .editorconfig [\#449](https://github.com/voxpupuli/puppet-python/pull/449) ([jradmacher](https://github.com/jradmacher)) +- Replace deprecated validate\_\* functions [\#443](https://github.com/voxpupuli/puppet-python/pull/443) ([baurmatt](https://github.com/baurmatt)) +- Update modules with defined types for variables as described in docs/Add reference.md [\#440](https://github.com/voxpupuli/puppet-python/pull/440) ([danquack](https://github.com/danquack)) + ## [v2.2.2](https://github.com/voxpupuli/puppet-python/tree/v2.2.2) (2018-10-20) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.2.0...v2.2.2) @@ -78,7 +140,7 @@ These should not affect the functionality of the module. **Implemented enhancements:** - Add Debian 9 Support [\#398](https://github.com/voxpupuli/puppet-python/issues/398) -- Add support for Anaconda [\#409](https://github.com/voxpupuli/puppet-python/pull/409) ([grsakea](https://github.com/grsakea)) +- Add support for Anaconda [\#409](https://github.com/voxpupuli/puppet-python/pull/409) ([jb-abbadie](https://github.com/jb-abbadie)) - Add umask parameter to pip execs [\#368](https://github.com/voxpupuli/puppet-python/pull/368) ([jstaph](https://github.com/jstaph)) **Closed issues:** diff --git a/metadata.json b/metadata.json index 9f76d497..77f25042 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "2.2.3-rc0", + "version": "3.0.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From f70d7b395edbaa3f5497b5eb7f1e57c3f6f4af56 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jun 2019 17:00:57 +0100 Subject: [PATCH 152/380] [blacksmith] Bump version to 3.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 77f25042..9ab45f43 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "3.0.0", + "version": "3.0.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 82d5f6c982542938f668f8dbfa505cb64a0eb72b Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jun 2019 17:32:44 +0100 Subject: [PATCH 153/380] Fix travis secret --- .sync.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.sync.yml b/.sync.yml index 3aa8e527..51a985b9 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,6 +1,6 @@ --- .travis.yml: - secret: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" + secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" docker_sets: - set: ubuntu1404-64 - set: ubuntu1604-64 diff --git a/.travis.yml b/.travis.yml index f3f66bf5..03ab9eb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,7 +86,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" on: tags: true # all_branches is required to use tags From 17b7624d470a6db8e4c9bb2731388ad1d2e9c3cc Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jun 2019 17:40:37 +0100 Subject: [PATCH 154/380] Release 3.0.1 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c5f0757..78e6bff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v3.0.1](https://github.com/voxpupuli/puppet-python/tree/v3.0.1) (2019-06-13) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v3.0.0...v3.0.1) + +**Merged pull requests:** + +- Fix travis secret [\#493](https://github.com/voxpupuli/puppet-python/pull/493) ([alexjfisher](https://github.com/alexjfisher)) + ## [v3.0.0](https://github.com/voxpupuli/puppet-python/tree/v3.0.0) (2019-06-13) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.2.2...v3.0.0) diff --git a/metadata.json b/metadata.json index 9ab45f43..a16f3c22 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "3.0.1-rc0", + "version": "3.0.1", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 714f63d7af7c30c3f323f98e3b557d477da74231 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jun 2019 18:30:22 +0100 Subject: [PATCH 155/380] [blacksmith] Bump version to 3.0.2-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a16f3c22..1ea041df 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "3.0.1", + "version": "3.0.2-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 1cb75bc8359a5a20ed4f03d4fee83933eb3c21b2 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jun 2019 18:35:01 +0100 Subject: [PATCH 156/380] Add badges --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f905a36f..dcfafdb2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# puppet-python [![Build Status](https://travis-ci.org/voxpupuli/puppet-python.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-python) +# puppet-python + +[![License](https://img.shields.io/github/license/voxpupuli/puppet-python.svg)](https://github.com/voxpupuli/puppet-python/blob/master/LICENSE) +[![Build Status](https://travis-ci.org/voxpupuli/puppet-python.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-python) +[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) +[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) +[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) +[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. From 7368d64fa9ffa899ef1b9629ca351661ef7ab5e8 Mon Sep 17 00:00:00 2001 From: James Kelly Date: Wed, 19 Jun 2019 12:24:03 -0500 Subject: [PATCH 157/380] Use shell to exec pip commands by default --- manifests/pip.pp | 2 ++ manifests/pip/bootstrap.pp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/manifests/pip.pp b/manifests/pip.pp index 0940f18e..647d0675 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -67,6 +67,7 @@ Numeric $timeout = 1800, String[1] $log_dir = '/tmp', Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + String[1] $exec_provider = 'shell', ){ $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') @@ -238,6 +239,7 @@ environment => $environment, timeout => $timeout, path => $_path, + provider => $exec_provider, } } diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index eff7d568..7dcbc2b4 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -13,6 +13,7 @@ Enum['pip', 'pip3'] $version = 'pip', Variant[Boolean, String] $manage_python = false, Optional[Stdlib::HTTPUrl] $http_proxy = undef, + String[1] $exec_provider = 'shell', ) inherits python::params { if $manage_python { include python @@ -37,6 +38,7 @@ unless => 'which pip3', path => $python::params::pip_lookup_path, require => Package['python3'], + provider => $exec_provider, } # puppet is opinionated about the pip command name file { 'pip3-python': @@ -52,6 +54,7 @@ unless => 'which pip', path => $python::params::pip_lookup_path, require => Package['python'], + provider => $exec_provider, } # puppet is opinionated about the pip command name file { 'pip-python': From ec56c023e0370ef90a319ebba164d75c1b981b83 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 27 Jul 2019 15:32:48 +0200 Subject: [PATCH 158/380] modulesync 2.8.0 --- .github/CONTRIBUTING.md | 23 +++++++++++++++++++---- .msync.yml | 2 +- Gemfile | 1 + spec/spec_helper.rb | 2 ++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5d047472..38cacd4e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -51,19 +51,34 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development system_tests release +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --with system_tests --without development release +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --with system_tests --without development release; bundle update; bundle clean +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command unter OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" ``` ## Syntax and style @@ -160,7 +175,7 @@ created virtual machines will be in `.vagrant/beaker_vagrant_files`. Beaker also supports docker containers. We also use that in our automated CI pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: -``` +```sh PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker ``` diff --git a/.msync.yml b/.msync.yml index 55198916..23dfa32f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.7.0' +modulesync_config_version: '2.8.0' diff --git a/Gemfile b/Gemfile index 24dbb7ff..9571ef3c 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,7 @@ group :test do gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-topscope-variable-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cbfeb7a6..3d0ed017 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,6 +7,7 @@ require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' +require 'bundler' include RspecPuppetFacts if File.exist?(File.join(__dir__, 'default_module_facts.yml')) @@ -31,6 +32,7 @@ add_filter '/spec' add_filter '/vendor' add_filter '/.vendor' + add_filter Bundler.configured_bundle_path.path end end From c3bcb9dba301242816f1353f606abdca028889f3 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Tue, 26 Nov 2019 11:28:59 +0100 Subject: [PATCH 159/380] Switch to int_date for acceptance test `Randomized_Requests` has problems to be installed in newer versions thus lets just switch to a different pip which includes a underscore. --- spec/acceptance/virtualenv_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 7c3fba0d..82b81e2d 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -94,7 +94,7 @@ class { 'python' : owner => 'root', group => 'root', } - -> python::pip { 'Randomized_Requests' : + -> python::pip { 'int_date' : ensure => 'latest', virtualenv => '/opt/venv4', } From 6118c58a70f19398cdea3a60591d0ac35a541028 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 13 Nov 2019 22:55:11 +0100 Subject: [PATCH 160/380] drop Ubuntu 14.04 support --- .sync.yml | 1 - .travis.yml | 8 -------- metadata.json | 1 - 3 files changed, 10 deletions(-) diff --git a/.sync.yml b/.sync.yml index 51a985b9..43f2a83e 100644 --- a/.sync.yml +++ b/.sync.yml @@ -2,7 +2,6 @@ .travis.yml: secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" docker_sets: - - set: ubuntu1404-64 - set: ubuntu1604-64 - set: ubuntu1804-64 - set: debian8-64 diff --git a/.travis.yml b/.travis.yml index 03ab9eb3..f8167bc7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,14 +23,6 @@ matrix: - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker diff --git a/metadata.json b/metadata.json index 1ea041df..08488aac 100644 --- a/metadata.json +++ b/metadata.json @@ -42,7 +42,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "14.04", "16.04", "18.04" ] From cf3946fffb550c3644660c2671108478a088115c Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Tue, 26 Nov 2019 10:19:05 +0100 Subject: [PATCH 161/380] Fix duplicate declaration for python-venv package Fixes #517. --- manifests/pyvenv.pp | 12 +++++------- spec/classes/python_spec.rb | 22 ++++++++++++++++++++++ spec/defines/pyvenv_spec.rb | 12 ++++++++---- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 7807a6b3..5ae6eef3 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -32,13 +32,12 @@ $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], $environment = [], ) { - include python if $ensure == 'present' { $python_version = $version ? { - 'system' => $facts['python3_version'], - default => $version, + 'system' => $facts['python3_version'], + default => $version, } $python_version_parts = split($python_version, '[.]') @@ -50,11 +49,10 @@ case $facts['lsbdistcodename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { - ensure_packages ($python3_venv_package, { - before => File[$venv_dir], - }) + ensure_packages ($python3_venv_package) + Package[$python3_venv_package] -> File[$venv_dir] } - default: {} + default: {} } } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index afebca6b..41ea46d0 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -72,6 +72,28 @@ end end + describe 'with python::python_pyvenvs' do + context 'with two pyenvs' do + let(:params) do + { + python_pyvenvs: { + '/opt/env1' => { + version: '3.8' + }, + '/opt/env2' => { + version: '3.8' + } + } + } + end + + it { is_expected.to compile } + + it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') } + it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } + end + end + describe 'with manage_gunicorn' do context 'true' do let(:params) { { manage_gunicorn: true } } diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index aa66aac5..81ec3fd1 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -13,10 +13,14 @@ '/opt/env' end - it { - is_expected.to contain_file('/opt/env') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env') - } + context 'with default parameters' do + it { is_expected.to contain_file('/opt/env') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env') } + + if %w[xenial bionic cosmic disco jessie stretch buster].include?(facts[:lsbdistcodename]) + it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } + end + end describe 'when ensure' do context 'is absent' do From c881d2e128a3e6af930fadffdfb8c4ed8731917b Mon Sep 17 00:00:00 2001 From: Olivier van der Toorn Date: Mon, 28 Oct 2019 19:12:56 +0100 Subject: [PATCH 162/380] Recognize Debian python package name, fixes: #506 Apply the suggested fix to recognize Debian python pacakges. --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index cd3132f5..8ace3130 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -65,7 +65,7 @@ default => '', } - unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])+/, + unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { fail("version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6' )") } From 0eeecab3fcdfa6cbb8320ba8b365314e094600d6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Sat, 19 Oct 2019 15:22:51 +0200 Subject: [PATCH 163/380] Clean up acceptance spec helper --- spec/spec_helper_acceptance.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index c978c402..76106237 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -4,16 +4,14 @@ require 'beaker/module_install_helper' run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' -install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i -install_module_on(hosts) -install_module_dependencies_on(hosts) RSpec.configure do |c| # Readable test descriptions c.formatter = :documentation - hosts.each do |host| - if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker} - on(host, "sed -i '/nodocs/d' /etc/yum.conf") - end + + # Configure all nodes in nodeset + c.before :suite do + install_module + install_module_dependencies end end From 94d62184eb856beb933738ba6a30b26f8b593223 Mon Sep 17 00:00:00 2001 From: Sascha Doering Date: Tue, 26 Nov 2019 14:19:52 +0100 Subject: [PATCH 164/380] Fix a reassigned variable This occurred when $ensure was set to 'absent'. Then the variable used for the title of the exec resource was assigned twice, resulting in an error. --- manifests/pip.pp | 10 ++++++---- spec/defines/pip_spec.rb | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 0940f18e..af976446 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -174,8 +174,6 @@ $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" - $pip_exec_name = "pip_install_${name}" - # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { if $_ensure != present and $_ensure != latest { @@ -221,14 +219,18 @@ default: { # Anti-action, uninstall. - $pip_exec_name = "pip_uninstall_${name}" $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" } } } - exec { $pip_exec_name: + $pip_installer = ($ensure == 'absent') ? { + true => "pip_uninstall_${name}", + false => "pip_install_${name}", + } + + exec { $pip_installer: command => $command, unless => $unless_command, user => $owner, diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 68efdd53..e623dc42 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -106,6 +106,16 @@ it { is_expected.to contain_exec('pip_install_rpyc').with_unless(%r{wordpress-json}) } end end + + describe 'uninstall' do + context 'adds correct title' do + let(:params) { { ensure: 'absent' } } + + it { is_expected.not_to contain_exec('pip_install_rpyc') } + + it { is_expected.to contain_exec('pip_uninstall_rpyc').with_command(%r{uninstall.*rpyc$}) } + end + end end end From 1477e6f7a31b1fbc6e35896c7a4b4c202e626324 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 26 Nov 2019 19:45:59 +0100 Subject: [PATCH 165/380] Clean up requirements_spec.rb A lot of contexts and describes are redundant. --- spec/defines/requirements_spec.rb | 68 ++++++++++++------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 29119422..c57f076d 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -2,7 +2,7 @@ describe 'python::requirements', type: :define do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end @@ -11,52 +11,38 @@ '/requirements.txt' end - context 'on Debian OS' do - describe 'requirements as' do - context '/requirements.txt' do - let :params do - { - requirements: '/requirements.txt' - } - end + context 'with /requirements.txt' do + let :params do + { + requirements: '/requirements.txt' + } + end - it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } - end - context '/requirements.txt' do - let :params do - { - requirements: '/requirements.txt', - manage_requirements: false - } - end - - it { is_expected.not_to contain_file('/requirements.txt') } - end + it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } - describe 'with owner' do - context 'bob:bob' do - let :params do - { - owner: 'bob', - group: 'bob' - } - end - - it do - expect do - is_expected.to compile - end.to raise_error(%r{root user must be used when virtualenv is system}) - end - end - end + context 'with manage_requirements => false' do + let(:params) { super().merge(manage_requirements: false) } + + it { is_expected.not_to contain_file('/requirements.txt') } + end + end - describe 'with owner' do - context 'default' do - it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } - end + describe 'with owner' do + context 'bob:bob' do + let :params do + { + owner: 'bob', + group: 'bob' + } end + + it { is_expected.to compile.and_raise_error(%r{root user must be used when virtualenv is system}) } end end + + context 'default' do + it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } + end end end end From bac487786347845ba06842629c09a1b755746388 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2019 12:49:56 +0100 Subject: [PATCH 166/380] modulesync 2.9.0 --- .github/CONTRIBUTING.md | 2 +- .travis.yml | 22 +++++++++++----------- Dockerfile | 2 +- Gemfile | 5 +++-- Rakefile | 13 +++++++++++++ spec/spec_helper.rb | 17 +++++++++++++++++ 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 38cacd4e..5e0bcea7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -75,7 +75,7 @@ BUNDLE_JOBS="$(nproc)" ### Note for OS X users -`nproc` isn't a valid command unter OS x. As an alternative, you can do: +`nproc` isn't a valid command under OS x. As an alternative, you can do: ```sh --jobs "$(sysctl -n hw.ncpu)" diff --git a/.travis.yml b/.travis.yml index f8167bc7..d6fe40c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ --- -dist: xenial +dist: bionic language: ruby cache: bundler before_install: @@ -25,43 +25,43 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker services: docker branches: only: diff --git a/Dockerfile b/Dockerfile index 67048bb4..6fd63422 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN bundle install --without system_tests development release --path=${BUNDLE_PA COPY . . RUN bundle install -RUN bundle exec release_checks +RUN bundle exec rake release_checks # Container should not saved RUN exit 1 diff --git a/Gemfile b/Gemfile index 9571ef3c..b2212f25 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ end group :test do gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false - gem 'rspec-puppet-facts', '>= 1.8.0', :require => false + gem 'rspec-puppet-facts', '>= 1.9.5', :require => false gem 'rspec-puppet-utils', :require => false gem 'puppet-lint-leading_zero-check', :require => false gem 'puppet-lint-trailing_comma-check', :require => false @@ -22,6 +22,7 @@ group :test do gem 'puppet-lint-variable_contains_upcase', :require => false gem 'puppet-lint-absolute_classname-check', :require => false gem 'puppet-lint-topscope-variable-check', :require => false + gem 'puppet-lint-legacy_facts-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false @@ -65,7 +66,7 @@ end group :release do gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'voxpupuli-release', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 09701d0f..e3642ace 100644 --- a/Rakefile +++ b/Rakefile @@ -77,6 +77,19 @@ begin metadata = JSON.load(File.read(metadata_json)) config.project = metadata['name'] end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + rescue LoadError end # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3d0ed017..720a0e9f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,11 @@ require 'bundler' include RspecPuppetFacts +if ENV['DEBUG'] + Puppet::Util::Log.level = :debug + Puppet::Util::Log.newdestination(:console) +end + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) if facts @@ -37,6 +42,18 @@ end RSpec.configure do |c| + # getting the correct facter version is tricky. We use facterdb as a source to mock facts + # see https://github.com/camptocamp/facterdb + # people might provide a specific facter version. In that case we use it. + # Otherwise we need to match the correct facter version to the used puppet version. + # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 + # https://puppet.com/docs/puppet/5.5/about_agent.html + c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] + ENV['FACTERDB_FACTS_VERSION'] + else + Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0' + end + # Coverage generation c.after(:suite) do RSpec::Puppet::Coverage.report! From 004143f2849673d3cedd5486bc01244a63e44242 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2019 12:57:37 +0100 Subject: [PATCH 167/380] puppet-lint: fix legacy_facts --- manifests/init.pp | 2 +- manifests/install.pp | 10 +++++----- manifests/params.pp | 4 ++-- manifests/pyvenv.pp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8ace3130..2e8d7e4b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -73,7 +73,7 @@ # Module compatibility check $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX' ] if ! ($facts['os']['family'] in $compatible) { - fail("Module is not compatible with ${::operatingsystem}") + fail("Module is not compatible with ${facts['os']['name']}") } # Anchor pattern to contain dependencies diff --git a/manifests/install.pp b/manifests/install.pp index 70d2f0b6..8b409794 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -145,9 +145,9 @@ 'rhscl': { # rhscl is RedHat SCLs from softwarecollections.org if $python::rhscl_use_public_repository { - $scl_package = "rhscl-${python::version}-epel-${::operatingsystemmajrelease}-${::architecture}" + $scl_package = "rhscl-${python::version}-epel-${facts['os']['release']['major']}-${facts['os']['architecture']}" package { $scl_package: - source => "https://www.softwarecollections.org/en/scls/rhscl/${python::version}/epel-${::operatingsystemmajrelease}-${::architecture}/download/${scl_package}.noarch.rpm", + source => "https://www.softwarecollections.org/en/scls/rhscl/${python::version}/epel-${facts['os']['release']['major']}-${facts['os']['architecture']}/download/${scl_package}.noarch.rpm", provider => 'rpm', tag => 'python-scl-repo', } @@ -244,7 +244,7 @@ Class['epel'] -> Package['pip'] } } - if ($venv_ensure != 'absent') and ($::operatingsystemrelease =~ /^6/) { + if ($venv_ensure != 'absent') and ($facts['os']['release']['full'] =~ /^6/) { if $python::use_epel == true { include 'epel' Class['epel'] -> Package['virtualenv'] @@ -272,11 +272,11 @@ $pip_category = undef $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') - } elsif ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemmajrelease, '7') >= 0) { + } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { $pip_category = undef $pip_package = 'python2-pip' $pip_provider = pip2 - } elsif $::osfamily == 'Gentoo' { + } elsif $facts['os']['family'] == 'Gentoo' { $pip_category = 'dev-python' $pip_package = 'pip' $pip_provider = 'pip' diff --git a/manifests/params.pp b/manifests/params.pp index 6aa9f996..0444d756 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -15,8 +15,8 @@ $valid_versions = undef $manage_scl = true - if $::osfamily == 'RedHat' { - if $::operatingsystem != 'Fedora' { + if $facts['os']['family'] == 'RedHat' { + if $facts['os']['name'] != 'Fedora' { $use_epel = true } else { $use_epel = false diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 5ae6eef3..33045743 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -46,7 +46,7 @@ # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian'){ $python3_venv_package="python${normalized_python_version}-venv" - case $facts['lsbdistcodename'] { + case $facts['os']['distro']['codename'] { 'xenial','bionic','cosmic','disco', 'jessie','stretch','buster': { ensure_packages ($python3_venv_package) From 74eb07632e76c8ae0607f252a3af4f7ef8edccdd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2019 20:08:33 +0100 Subject: [PATCH 168/380] ignore old Gentoo factsets with legacy facter facterdb contains a very old factset for Gentoo with Facter version 1.7. This version is very old and won't work at all with the current version of the module. Since we don't set a specific version for Gentoo in the metadata.json (because it's a rolling release distribution), rspec-puppet-facts will even pick those very old factsets. We are ignoring them now. facterdb contains more modern factsets so Gentoo is still tested. --- spec/classes/python_spec.rb | 3 ++- spec/defines/pyvenv_spec.rb | 3 ++- spec/defines/requirements_spec.rb | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 41ea46d0..d5d3fbeb 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -2,7 +2,8 @@ describe 'python', type: :class do on_supported_os.each do |os, facts| - context "on #{os} " do + next if os == 'gentoo-3-x86_64' + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 81ec3fd1..9632dfc1 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -2,7 +2,8 @@ describe 'python::pyvenv', type: :define do on_supported_os.each do |os, facts| - context("on #{os} ") do + next if os == 'gentoo-3-x86_64' + context "on #{os}" do let :facts do # python3 is required to use pyvenv facts.merge( diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index c57f076d..fd950dc9 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -2,6 +2,7 @@ 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 From 450b39e7bb3b2233f8255c609ff3d8875fcb951a Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Mon, 25 Nov 2019 17:06:14 +0100 Subject: [PATCH 169/380] Upgrade pip and setuptools on venv creation --- manifests/pyvenv.pp | 4 +++- spec/defines/pyvenv_spec.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 5ae6eef3..dfdd5965 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -81,8 +81,10 @@ mode => $mode, } + $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + exec { "python_virtualenv_${venv_dir}": - command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir}", + command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade pip && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", user => $owner, creates => "${venv_dir}/bin/activate", path => $_path, diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 81ec3fd1..73df2f1c 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -15,7 +15,7 @@ context 'with default parameters' do it { is_expected.to contain_file('/opt/env') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } if %w[xenial bionic cosmic disco jessie stretch buster].include?(facts[:lsbdistcodename]) it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } From e797fcfa155eab1d35fa910cef28784327942b8c Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Thu, 5 Dec 2019 15:28:05 +0100 Subject: [PATCH 170/380] Allow python::version to contain a point (e.g. python3.7) This worked before #489. Fixes #508. --- manifests/install.pp | 11 ++++++----- spec/classes/python_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 8b409794..026b94e9 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -7,11 +7,12 @@ class python::install { $python = $python::version ? { - 'system' => 'python', - 'pypy' => 'pypy', - /\A(python)?([0-9]+)/ => "python${2}", - /\Arh-python[0-9]{2}/ => $python::version, - default => "python${python::version}", + 'system' => 'python', + 'pypy' => 'pypy', + /\A(python[23]\.[0-9]+)/ => $1, + /\A(python)?([0-9]+)/ => "python${2}", + /\Arh-python[0-9]{2}/ => $python::version, + default => "python${python::version}", } $pythondev = $facts['os']['family'] ? { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d5d3fbeb..ec1120cf 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -21,6 +21,18 @@ # Basic python packages (from pip) it { is_expected.to contain_package('virtualenv') } + describe 'with python::version' do + context 'python3.7' do + let(:params) { { version: 'python3.7' } } + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_package('pip').with_name('python3.7-pip') } + it { is_expected.to contain_package('python').with_name('python3.7') } + it { is_expected.to contain_package('python-dev').with_name('python3.7-dev') } + it { is_expected.to contain_package('virtualenv').with_name('virtualenv') } + end + end + describe 'with python::dev' do context 'true' do let(:params) { { dev: 'present' } } From 312131fc16ca03d9779108fc5891f51d5156501b Mon Sep 17 00:00:00 2001 From: Dennis Hoppe Date: Fri, 6 Dec 2019 15:35:36 +0100 Subject: [PATCH 171/380] modulesync 2.9.0 --- .github/CONTRIBUTING.md | 134 ++++++++++++++++++++++++++++++++-------- .msync.yml | 2 +- Gemfile | 3 +- 3 files changed, 110 insertions(+), 29 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 5e0bcea7..f3ffb570 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,3 +1,18 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + This module has grown over time based on a range of contributions from people using it. If you follow these contributing guidelines your patch will likely make it into a release a little more quickly. @@ -8,29 +23,92 @@ Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). -1. Fork the repo. - -1. Create a separate branch for your change. - -1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) - runs the tests for us. You can also execute them locally. This is explained - in a later section. - -1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we - use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). - They provide some guidance for new code that might help you before you submit a pull request. - -1. Add a test for your change. Only refactoring and documentation - changes require no new tests. If you are adding functionality - or fixing a bug, please add a test. - -1. Squash your commits down into logical components. Make sure to rebase - against our current master. - -1. Push the branch to your fork and submit a pull request. - -Please be prepared to repeat some of these steps as our contributors review -your code. +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. ## Dependencies @@ -81,7 +159,9 @@ BUNDLE_JOBS="$(nproc)" --jobs "$(sysctl -n hw.ncpu)" ``` -## Syntax and style +## The test matrix + +### Syntax and style The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to @@ -99,7 +179,7 @@ against it. You can run those locally ahead of time with: bundle exec rake rubocop ``` -## Running the unit tests +### Running the unit tests The unit test suite covers most of the code, as mentioned above please add tests if you're adding new functionality. If you've not used @@ -124,7 +204,7 @@ To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb ``` -### Unit tests in docker +#### Unit tests in docker Some people don't want to run the dependencies locally or don't want to install ruby. We ship a Dockerfile that enables you to run all unit tests and linting. @@ -139,7 +219,7 @@ permission to talk to it. You can specify a remote docker host by setting the `DOCKER_HOST` environment variable. it will copy the content of the module into the docker image. So it will not work if a Gemfile.lock exists. -## Integration tests +### Integration tests The unit tests just check the code runs, not that it does exactly what we want on a real machine. For that we're using diff --git a/.msync.yml b/.msync.yml index 23dfa32f..a7c0bbf9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.8.0' +modulesync_config_version: '2.9.0' diff --git a/Gemfile b/Gemfile index b2212f25..5a2e7379 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ group :test do gem 'puppet-lint-absolute_classname-check', :require => false gem 'puppet-lint-topscope-variable-check', :require => false gem 'puppet-lint-legacy_facts-check', :require => false + gem 'puppet-lint-anchor-check', :require => false gem 'metadata-json-lint', :require => false gem 'redcarpet', :require => false gem 'rubocop', '~> 0.49.1', :require => false @@ -64,7 +65,7 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' + gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', :require => false gem 'puppet-strings', '>= 2.2', :require => false From 26d2dc2bfa9dc68c02f26b08e94fc737004efc89 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Tue, 10 Dec 2019 09:02:58 +0100 Subject: [PATCH 172/380] Remove anchor in favour of contain --- manifests/init.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2e8d7e4b..8b622683 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -76,11 +76,11 @@ fail("Module is not compatible with ${facts['os']['name']}") } - # Anchor pattern to contain dependencies - anchor { 'python::begin': } - -> class { 'python::install': } - -> class { 'python::config': } - -> anchor { 'python::end': } + contain python::install + contain python::config + + Class['python::install'] + -> Class['python::config'] # Set default umask. if $umask != undef { From 5d67a27c99481e3697e3f39fd8a810a4fa9bfaa6 Mon Sep 17 00:00:00 2001 From: Matthias Baur Date: Tue, 10 Dec 2019 11:36:02 +0100 Subject: [PATCH 173/380] Release 4.0.0 --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ metadata.json | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e6bff1..35c874e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,38 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v4.0.0](https://github.com/voxpupuli/puppet-python/tree/v4.0.0) (2019-12-10) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v3.0.1...v4.0.0) + +**Breaking changes:** + +- Drop Ubuntu 14.04 support [\#515](https://github.com/voxpupuli/puppet-python/pull/515) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- Allow python::version to contain a point \(e.g. python3.7\) [\#523](https://github.com/voxpupuli/puppet-python/pull/523) ([baurmatt](https://github.com/baurmatt)) +- Fix duplicate declaration for python-venv package [\#518](https://github.com/voxpupuli/puppet-python/pull/518) ([baurmatt](https://github.com/baurmatt)) +- Use shell to exec pip commands by default [\#498](https://github.com/voxpupuli/puppet-python/pull/498) ([jamebus](https://github.com/jamebus)) +- Fix a reassigned variable [\#497](https://github.com/voxpupuli/puppet-python/pull/497) ([SaschaDoering](https://github.com/SaschaDoering)) + +**Closed issues:** + +- Duplicate declaration for python$version-venv [\#517](https://github.com/voxpupuli/puppet-python/issues/517) +- Python 3.6 on ubuntu 18.04 not working [\#508](https://github.com/voxpupuli/puppet-python/issues/508) +- Module does not recognize Debian python package name [\#506](https://github.com/voxpupuli/puppet-python/issues/506) +- Gunicorn via Hiera [\#499](https://github.com/voxpupuli/puppet-python/issues/499) +- Python::Pip fails if $ensure='absent' [\#496](https://github.com/voxpupuli/puppet-python/issues/496) + +**Merged pull requests:** + +- Clean up requirements\_spec.rb [\#521](https://github.com/voxpupuli/puppet-python/pull/521) ([ekohl](https://github.com/ekohl)) +- Switch to int\_date for acceptance test [\#519](https://github.com/voxpupuli/puppet-python/pull/519) ([baurmatt](https://github.com/baurmatt)) +- Upgrade pip and setuptools on venv creation [\#516](https://github.com/voxpupuli/puppet-python/pull/516) ([baurmatt](https://github.com/baurmatt)) +- Recognize Debian python package name, fixes: \#506 [\#514](https://github.com/voxpupuli/puppet-python/pull/514) ([lordievader](https://github.com/lordievader)) +- Clean up acceptance spec helper [\#512](https://github.com/voxpupuli/puppet-python/pull/512) ([ekohl](https://github.com/ekohl)) +- Add badges to README [\#495](https://github.com/voxpupuli/puppet-python/pull/495) ([alexjfisher](https://github.com/alexjfisher)) + ## [v3.0.1](https://github.com/voxpupuli/puppet-python/tree/v3.0.1) (2019-06-13) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v3.0.0...v3.0.1) diff --git a/metadata.json b/metadata.json index 08488aac..21b1d9c4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "3.0.2-rc0", + "version": "4.0.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 01489a2886842a0ebecf937208b9853291388b23 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 10 Dec 2019 12:47:11 +0100 Subject: [PATCH 174/380] [blacksmith] Bump version to 4.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 21b1d9c4..d855dc79 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.0.0", + "version": "4.0.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 6f72cf182bd7d33cf824510964c8d2a984c310a8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 23 Dec 2019 01:04:38 +0100 Subject: [PATCH 175/380] modulesync 2.10.0 --- .msync.yml | 2 +- .rubocop.yml | 2 +- .travis.yml | 4 ++-- Gemfile | 2 +- Rakefile | 10 ---------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/.msync.yml b/.msync.yml index a7c0bbf9..11aed5fe 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.9.0' +modulesync_config_version: '2.10.0' diff --git a/.rubocop.yml b/.rubocop.yml index 099a11c5..5984ccc6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 1.9 + TargetRubyVersion: 2.1 Include: - ./**/*.rb Exclude: diff --git a/.travis.yml b/.travis.yml index d6fe40c6..437eeb5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,7 @@ dist: bionic language: ruby cache: bundler before_install: - - gem update --system - - gem update bundler + - yes | gem update --system - bundle --version script: - 'bundle exec rake $CHECK' @@ -69,6 +68,7 @@ branches: - /^v\d/ notifications: email: false + webhooks: https://voxpupu.li/incoming/travis irc: on_success: always on_failure: always diff --git a/Gemfile b/Gemfile index 5a2e7379..50a90301 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ group :test do gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false gem 'puppet-lint-unquoted_string-check', :require => false gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-absolute_classname-check', :require => false + gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false gem 'puppet-lint-topscope-variable-check', :require => false gem 'puppet-lint-legacy_facts-check', :require => false gem 'puppet-lint-anchor-check', :require => false diff --git a/Rakefile b/Rakefile index e3642ace..c0f2d37d 100644 --- a/Rakefile +++ b/Rakefile @@ -8,16 +8,6 @@ rescue LoadError end PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' -PuppetLint.configuration.absolute_classname_reverse = true - -exclude_paths = %w( - pkg/**/* - vendor/**/* - .vendor/**/* - spec/**/* -) -PuppetLint.configuration.ignore_paths = exclude_paths -PuppetSyntax.exclude_paths = exclude_paths desc 'Auto-correct puppet-lint offenses' task 'lint:auto_correct' do From 9e7c811c6a0fb570b8597c9ef30a62a360981080 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Jan 2020 13:46:25 +0100 Subject: [PATCH 176/380] update repo links to https --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index d855dc79..403aa55c 100644 --- a/metadata.json +++ b/metadata.json @@ -4,7 +4,7 @@ "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", - "source": "git://github.com/voxpupuli/puppet-python.git", + "source": "https://github.com/voxpupuli/puppet-python.git", "project_page": "https://github.com/voxpupuli/puppet-python", "issues_url": "https://github.com/voxpupuli/puppet-python/issues", "description": "Puppet module for Python", From 58ab06d801773f6dd85654a62529f9a8c05c4c29 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 4 Apr 2020 16:51:27 +0200 Subject: [PATCH 177/380] modulesync 2.12.0 --- .github/CONTRIBUTING.md | 6 +++-- .msync.yml | 2 +- .rubocop.yml | 3 ++- Gemfile | 25 ++++----------------- Rakefile | 33 +-------------------------- spec/spec_helper.rb | 49 +++++------------------------------------ 6 files changed, 17 insertions(+), 101 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f3ffb570..2240a970 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -256,18 +256,20 @@ Beaker also supports docker containers. We also use that in our automated CI pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: ```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker ``` -You can replace the string `debian9` with any common operating system. +You can replace the string `debian10` with any common operating system. The following strings are known to work: * ubuntu1604 * ubuntu1804 * debian8 * debian9 +* debian10 * centos6 * centos7 +* centos8 The easiest way to debug in a docker container is to open a shell: diff --git a/.msync.yml b/.msync.yml index 11aed5fe..8864fc09 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.10.0' +modulesync_config_version: '2.12.0' diff --git a/.rubocop.yml b/.rubocop.yml index 5984ccc6..c2ebc88d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,7 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 2.1 +# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5 + TargetRubyVersion: 1.9 Include: - ./**/*.rb Exclude: diff --git a/Gemfile b/Gemfile index 50a90301..11c85584 100644 --- a/Gemfile +++ b/Gemfile @@ -11,27 +11,9 @@ def location_for(place, fake_version = nil) end group :test do - gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false - gem 'rspec-puppet-facts', '>= 1.9.5', :require => false - gem 'rspec-puppet-utils', :require => false - gem 'puppet-lint-leading_zero-check', :require => false - gem 'puppet-lint-trailing_comma-check', :require => false - gem 'puppet-lint-version_comparison-check', :require => false - gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false - gem 'puppet-lint-unquoted_string-check', :require => false - gem 'puppet-lint-variable_contains_upcase', :require => false - gem 'puppet-lint-absolute_classname-check', '>= 2.0.0', :require => false - gem 'puppet-lint-topscope-variable-check', :require => false - gem 'puppet-lint-legacy_facts-check', :require => false - gem 'puppet-lint-anchor-check', :require => false - gem 'metadata-json-lint', :require => false - gem 'redcarpet', :require => false - gem 'rubocop', '~> 0.49.1', :require => false - gem 'rubocop-rspec', '~> 1.15.0', :require => false - gem 'mocha', '~> 1.4.0', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false - gem 'parallel_tests', :require => false + gem 'voxpupuli-test', '>= 1.0.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false end group :development do @@ -62,6 +44,7 @@ group :system_tests do gem 'rbnacl', '>= 4', :require => false gem 'rbnacl-libsodium', :require => false gem 'bcrypt_pbkdf', :require => false + gem 'ed25519', :require => false end group :release do diff --git a/Rakefile b/Rakefile index c0f2d37d..b450fe7b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,4 @@ -require 'puppetlabs_spec_helper/rake_tasks' +require 'voxpupuli/test/rake' # load optional tasks for releases # only available if gem group releases is installed @@ -7,37 +7,6 @@ begin rescue LoadError end -PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' - -desc 'Auto-correct puppet-lint offenses' -task 'lint:auto_correct' do - Rake::Task[:lint_fix].invoke -end - -desc 'Run acceptance tests' -RSpec::Core::RakeTask.new(:acceptance) do |t| - t.pattern = 'spec/acceptance' -end - -desc 'Run tests' -task test: [:release_checks] - -namespace :check do - desc 'Check for trailing whitespace' - task :trailing_whitespace do - Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename| - next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)} - File.foreach(filename).each_with_index do |line, index| - if line =~ %r{\s\n$} - puts "#{filename} has trailing whitespace on line #{index + 1}" - exit 1 - end - end - end - end -end -Rake::Task[:release_checks].enhance ['check:trailing_whitespace'] - desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 720a0e9f..0fb7a799 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,19 +1,16 @@ # This file is managed via modulesync # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config + RSpec.configure do |c| c.mock_with :mocha end -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' -require 'bundler' -include RspecPuppetFacts +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) -if ENV['DEBUG'] - Puppet::Util::Log.level = :debug - Puppet::Util::Log.newdestination(:console) -end +require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) @@ -23,39 +20,3 @@ end end end - -if Dir.exist?(File.expand_path('../../lib', __FILE__)) - require 'coveralls' - require 'simplecov' - require 'simplecov-console' - SimpleCov.formatters = [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console - ] - SimpleCov.start do - track_files 'lib/**/*.rb' - add_filter '/spec' - add_filter '/vendor' - add_filter '/.vendor' - add_filter Bundler.configured_bundle_path.path - end -end - -RSpec.configure do |c| - # getting the correct facter version is tricky. We use facterdb as a source to mock facts - # see https://github.com/camptocamp/facterdb - # people might provide a specific facter version. In that case we use it. - # Otherwise we need to match the correct facter version to the used puppet version. - # as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 - # https://puppet.com/docs/puppet/5.5/about_agent.html - c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION'] - ENV['FACTERDB_FACTS_VERSION'] - else - Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0' - end - - # Coverage generation - c.after(:suite) do - RSpec::Puppet::Coverage.report! - end -end From d45d213d61f4ae382a3093a814592554270d8892 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 Apr 2020 23:12:23 +0200 Subject: [PATCH 178/380] Use voxpupuli-acceptance --- .sync.yml | 2 ++ .travis.yml | 20 ++++++++++---------- Gemfile | 22 +--------------------- spec/spec_helper_acceptance.rb | 18 ++---------------- 4 files changed, 15 insertions(+), 47 deletions(-) diff --git a/.sync.yml b/.sync.yml index 43f2a83e..75d7e33a 100644 --- a/.sync.yml +++ b/.sync.yml @@ -9,3 +9,5 @@ - set: centos7-64 spec/spec_helper.rb: mock_with: ':mocha' +spec/spec_helper_acceptance.rb: + unmanaged: false diff --git a/.travis.yml b/.travis.yml index 437eeb5e..b3885153 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,43 +24,43 @@ matrix: env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1804-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian9-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker services: docker - rvm: 2.5.3 bundler_args: --without development release - env: PUPPET_INSTALL_TYPE=agent BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker services: docker branches: only: diff --git a/Gemfile b/Gemfile index 11c85584..32c31146 100644 --- a/Gemfile +++ b/Gemfile @@ -24,27 +24,7 @@ group :development do end group :system_tests do - gem 'winrm', :require => false - if beaker_version = ENV['BEAKER_VERSION'] - gem 'beaker', *location_for(beaker_version) - else - gem 'beaker', '>= 4.2.0', :require => false - end - if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] - gem 'beaker-rspec', *location_for(beaker_rspec_version) - else - gem 'beaker-rspec', :require => false - end - gem 'serverspec', :require => false - gem 'beaker-hostgenerator', '>= 1.1.22', :require => false - gem 'beaker-docker', :require => false - gem 'beaker-puppet', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'beaker-module_install_helper', :require => false - gem 'rbnacl', '>= 4', :require => false - gem 'rbnacl-libsodium', :require => false - gem 'bcrypt_pbkdf', :require => false - gem 'ed25519', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 76106237..ffbdaf47 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,17 +1,3 @@ -require 'beaker-rspec' -require 'beaker-puppet' -require 'beaker/puppet_install_helper' -require 'beaker/module_install_helper' +require 'voxpupuli/acceptance/spec_helper_acceptance' -run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' - -RSpec.configure do |c| - # Readable test descriptions - c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - install_module - install_module_dependencies - end -end +configure_beaker From 7fc3a77e5f439c4767c6e854bb649e59305de225 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 14:12:59 +0200 Subject: [PATCH 179/380] switch from stahnma/epel to puppet/epel stahnma migrated the module to us. --- .fixtures.yml | 4 ++-- metadata.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 1cf7a43a..8d63745d 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,7 +1,7 @@ fixtures: repositories: - stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - epel: 'https://github.com/stahnma/puppet-module-epel.git' + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git + epel: https://github.com/voxpupuli/puppet-epel.git yumrepo_core: repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git puppet_version: ">= 6.0.0" diff --git a/metadata.json b/metadata.json index 403aa55c..d30c37f1 100644 --- a/metadata.json +++ b/metadata.json @@ -65,8 +65,8 @@ "version_requirement": ">= 4.19.0 < 7.0.0" }, { - "name": "stahnma/epel", - "version_requirement": ">= 1.2.2 < 2.0.0" + "name": "puppet/epel", + "version_requirement": ">= 3.0.0 < 4.0.0" } ] } From b03ad20dffa0190b3cd8eac3db3d8b4b021a01ba Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 14:57:24 +0200 Subject: [PATCH 180/380] Ubuntu 16.04: Execute tests on Python 3 Since Python 2 is EOL, we should execute all tests on Python 3. --- spec/acceptance/facts_test_spec.rb | 8 ++-- spec/acceptance/virtualenv_spec.rb | 60 +++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 26b7b72e..af136015 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -11,10 +11,10 @@ class { 'python' : EOS fact_notices = <<-EOS - notify{"pip_version: ${::pip_version}":} - notify{"system_python_version: ${::system_python_version}":} - notify{"python_version: ${::python_version}":} - notify{"virtualenv_version: ${::virtualenv_version}":} + notify{"pip_version: ${facts['pip_version']}":} + notify{"system_python_version: ${facts['system_python_version']}":} + notify{"python_version: ${facts['python_version']}":} + notify{"virtualenv_version: ${facts['virtualenv_version']}":} EOS # rubocop:disable RSpec/RepeatedExample diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 82b81e2d..de60ab09 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -5,17 +5,21 @@ # Using puppet_apply as a helper it 'works with no errors' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv', - owner => 'root', - group => 'root', } -> python::pip { 'rpyc' : ensure => '3.2.3', @@ -30,17 +34,21 @@ class { 'python' : it 'maintains pip version' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv2', - owner => 'root', - group => 'root', } -> python::pip { 'pip' : ensure => '18.0', @@ -55,17 +63,21 @@ class { 'python' : it 'works with ensure=>latest' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv3', - owner => 'root', - group => 'root', } -> python::pip { 'rpyc' : ensure => 'latest', @@ -82,17 +94,21 @@ class { 'python' : it 'works with ensure=>latest for package with underscore in its name' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv4', - owner => 'root', - group => 'root', } -> python::pip { 'int_date' : ensure => 'latest', @@ -109,20 +125,24 @@ class { 'python' : it 'works with editable=>true' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } package{ 'git' : ensure => 'present', } -> class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv5', - owner => 'root', - group => 'root', } -> python::pip { 'rpyc' : ensure => '4.1.0', @@ -139,17 +159,21 @@ class { 'python' : it 'works with == in pkgname' do pp = <<-EOS + if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { + $version = '3' + } else { + $version = 'system' + } class { 'python' : - version => 'system', + version => $version, pip => 'present', virtualenv => 'present', } -> python::virtualenv { 'venv' : ensure => 'present', + version => $version, systempkgs => false, venv_dir => '/opt/venv6', - owner => 'root', - group => 'root', } -> python::pip { 'rpyc==4.1.0' : virtualenv => '/opt/venv6', From 9376c1f81bdf60c9304507e6d2f42e5a5a9ade3a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 20:36:33 +0200 Subject: [PATCH 181/380] CentOS: Fix ordering dependency The python package resource should always be executed after the epel repository because python could come from that. epel has python34 and python36. --- manifests/install.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/install.pp b/manifests/install.pp index 026b94e9..963dbee8 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -243,6 +243,7 @@ if $python::use_epel == true { include 'epel' Class['epel'] -> Package['pip'] + Class['epel'] -> Package['python'] } } if ($venv_ensure != 'absent') and ($facts['os']['release']['full'] =~ /^6/) { From 4c5123f967ff62d7afc008debb4013c07cdb8e7f Mon Sep 17 00:00:00 2001 From: Jon-Paul Lindquist Date: Fri, 18 Oct 2019 08:45:05 -0700 Subject: [PATCH 182/380] Remove resource collector overriding pip_provider --- manifests/install.pp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 963dbee8..a00fc94c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -293,10 +293,6 @@ category => $pip_category, } - Python::Pip <| |> { - pip_provider => $pip_provider, - } - Package <| title == 'virtualenv' |> { name => $virtualenv_package, } From a6b8f4dd6b6faea0b2439d42b2f2686be8037fb9 Mon Sep 17 00:00:00 2001 From: Tomislav Dukaric Date: Wed, 3 Jul 2019 17:42:39 +0900 Subject: [PATCH 183/380] Add option for not managing python,virtualenv, pip packages. Helps in cases where other modules are already managing those packages, avoids duplicate resource definition issues. --- REFERENCE.md | 40 +++++++++++++++++++++++++++++++ manifests/init.pp | 3 +++ manifests/install.pp | 48 ++++++++++++++++++++++--------------- manifests/params.pp | 23 ++++++++++-------- spec/classes/python_spec.rb | 27 +++++++++++++++++++++ 5 files changed, 112 insertions(+), 29 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 69e58da4..069496bd 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -155,6 +155,30 @@ The default umask for invoked exec calls. Default value: `undef` +##### `manage_python_package` + +Data type: `Boolean` + + + +Default value: $python::params::manage_python_package + +##### `manage_virtualenv_package` + +Data type: `Boolean` + + + +Default value: $python::params::manage_virtualenv_package + +##### `manage_pip_package` + +Data type: `Boolean` + + + +Default value: $python::params::manage_pip_package + ##### `gunicorn_package_name` Data type: `Any` @@ -277,6 +301,14 @@ Proxy server to use for outbound connections. Default value: `undef` +##### `exec_provider` + +Data type: `String[1]` + + + +Default value: 'shell' + ## Defined types ### python::dotfile @@ -746,6 +778,14 @@ Data type: `Array[String]` Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] +##### `exec_provider` + +Data type: `String[1]` + + + +Default value: 'shell' + ### python::pyvenv Create a Python3 virtualenv using pyvenv. diff --git a/manifests/init.pp b/manifests/init.pp index 8b622683..e2071925 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -43,6 +43,9 @@ Enum['absent', 'present', 'latest'] $virtualenv = $python::params::virtualenv, Enum['absent', 'present', 'latest'] $gunicorn = $python::params::gunicorn, Boolean $manage_gunicorn = $python::params::manage_gunicorn, + Boolean $manage_python_package = $python::params::manage_python_package, + Boolean $manage_virtualenv_package = $python::params::manage_virtualenv_package, + Boolean $manage_pip_package = $python::params::manage_pip_package, $gunicorn_package_name = $python::params::gunicorn_package_name, Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']] $provider = $python::params::provider, $valid_versions = $python::params::valid_versions, diff --git a/manifests/install.pp b/manifests/install.pp index a00fc94c..6861c5e9 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -50,23 +50,29 @@ } } - package { 'python': - ensure => $python::ensure, - name => $python, + if $python::manage_python_package { + package { 'python': + ensure => $python::ensure, + name => $python, + } } - package { 'virtualenv': - ensure => $venv_ensure, - name => "${python}-virtualenv", - require => Package['python'], + if $python::manage_virtualenv_package { + package { 'virtualenv': + ensure => $venv_ensure, + name => "${python}-virtualenv", + require => Package['python'], + } } case $python::provider { 'pip': { - package { 'pip': - ensure => $pip_ensure, - require => Package['python'], + if $python::manage_pip_package { + package { 'pip': + ensure => $pip_ensure, + require => Package['python'], + } } if $pythondev { @@ -205,10 +211,12 @@ version => 'pip3', } } else { - package { 'python-pip': - ensure => $pip_ensure, - require => Package['python'], - provider => 'yum', + if $python::manage_pip_package { + package { 'python-pip': + ensure => $pip_ensure, + require => Package['python'], + provider => 'yum', + } } } if $pythondev { @@ -222,9 +230,11 @@ } default: { - package { 'pip': - ensure => $pip_ensure, - require => Package['python'], + if $python::manage_pip_package { + package { 'pip': + ensure => $pip_ensure, + require => Package['python'], + } } if $pythondev { package { 'python-dev': @@ -242,8 +252,8 @@ if $pip_ensure != 'absent' { if $python::use_epel == true { include 'epel' - Class['epel'] -> Package['pip'] - Class['epel'] -> Package['python'] + if $python::manage_pip_package { Class['epel'] -> Package['pip'] } + if $python::manage_python_package { Class['epel'] -> Package['python'] } } } if ($venv_ensure != 'absent') and ($facts['os']['release']['full'] =~ /^6/) { diff --git a/manifests/params.pp b/manifests/params.pp index 0444d756..af9bfd4d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,16 +4,19 @@ # The python Module default configuration settings. # class python::params { - $ensure = 'present' - $version = 'system' - $pip = 'present' - $dev = 'absent' - $virtualenv = 'absent' - $gunicorn = 'absent' - $manage_gunicorn = true - $provider = undef - $valid_versions = undef - $manage_scl = true + $ensure = 'present' + $version = 'system' + $pip = 'present' + $dev = 'absent' + $virtualenv = 'absent' + $gunicorn = 'absent' + $manage_gunicorn = true + $manage_python_package = true + $manage_virtualenv_package = true + $manage_pip_package = true + $provider = undef + $valid_versions = undef + $manage_scl = true if $facts['os']['family'] == 'RedHat' { if $facts['os']['name'] != 'Fedora' { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index ec1120cf..ef6c10db 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -8,6 +8,31 @@ facts end + context 'with defaults' do + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_class('python::install') } + it { is_expected.to contain_class('python::params') } + it { is_expected.to contain_class('python::config') } + it { is_expected.to contain_package('python') } + it { is_expected.to contain_package('virtualenv') } + it { is_expected.to contain_package('pip') } + end + + context 'without managing things' do + let :params do + { + manage_python_package: false, + manage_virtualenv_package: false, + manage_pip_package: false + } + end + + it { is_expected.to compile.with_all_deps } + it { is_expected.not_to contain_package('python') } + it { is_expected.not_to contain_package('virtualenv') } + it { is_expected.not_to contain_package('pip') } + end + case facts[:os]['family'] when 'Debian' @@ -37,9 +62,11 @@ context 'true' do let(:params) { { dev: 'present' } } + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'empty/default' do + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('python-dev').with_ensure('absent') } end end From c93a04f869267a39de6b221f8220c503fc480b32 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 21:57:04 +0200 Subject: [PATCH 184/380] release 4.1.0 --- CHANGELOG.md | 35 ++++++++++++++++++++++++++++++----- metadata.json | 2 +- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35c874e8..d48bfd60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v4.1.0](https://github.com/voxpupuli/puppet-python/tree/v4.1.0) (2020-04-26) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.0.0...v4.1.0) + +**Implemented enhancements:** + +- Add option for not managing python and virtualenv packages. [\#500](https://github.com/voxpupuli/puppet-python/pull/500) ([tdukaric](https://github.com/tdukaric)) + +**Fixed bugs:** + +- Wrong pip referenced inside virtualenv [\#505](https://github.com/voxpupuli/puppet-python/issues/505) +- CentOS: Fix ordering dependency [\#546](https://github.com/voxpupuli/puppet-python/pull/546) ([bastelfreak](https://github.com/bastelfreak)) +- switch from stahnma/epel to puppet/epel / Ubuntu 16.04: Execute tests on Python 3 [\#545](https://github.com/voxpupuli/puppet-python/pull/545) ([bastelfreak](https://github.com/bastelfreak)) +- Remove resource collector overriding pip\_provider [\#511](https://github.com/voxpupuli/puppet-python/pull/511) ([jplindquist](https://github.com/jplindquist)) + +**Closed issues:** + +- python3.6+ venv proper installation command [\#533](https://github.com/voxpupuli/puppet-python/issues/533) +- Virtualenv doesn't install with the right python [\#384](https://github.com/voxpupuli/puppet-python/issues/384) + +**Merged pull requests:** + +- Use voxpupuli-acceptance [\#543](https://github.com/voxpupuli/puppet-python/pull/543) ([ekohl](https://github.com/ekohl)) +- update repo links to https [\#531](https://github.com/voxpupuli/puppet-python/pull/531) ([bastelfreak](https://github.com/bastelfreak)) + ## [v4.0.0](https://github.com/voxpupuli/puppet-python/tree/v4.0.0) (2019-12-10) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v3.0.1...v4.0.0) @@ -65,7 +90,7 @@ These should not affect the functionality of the module. **Fixed bugs:** - Installing from git repo runs install on every Puppet run [\#193](https://github.com/voxpupuli/puppet-python/issues/193) -- Fix python::pip installing $editable VCS packages every Puppet run [\#491](https://github.com/voxpupuli/puppet-python/pull/491) ([wolttam](https://github.com/wolttam)) +- Fix python::pip installing $editable VCS packages every Puppet run [\#491](https://github.com/voxpupuli/puppet-python/pull/491) ([mlow](https://github.com/mlow)) - Fix $subscribe overloading [\#490](https://github.com/voxpupuli/puppet-python/pull/490) ([nward](https://github.com/nward)) - Fix version-check. [\#489](https://github.com/voxpupuli/puppet-python/pull/489) ([pillarsdotnet](https://github.com/pillarsdotnet)) - Update version validation [\#472](https://github.com/voxpupuli/puppet-python/pull/472) ([bodgit](https://github.com/bodgit)) @@ -98,7 +123,7 @@ These should not affect the functionality of the module. **Merged pull requests:** - 486 Set permissive umask. [\#487](https://github.com/voxpupuli/puppet-python/pull/487) ([pillarsdotnet](https://github.com/pillarsdotnet)) -- Update `puppetlabs/stdlib` dependency to allow 6.x and require at least 4.19.0 \(where the `fact\(\)` function was introduced\) [\#485](https://github.com/voxpupuli/puppet-python/pull/485) ([pillarsdotnet](https://github.com/pillarsdotnet)) +- Update `puppetlabs/stdlib` dependency to allow 6.x and require at least 4.19.0 \(where the `fact()` function was introduced\) [\#485](https://github.com/voxpupuli/puppet-python/pull/485) ([pillarsdotnet](https://github.com/pillarsdotnet)) - Update pip url regex to support 'git+git://\' [\#477](https://github.com/voxpupuli/puppet-python/pull/477) ([gharper](https://github.com/gharper)) - README.md: remove obsolete and redundant sections [\#453](https://github.com/voxpupuli/puppet-python/pull/453) ([kenyon](https://github.com/kenyon)) - remove .DS\_Store [\#452](https://github.com/voxpupuli/puppet-python/pull/452) ([kenyon](https://github.com/kenyon)) @@ -195,7 +220,7 @@ These should not affect the functionality of the module. **Merged pull requests:** -- Fix Python version regex in install.pp [\#410](https://github.com/voxpupuli/puppet-python/pull/410) ([fklajn-opera](https://github.com/fklajn-opera)) +- Fix Python version regex in install.pp [\#410](https://github.com/voxpupuli/puppet-python/pull/410) ([fklajn](https://github.com/fklajn)) - Remove docker nodesets [\#408](https://github.com/voxpupuli/puppet-python/pull/408) ([bastelfreak](https://github.com/bastelfreak)) - Update README compatibility section [\#405](https://github.com/voxpupuli/puppet-python/pull/405) ([rkcpi](https://github.com/rkcpi)) - add secret for forge deployment via travis [\#404](https://github.com/voxpupuli/puppet-python/pull/404) ([bastelfreak](https://github.com/bastelfreak)) @@ -225,7 +250,7 @@ These should not affect the functionality of the module. - Update gunicorn.pp - Add manage\_config\_dir [\#382](https://github.com/voxpupuli/puppet-python/pull/382) ([bc-bjoern](https://github.com/bc-bjoern)) - Support latest puppet versions [\#376](https://github.com/voxpupuli/puppet-python/pull/376) ([ghoneycutt](https://github.com/ghoneycutt)) - Add python release as available facts [\#355](https://github.com/voxpupuli/puppet-python/pull/355) ([jcpunk](https://github.com/jcpunk)) -- Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([PuppetNinja](https://github.com/PuppetNinja)) +- Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([chaozhang0326](https://github.com/chaozhang0326)) - Ensure value is a string for =~ comparison [\#342](https://github.com/voxpupuli/puppet-python/pull/342) ([ghoneycutt](https://github.com/ghoneycutt)) - add an alias to the python-dev package [\#334](https://github.com/voxpupuli/puppet-python/pull/334) ([dannygoulder](https://github.com/dannygoulder)) @@ -651,7 +676,7 @@ These should not affect the functionality of the module. **Closed issues:** -- Unable to customize `APP\_MODULE` variable in gunicorn template [\#127](https://github.com/voxpupuli/puppet-python/issues/127) +- Unable to customize `APP_MODULE` variable in gunicorn template [\#127](https://github.com/voxpupuli/puppet-python/issues/127) - New release on the Puppet forge [\#125](https://github.com/voxpupuli/puppet-python/issues/125) ## [1.7.10](https://github.com/voxpupuli/puppet-python/tree/1.7.10) (2014-09-25) diff --git a/metadata.json b/metadata.json index d30c37f1..550a52a7 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.0.1-rc0", + "version": "4.1.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 6ea41a1e5068642e626fc3ec78682897791dedd4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 26 Apr 2020 23:16:37 +0200 Subject: [PATCH 185/380] [blacksmith] Bump version to 4.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 550a52a7..af4637a8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.1.0", + "version": "4.1.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 56f519944f3a1469a6f23976524f6ab454f70e30 Mon Sep 17 00:00:00 2001 From: Philip Jones <53430719+pjonesIDBS@users.noreply.github.com> Date: Thu, 27 Feb 2020 14:51:24 +0000 Subject: [PATCH 186/380] Fixes version check for virtualenv_version This should fix issue #534 I've tested locally with success. I've tested against Virtualenv 20.0.4 and 16.7.9. The output from the fact is only the version number as was previously the case. --- lib/facter/virtualenv_version.rb | 2 +- spec/unit/facter/virtualenv_version_spec.rb | 31 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index cf717b91..5cf2e019 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -3,7 +3,7 @@ Facter.add('virtualenv_version') do setcode do if Facter::Util::Resolution.which('virtualenv') - Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{^(\d+\.\d+\.?\d*).*$})[0] + Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})[1] end end end diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb index 1d625859..3774991f 100644 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ b/spec/unit/facter/virtualenv_version_spec.rb @@ -5,18 +5,24 @@ Facter.clear end - let(:virtualenv_version_output) do + let(:virtualenv_old_version_output) do <<-EOS 12.0.7 EOS end - describe 'virtualenv_version' do + let(:virtualenv_new_version_output) do + <<-EOS +virtualenv 20.0.17 from /opt/python/lib/python3.5/site-packages/virtualenv/__init__.py +EOS + end + + describe 'virtualenv_version old' do context 'returns virtualenv version when virtualenv present' do it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with('virtualenv').returns(true) - Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_version_output) + Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_old_version_output) expect(Facter.value(:virtualenv_version)).to eq('12.0.7') end end @@ -29,4 +35,23 @@ end end end + + describe 'virtualenv_version new' do + context 'returns virtualenv version when virtualenv present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('virtualenv').returns(true) + Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_new_version_output) + expect(Facter.value(:virtualenv_version)).to eq('20.0.17') + end + end + + context 'returns nil when virtualenv not present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('virtualenv').returns(false) + expect(Facter.value(:virtualenv_version)).to eq(nil) + end + end + end end From 45d1b650259f2b0a8e40ebf84adbfc1dd8ba4871 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Apr 2020 17:31:57 +0200 Subject: [PATCH 187/380] release 4.1.1 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d48bfd60..ae195523 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v4.1.1](https://github.com/voxpupuli/puppet-python/tree/v4.1.1) (2020-04-30) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.1.0...v4.1.1) + +**Fixed bugs:** + +- Fixes for virtualenv\_version fact when virtualenv \> 20.x [\#537](https://github.com/voxpupuli/puppet-python/pull/537) ([pjonesIDBS](https://github.com/pjonesIDBS)) + ## [v4.1.0](https://github.com/voxpupuli/puppet-python/tree/v4.1.0) (2020-04-26) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.0.0...v4.1.0) diff --git a/metadata.json b/metadata.json index af4637a8..ce0d1f39 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.1.1-rc0", + "version": "4.1.1", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From ddb4e9504f3410dc61b52ca42998023ba164f520 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 30 Apr 2020 18:58:21 +0200 Subject: [PATCH 188/380] [blacksmith] Bump version to 4.1.2-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index ce0d1f39..a4896b3c 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.1.1", + "version": "4.1.2-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 4b93e9de6c6978f51be0d8f8c98c89620f6c9b18 Mon Sep 17 00:00:00 2001 From: Keith Ward Date: Mon, 20 Jul 2020 00:02:24 +0100 Subject: [PATCH 189/380] Convert unit tests to rspec rather than 'mocha' --- .sync.yml | 2 - spec/spec_helper.rb | 4 -- spec/unit/facter/pip_version_spec.rb | 8 ++-- spec/unit/facter/python_release_spec.rb | 43 +++++++++------------ spec/unit/facter/python_version_spec.rb | 42 ++++++++------------ spec/unit/facter/virtualenv_version_spec.rb | 21 +++------- 6 files changed, 43 insertions(+), 77 deletions(-) diff --git a/.sync.yml b/.sync.yml index 75d7e33a..68741032 100644 --- a/.sync.yml +++ b/.sync.yml @@ -7,7 +7,5 @@ - set: debian8-64 - set: debian9-64 - set: centos7-64 -spec/spec_helper.rb: - mock_with: ':mocha' spec/spec_helper_acceptance.rb: unmanaged: false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0fb7a799..b2b27045 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,10 +2,6 @@ # https://github.com/voxpupuli/modulesync # https://github.com/voxpupuli/modulesync_config -RSpec.configure do |c| - c.mock_with :mocha -end - # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 7401cde5..7a7c6c92 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -14,17 +14,15 @@ describe 'pip_version' do context 'returns pip version when pip present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip').returns(true) - Facter::Util::Resolution.expects(:exec).with('pip --version 2>&1').returns(pip_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('pip').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('pip --version 2>&1').and_return(pip_version_output) expect(Facter.value(:pip_version)).to eq('6.0.6') end end context 'returns nil when pip not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('pip').and_return(false) expect(Facter.value(:pip_version)).to eq(nil) end end diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index ad2dc30c..e6870b9f 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -19,17 +19,16 @@ describe 'python_release' do context 'returns Python release when `python` present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python_release)).to eq('2.7') end end context 'returns nil when `python` not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(false) + allow(Facter::Util::Resolution).to receive(:exec).and_return(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) expect(Facter.value(:python_release)).to eq(nil) end end @@ -38,39 +37,35 @@ describe 'python2_release' do context 'returns Python 2 release when `python` is present and Python 2' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python2_release)).to eq('2.7') end end context 'returns Python 2 release when `python` is Python 3 and `python2` is present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with('python2').returns(true) - Facter::Util::Resolution.expects(:exec).with('python2 -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python2 -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python2_release)).to eq('2.7') end end context 'returns nil when `python` is Python 3 and `python2` is absent' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with('python2').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) expect(Facter.value(:python2_release)).to eq(nil) end end context 'returns nil when `python2` and `python` are absent' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(false) - Facter::Util::Resolution.expects(:which).with('python2').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) expect(Facter.value(:python2_release)).to eq(nil) end end @@ -79,17 +74,15 @@ describe 'python3_release' do context 'returns Python 3 release when `python3` present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python3').returns(true) - Facter::Util::Resolution.expects(:exec).with('python3 -V 2>&1').returns(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python3 -V 2>&1').and_return(python3_version_output) expect(Facter.value(:python3_release)).to eq('3.3') end end context 'returns nil when `python3` not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python3').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(false) expect(Facter.value(:python3_release)).to eq(nil) end end diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index 039318d9..db302b27 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -19,17 +19,15 @@ describe 'python_version' do context 'returns Python version when `python` present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python_version)).to eq('2.7.9') end end context 'returns nil when `python` not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) expect(Facter.value(:python_version)).to eq(nil) end end @@ -38,39 +36,35 @@ describe 'python2_version' do context 'returns Python 2 version when `python` is present and Python 2' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python2_version)).to eq('2.7.9') end end context 'returns Python 2 version when `python` is Python 3 and `python2` is present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with('python2').returns(true) - Facter::Util::Resolution.expects(:exec).with('python2 -V 2>&1').returns(python2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python2 -V 2>&1').and_return(python2_version_output) expect(Facter.value(:python2_version)).to eq('2.7.9') end end context 'returns nil when `python` is Python 3 and `python2` is absent' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(true) - Facter::Util::Resolution.expects(:exec).with('python -V 2>&1').returns(python3_version_output) - Facter::Util::Resolution.expects(:which).with('python2').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) expect(Facter.value(:python2_version)).to eq(nil) end end context 'returns nil when `python2` and `python` are absent' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python').returns(false) - Facter::Util::Resolution.expects(:which).with('python2').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) + allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) expect(Facter.value(:python2_version)).to eq(nil) end end @@ -79,17 +73,15 @@ describe 'python3_version' do context 'returns Python 3 version when `python3` present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python3').returns(true) - Facter::Util::Resolution.expects(:exec).with('python3 -V 2>&1').returns(python3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('python3 -V 2>&1').and_return(python3_version_output) expect(Facter.value(:python3_version)).to eq('3.3.0') end end context 'returns nil when `python3` not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('python3').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(false) expect(Facter.value(:python3_version)).to eq(nil) end end diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb index 3774991f..3cfd4c99 100644 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ b/spec/unit/facter/virtualenv_version_spec.rb @@ -20,17 +20,15 @@ describe 'virtualenv_version old' do context 'returns virtualenv version when virtualenv present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('virtualenv').returns(true) - Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_old_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('virtualenv --version 2>&1').and_return(virtualenv_old_version_output) expect(Facter.value(:virtualenv_version)).to eq('12.0.7') end end context 'returns nil when virtualenv not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('virtualenv').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(false) expect(Facter.value(:virtualenv_version)).to eq(nil) end end @@ -39,19 +37,10 @@ describe 'virtualenv_version new' do context 'returns virtualenv version when virtualenv present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('virtualenv').returns(true) - Facter::Util::Resolution.expects(:exec).with('virtualenv --version 2>&1').returns(virtualenv_new_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('virtualenv --version 2>&1').and_return(virtualenv_new_version_output) expect(Facter.value(:virtualenv_version)).to eq('20.0.17') end end - - context 'returns nil when virtualenv not present' do - it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('virtualenv').returns(false) - expect(Facter.value(:virtualenv_version)).to eq(nil) - end - end end end From ce29405c6df7ac1e1912f03fcb85229efb296eee Mon Sep 17 00:00:00 2001 From: Wiebe Verweij Date: Tue, 21 Jul 2020 12:48:38 +0200 Subject: [PATCH 190/380] Add pip2 and pip3 version facts and improve handling of missing output Partly fixes #527. Signed-off-by: Wiebe Verweij --- lib/facter/pip_version.rb | 23 +++++++++++-- spec/unit/facter/pip_version_spec.rb | 50 ++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 808f1541..11db4d60 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -1,9 +1,26 @@ # Make pip version available as a fact +def get_pip_version(executable) + if Facter::Util::Resolution.which(executable) # rubocop:disable Style/GuardClause + results = Facter::Util::Resolution.exec("#{executable} --version 2>&1").match(%r{^pip (\d+\.\d+\.?\d*).*$}) + results[1] if results + end +end + Facter.add('pip_version') do setcode do - if Facter::Util::Resolution.which('pip') - Facter::Util::Resolution.exec('pip --version 2>&1').match(%r{^pip (\d+\.\d+\.?\d*).*$})[1] - end + get_pip_version 'pip' + end +end + +Facter.add('pip2_version') do + setcode do + get_pip_version 'pip2' + end +end + +Facter.add('pip3_version') do + setcode do + get_pip_version 'pip3' end end diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 7401cde5..94448b8d 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -11,6 +11,18 @@ EOS end + let(:pip2_version_output) do + <<-EOS +pip 9.0.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7) +EOS + end + + let(:pip3_version_output) do + <<-EOS +pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) +EOS + end + describe 'pip_version' do context 'returns pip version when pip present' do it do @@ -29,4 +41,42 @@ end end end + + describe 'pip2_version' do + context 'returns pip2 version when pip2 present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('pip2').returns(true) + Facter::Util::Resolution.expects(:exec).with('pip2 --version 2>&1').returns(pip2_version_output) + expect(Facter.value(:pip2_version)).to eq('9.0.1') + end + end + + context 'returns nil when pip2 not present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('pip2').returns(false) + expect(Facter.value(:pip2_version)).to eq(nil) + end + end + end + + describe 'pip3_version' do + context 'returns pip3 version when pip3 present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('pip3').returns(true) + Facter::Util::Resolution.expects(:exec).with('pip3 --version 2>&1').returns(pip3_version_output) + expect(Facter.value(:pip3_version)).to eq('18.1') + end + end + + context 'returns nil when pip3 not present' do + it do + Facter::Util::Resolution.stubs(:exec) + Facter::Util::Resolution.expects(:which).with('pip3').returns(false) + expect(Facter.value(:pip3_version)).to eq(nil) + end + end + end end From 99ab8cc93ca66e5cb1819e96856846e7a9230b3c Mon Sep 17 00:00:00 2001 From: Wiebe Verweij Date: Tue, 21 Jul 2020 12:54:38 +0200 Subject: [PATCH 191/380] Improve handling of missing output of virtualenv version fact command Partially fixes #527 Signed-off-by: Wiebe Verweij --- lib/facter/virtualenv_version.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 5cf2e019..dbaba059 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -3,7 +3,8 @@ Facter.add('virtualenv_version') do setcode do if Facter::Util::Resolution.which('virtualenv') - Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$})[1] + results = Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$}) + results[1] if results end end end From dbbd4a4f61f35b4f116af231fe68e9259c18f386 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 25 Jul 2020 14:21:11 +0200 Subject: [PATCH 192/380] modulesync 3.0.0 --- .github/SECURITY.md | 3 +++ .msync.yml | 2 +- .rubocop.yml | 3 +++ .travis.yml | 5 +++-- Gemfile | 6 +++--- spec/spec_helper_acceptance.rb | 3 +++ 6 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..cacadf22 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.msync.yml b/.msync.yml index 8864fc09..4c7999c4 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1 @@ -modulesync_config_version: '2.12.0' +modulesync_config_version: '3.0.0' diff --git a/.rubocop.yml b/.rubocop.yml index c2ebc88d..316e4ec1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -528,6 +528,9 @@ RSpec/RepeatedDescription: RSpec/NestedGroups: Enabled: False +RSpec/MultipleExpectations: + Enabled: false + # this is broken on ruby1.9 Layout/IndentHeredoc: Enabled: False diff --git a/.travis.yml b/.travis.yml index b3885153..b8ba2d89 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ --- +os: linux dist: bionic language: ruby cache: bundler @@ -7,7 +8,7 @@ before_install: - bundle --version script: - 'bundle exec rake $CHECK' -matrix: +jobs: fast_finish: true include: - rvm: 2.4.4 @@ -76,7 +77,7 @@ notifications: - "chat.freenode.org#voxpupuli-notifications" deploy: provider: puppetforge - user: puppet + username: puppet password: secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" on: diff --git a/Gemfile b/Gemfile index 32c31146..8592cd61 100644 --- a/Gemfile +++ b/Gemfile @@ -11,9 +11,9 @@ def location_for(place, fake_version = nil) end group :test do - gem 'voxpupuli-test', '>= 1.0.0', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false + gem 'voxpupuli-test', '~> 2.0', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false end group :development do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index ffbdaf47..bec34fdd 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,6 @@ +# This file is completely managed via modulesync require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker + +Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From 51de87bdbacff3d374552a7c6cf86e162d1941d0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 25 Jul 2020 20:06:19 +0200 Subject: [PATCH 193/380] puppet-lint: autofix --- manifests/config.pp | 2 -- manifests/dotfile.pp | 2 +- manifests/gunicorn.pp | 1 - manifests/init.pp | 16 +++++++--------- manifests/install.pp | 6 +----- manifests/params.pp | 4 ++-- manifests/pip.pp | 17 ++++++++--------- manifests/pip/bootstrap.pp | 4 ++-- manifests/pyvenv.pp | 4 ++-- manifests/requirements.pp | 3 +-- manifests/virtualenv.pp | 2 +- 11 files changed, 25 insertions(+), 36 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 73a346d7..cbb466f1 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -5,7 +5,6 @@ # include python::config # class python::config { - Class['python::install'] -> Python::Pip <| |> Class['python::install'] -> Python::Requirements <| |> Class['python::install'] -> Python::Virtualenv <| |> @@ -27,5 +26,4 @@ } } } - } diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 47556fea..e42106c1 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -34,7 +34,7 @@ exec { "create ${title}'s parent dir": command => "install -o ${owner} -g ${group} -d ${parent_dir}", - path => [ '/usr/bin', '/bin', '/usr/local/bin', ], + path => ['/usr/bin', '/bin', '/usr/local/bin',], creates => $parent_dir, } diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 9daa7ff1..d9625a04 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -79,5 +79,4 @@ content => template($template), } } - } diff --git a/manifests/init.pp b/manifests/init.pp index e2071925..468725be 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -49,11 +49,11 @@ $gunicorn_package_name = $python::params::gunicorn_package_name, Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']] $provider = $python::params::provider, $valid_versions = $python::params::valid_versions, - Hash $python_pips = { }, - Hash $python_virtualenvs = { }, - Hash $python_pyvenvs = { }, - Hash $python_requirements = { }, - Hash $python_dotfiles = { }, + Hash $python_pips = {}, + Hash $python_virtualenvs = {}, + Hash $python_pyvenvs = {}, + Hash $python_requirements = {}, + Hash $python_dotfiles = {}, Boolean $use_epel = $python::params::use_epel, $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, Stdlib::Httpurl $anaconda_installer_url = $python::params::anaconda_installer_url, @@ -61,7 +61,6 @@ Boolean $manage_scl = $python::params::manage_scl, Optional[Pattern[/[0-7]{1,4}/]] $umask = undef, ) inherits python::params { - $exec_prefix = $provider ? { 'scl' => "/usr/bin/scl enable ${version} -- ", 'rhscl' => "/usr/bin/scl enable ${version} -- ", @@ -69,12 +68,12 @@ } unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])*/, - /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { + /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { fail("version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6' )") } # Module compatibility check - $compatible = [ 'Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX' ] + $compatible = ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX'] if ! ($facts['os']['family'] in $compatible) { fail("Module is not compatible with ${facts['os']['name']}") } @@ -96,5 +95,4 @@ create_resources('python::virtualenv', $python_virtualenvs) create_resources('python::requirements', $python_requirements) create_resources('python::dotfile', $python_dotfiles) - } diff --git a/manifests/install.pp b/manifests/install.pp index 6861c5e9..fd063cdf 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -5,7 +5,6 @@ # include python::install # class python::install { - $python = $python::version ? { 'system' => 'python', 'pypy' => 'pypy', @@ -67,7 +66,6 @@ case $python::provider { 'pip': { - if $python::manage_pip_package { package { 'pip': ensure => $pip_ensure, @@ -208,7 +206,7 @@ 'AIX': { if String($python::version) =~ /^python3/ { class { 'python::pip::bootstrap': - version => 'pip3', + version => 'pip3', } } else { if $python::manage_pip_package { @@ -227,7 +225,6 @@ provider => 'yum', } } - } default: { if $python::manage_pip_package { @@ -243,7 +240,6 @@ alias => $pythondev, } } - } } diff --git a/manifests/params.pp b/manifests/params.pp index af9bfd4d..8ff6a669 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -34,8 +34,8 @@ } $pip_lookup_path = $facts['os']['family'] ? { - 'AIX' => [ '/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/' ], - default => [ '/bin', '/usr/bin', '/usr/local/bin' ] + 'AIX' => ['/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/'], + default => ['/bin', '/usr/bin', '/usr/local/bin'] } $gunicorn_package_name = $facts['os']['family'] ? { diff --git a/manifests/pip.pp b/manifests/pip.pp index fdafcb12..8f09c95d 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -68,7 +68,7 @@ String[1] $log_dir = '/tmp', Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], String[1] $exec_provider = 'shell', -){ +) { $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') @@ -111,9 +111,9 @@ } $pypi_index = $index ? { - false => '', - default => "--index-url=${index}", - } + false => '', + default => "--index-url=${index}", + } $proxy_flag = $proxy ? { undef => '', @@ -204,15 +204,15 @@ # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", - ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', - ' | tr -d "[:space:]"']) + ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + ' | tr -d "[:space:]"']) # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" $installed_version = join(["${pip_env} freeze --all", - " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", - " | tr -d '[:space:]'"]) + " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", + " | tr -d '[:space:]'"]) $command = "${pip_install} --upgrade ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" @@ -243,5 +243,4 @@ path => $_path, provider => $exec_provider, } - } diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index 7dcbc2b4..1b69c8ae 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -26,8 +26,8 @@ $environ = $http_proxy ? { undef => [], default => $facts['os']['family'] ? { - 'AIX' => [ "http_proxy=${http_proxy}", "https_proxy=${http_proxy}" ], - default => [ "HTTP_PROXY=${http_proxy}", "HTTPS_PROXY=${http_proxy}" ], + 'AIX' => ["http_proxy=${http_proxy}", "https_proxy=${http_proxy}"], + default => ["HTTP_PROXY=${http_proxy}", "HTTPS_PROXY=${http_proxy}"], } } diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index a9b00721..8b8d59d5 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -29,7 +29,7 @@ $owner = 'root', $group = 'root', $mode = '0755', - $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], + $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin'], $environment = [], ) { include python @@ -44,7 +44,7 @@ $normalized_python_version = sprintf('%s.%s', $python_version_parts[0], $python_version_parts[1]) # Debian splits the venv module into a seperate package - if ( $facts['os']['family'] == 'Debian'){ + if ( $facts['os']['family'] == 'Debian') { $python3_venv_package="python${normalized_python_version}-venv" case $facts['os']['distro']['codename'] { 'xenial','bionic','cosmic','disco', diff --git a/manifests/requirements.pp b/manifests/requirements.pp index e1f65878..e0fbcf2b 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -42,7 +42,6 @@ $log_dir = '/tmp', $timeout = 1800, ) { - include python if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { @@ -81,7 +80,7 @@ # the same requirements file. if !defined(File[$requirements]) and $manage_requirements == true { file { $requirements: - ensure => present, + ensure => file, mode => '0644', owner => $owner_real, group => $group_real, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ebc22498..e19cfa3b 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -44,7 +44,7 @@ $mode = '0755', Optional[Stdlib::HTTPUrl] $proxy = undef, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin' ], + $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin'], $cwd = undef, $timeout = 1800, $pip_args = '', From 47f56112cca4aef71fab22a48d2717f81631ca6d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 Sep 2020 20:09:05 +0200 Subject: [PATCH 194/380] rubocop: autofix --- spec/acceptance/facts_test_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index af136015..39c1ad83 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -18,7 +18,7 @@ class { 'python' : EOS # rubocop:disable RSpec/RepeatedExample - it 'outputs python facts when not installed' do # rubocop:disable RSpec/MultipleExpectations + it 'outputs python facts when not installed' do apply_manifest(fact_notices, catch_failures: true) do |r| expect(r.stdout).to match(%r{python_version: \S+}) expect(r.stdout).to match(%r{pip_version: \S+}) @@ -31,7 +31,7 @@ class { 'python' : apply_manifest(install_python, catch_failures: true) end - it 'outputs python facts when installed' do # rubocop:disable RSpec/MultipleExpectations + it 'outputs python facts when installed' do apply_manifest(fact_notices, catch_failures: true) do |r| expect(r.stdout).to match(%r{python_version: \S+}) expect(r.stdout).to match(%r{pip_version: \S+}) From 00e741931b96fc01b8bde30e769d4a6b475ea466 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 13 Sep 2020 13:30:57 +0200 Subject: [PATCH 195/380] Fix rspec fact tests https://github.com/voxpupuli/puppet-python/pull/555 introduced new tests. In the same time we adjusted our test setup on the master branch and #555 wasn't rebased before merging. This PR fixes the tests. --- spec/unit/facter/pip_version_spec.rb | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 0dd75ed1..379323ed 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -43,17 +43,15 @@ describe 'pip2_version' do context 'returns pip2 version when pip2 present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip2').returns(true) - Facter::Util::Resolution.expects(:exec).with('pip2 --version 2>&1').returns(pip2_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('pip2 --version 2>&1').and_return(pip2_version_output) expect(Facter.value(:pip2_version)).to eq('9.0.1') end end context 'returns nil when pip2 not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip2').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(false) expect(Facter.value(:pip2_version)).to eq(nil) end end @@ -62,17 +60,15 @@ describe 'pip3_version' do context 'returns pip3 version when pip3 present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip3').returns(true) - Facter::Util::Resolution.expects(:exec).with('pip3 --version 2>&1').returns(pip3_version_output) + allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(true) + allow(Facter::Util::Resolution).to receive(:exec).with('pip3 --version 2>&1').and_return(pip3_version_output) expect(Facter.value(:pip3_version)).to eq('18.1') end end context 'returns nil when pip3 not present' do it do - Facter::Util::Resolution.stubs(:exec) - Facter::Util::Resolution.expects(:which).with('pip3').returns(false) + allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(false) expect(Facter.value(:pip3_version)).to eq(nil) end end From 18782f5681fb37862a36c3c8c78e1a38fa02dffa Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 Sep 2020 20:28:12 +0200 Subject: [PATCH 196/380] Drop EOL Debian 8 --- .sync.yml | 1 - .travis.yml | 8 -------- manifests/pyvenv.pp | 3 +-- metadata.json | 1 - spec/defines/pyvenv_spec.rb | 2 +- 5 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.sync.yml b/.sync.yml index 68741032..57c710b5 100644 --- a/.sync.yml +++ b/.sync.yml @@ -4,7 +4,6 @@ docker_sets: - set: ubuntu1604-64 - set: ubuntu1804-64 - - set: debian8-64 - set: debian9-64 - set: centos7-64 spec/spec_helper_acceptance.rb: diff --git a/.travis.yml b/.travis.yml index b8ba2d89..45f5db54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,14 +39,6 @@ jobs: bundler_args: --without development release env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - rvm: 2.5.3 bundler_args: --without development release env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 8b8d59d5..5b0c91f3 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -47,8 +47,7 @@ if ( $facts['os']['family'] == 'Debian') { $python3_venv_package="python${normalized_python_version}-venv" case $facts['os']['distro']['codename'] { - 'xenial','bionic','cosmic','disco', - 'jessie','stretch','buster': { + 'xenial','bionic','cosmic','disco','stretch','buster': { ensure_packages ($python3_venv_package) Package[$python3_venv_package] -> File[$venv_dir] } diff --git a/metadata.json b/metadata.json index a4896b3c..80701c0e 100644 --- a/metadata.json +++ b/metadata.json @@ -32,7 +32,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "8", "9" ] }, diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index aee88e8a..36452839 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -18,7 +18,7 @@ it { is_expected.to contain_file('/opt/env') } it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } - if %w[xenial bionic cosmic disco jessie stretch buster].include?(facts[:lsbdistcodename]) + if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename]) it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } end end From 73823252736a2977c754f49e7c321300de14dfcd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 13 Sep 2020 13:48:44 +0200 Subject: [PATCH 197/380] Drop CentOS 6 support We don't run acceptance tests for CentOS 6 since a long time. In https://github.com/voxpupuli/puppet-python/pull/564 we tried to enable the acceptance tests again but they don't work. * CentOS 6 ships Python 2.6 which is EOL since ages * CentOS 6 is EOL by end of the year anyway * We already support CentOS 7 --- metadata.json | 1 - spec/classes/python_spec.rb | 147 ------------------------------------ 2 files changed, 148 deletions(-) diff --git a/metadata.json b/metadata.json index a4896b3c..de0d6e2c 100644 --- a/metadata.json +++ b/metadata.json @@ -25,7 +25,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "6", "7" ] }, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index ef6c10db..92712bdd 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -223,153 +223,6 @@ end when 'RedHat', 'CentOS' case facts[:os]['release']['major'] - when '5' - # written for RHEL 5 - context 'on a Redhat OS' do - it { is_expected.to contain_class('python::install') } - # Base debian packages. - it { is_expected.to contain_package('python') } - it { is_expected.to contain_package('python-dev').with_name('python-devel') } - it { is_expected.to contain_package('python-dev').with_alias('python-devel') } - it { is_expected.to contain_package('pip') } - it { is_expected.to contain_package('pip').with_name('python-pip') } - # Basic python packages (from pip) - it { is_expected.to contain_package('virtualenv') } - - describe 'EPEL may be needed on EL' do - context 'default/empty' do - it { is_expected.to contain_class('epel') } - end - end - - describe 'with python::dev' do - context 'true' do - let(:params) { { dev: 'present' } } - - it { is_expected.to contain_package('python-dev').with_ensure('present') } - end - context 'empty/default' do - it { is_expected.to contain_package('python-dev').with_ensure('absent') } - end - end - - describe 'with manage_gunicorn' do - context 'true' do - let(:params) { { manage_gunicorn: true } } - - it { is_expected.to contain_package('gunicorn') } - end - context 'empty args' do - # let(:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package('gunicorn') } - end - context 'false' do - let(:params) { { manage_gunicorn: false } } - - it { is_expected.not_to contain_package('gunicorn') } - end - end - - describe 'with python::provider' do - context 'pip' do - let(:params) { { provider: 'pip' } } - - it { - is_expected.to contain_package('virtualenv').with( - 'provider' => 'pip' - ) - } - it { - is_expected.to contain_package('pip').with( - 'provider' => 'pip' - ) - } - end - - context 'anaconda' do - let(:params) { { provider: 'anaconda', anaconda_install_path: '/opt/test_path' } } - - it { - is_expected.to contain_file('/var/tmp/anaconda_installer.sh') - is_expected.to contain_exec('install_anaconda_python').with_command('/var/tmp/anaconda_installer -b -p /opt/test_path') - is_expected.to contain_exec('install_anaconda_virtualenv').with_command('/opt/test_path/bin/pip install virtualenv') - } - end - - # python::provider - context 'default' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv') } - it { is_expected.to contain_package('pip') } - - describe 'with python::virtualenv' do - context 'true' do - let(:params) { { provider: '', virtualenv: 'present' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('present') } - end - end - - describe 'with python::virtualenv' do - context 'default/empty' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('absent') } - end - end - end - end - - describe 'with python::dev' do - context 'true' do - let(:params) { { dev: 'present' } } - - it { is_expected.to contain_package('python-dev').with_ensure('present') } - end - context 'default/empty' do - it { is_expected.to contain_package('python-dev').with_ensure('absent') } - end - end - end - when '6' - - context 'on a Redhat 6 OS' do - it { is_expected.to contain_class('python::install') } - it { is_expected.to contain_package('pip').with_name('python-pip') } - - describe 'with python::provider' do - context 'scl' do - describe 'with version' do - context '3.6 SCL meta package' do - let(:params) { { version: 'rh-python36' } } - - it { is_expected.to compile.with_all_deps } - end - context '3.6 SCL python package' do - let(:params) { { version: 'rh-python36-python' } } - - it { is_expected.to compile.with_all_deps } - end - end - describe 'with manage_scl' do - context 'true' do - let(:params) { { provider: 'scl', manage_scl: true } } - - it { is_expected.to contain_package('centos-release-scl') } - it { is_expected.to contain_package('scl-utils') } - end - context 'false' do - let(:params) { { provider: 'scl', manage_scl: false } } - - it { is_expected.not_to contain_package('centos-release-scl') } - it { is_expected.not_to contain_package('scl-utils') } - end - end - end - end - end - when '7' context 'on a Redhat 7 OS' do From 8c98165c4f973c6de243db1feb4f41617d0e93ef Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 12 Sep 2020 20:25:24 +0200 Subject: [PATCH 198/380] delete legacy nodesets Those nodesets aren't used anymore, so we can safely delete them. --- spec/acceptance/nodesets/archlinux-2-x64.yml | 13 ------- spec/acceptance/nodesets/centos-59-x64.yml | 10 ------ spec/acceptance/nodesets/centos-64-x64-pe.yml | 12 ------- spec/acceptance/nodesets/centos-65-x64.yml | 10 ------ spec/acceptance/nodesets/debian-70rc1-x64.yml | 10 ------ spec/acceptance/nodesets/debian-73-x64.yml | 11 ------ spec/acceptance/nodesets/default.yml | 11 ------ .../nodesets/ec2/amazonlinux-2016091.yml | 31 ----------------- .../nodesets/ec2/image_templates.yaml | 34 ------------------- spec/acceptance/nodesets/ec2/rhel-73-x64.yml | 29 ---------------- .../nodesets/ec2/sles-12sp2-x64.yml | 29 ---------------- .../nodesets/ec2/ubuntu-1604-x64.yml | 29 ---------------- .../nodesets/ec2/windows-2016-base-x64.yml | 29 ---------------- .../nodesets/ubuntu-server-10044-x64.yml | 10 ------ .../nodesets/ubuntu-server-12042-x64.yml | 10 ------ 15 files changed, 278 deletions(-) delete mode 100644 spec/acceptance/nodesets/archlinux-2-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-59-x64.yml delete mode 100644 spec/acceptance/nodesets/centos-64-x64-pe.yml delete mode 100644 spec/acceptance/nodesets/centos-65-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-70rc1-x64.yml delete mode 100644 spec/acceptance/nodesets/debian-73-x64.yml delete mode 100644 spec/acceptance/nodesets/default.yml delete mode 100644 spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml delete mode 100644 spec/acceptance/nodesets/ec2/image_templates.yaml delete mode 100644 spec/acceptance/nodesets/ec2/rhel-73-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml delete mode 100644 spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-10044-x64.yml delete mode 100644 spec/acceptance/nodesets/ubuntu-server-12042-x64.yml diff --git a/spec/acceptance/nodesets/archlinux-2-x64.yml b/spec/acceptance/nodesets/archlinux-2-x64.yml deleted file mode 100644 index 89b63003..00000000 --- a/spec/acceptance/nodesets/archlinux-2-x64.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -HOSTS: - archlinux-2-x64: - roles: - - master - platform: archlinux-2-x64 - box: archlinux/archlinux - hypervisor: vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/centos-59-x64.yml b/spec/acceptance/nodesets/centos-59-x64.yml deleted file mode 100644 index 2ad90b86..00000000 --- a/spec/acceptance/nodesets/centos-59-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - centos-59-x64: - roles: - - master - platform: el-5-x86_64 - box : centos-59-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: git diff --git a/spec/acceptance/nodesets/centos-64-x64-pe.yml b/spec/acceptance/nodesets/centos-64-x64-pe.yml deleted file mode 100644 index 7d9242f1..00000000 --- a/spec/acceptance/nodesets/centos-64-x64-pe.yml +++ /dev/null @@ -1,12 +0,0 @@ -HOSTS: - centos-64-x64: - roles: - - master - - database - - dashboard - platform: el-6-x86_64 - box : centos-64-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: pe diff --git a/spec/acceptance/nodesets/centos-65-x64.yml b/spec/acceptance/nodesets/centos-65-x64.yml deleted file mode 100644 index 4e2cb809..00000000 --- a/spec/acceptance/nodesets/centos-65-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - centos-65-x64: - roles: - - master - platform: el-6-x86_64 - box : centos-65-x64-vbox436-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/debian-70rc1-x64.yml b/spec/acceptance/nodesets/debian-70rc1-x64.yml deleted file mode 100644 index 4b55677f..00000000 --- a/spec/acceptance/nodesets/debian-70rc1-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - debian-70rc1-x64: - roles: - - master - platform: debian-70rc1-x64 - box : debian-70rc1-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/debian-73-x64.yml b/spec/acceptance/nodesets/debian-73-x64.yml deleted file mode 100644 index d7143455..00000000 --- a/spec/acceptance/nodesets/debian-73-x64.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - debian-73-x64: - roles: - - master - platform: debian-7-amd64 - box : debian-73-x64-virtualbox-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box - hypervisor : vagrant -CONFIG: - log_level: debug - type: git \ No newline at end of file diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml deleted file mode 100644 index 45af9893..00000000 --- a/spec/acceptance/nodesets/default.yml +++ /dev/null @@ -1,11 +0,0 @@ -HOSTS: - ubuntu-server-12042-x64: - roles: - - master - platform: ubuntu-server-12.04-amd64 - box : ubuntu-server-12042-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: foss - vagrant_ssh_port_random: true diff --git a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml deleted file mode 100644 index 19dd43ed..00000000 --- a/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -# Amazon Linux is not a RHEL clone. -# -HOSTS: - amazonlinux-2016091-x64: - roles: - - master - platform: centos-6-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: amazonlinux-2016091-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/image_templates.yaml b/spec/acceptance/nodesets/ec2/image_templates.yaml deleted file mode 100644 index e50593ee..00000000 --- a/spec/acceptance/nodesets/ec2/image_templates.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -# Hint: image IDs (ami-*) for the same image are different per location. -# -AMI: - # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type - amazonlinux-2016091-eu-central-1: - :image: - :aio: ami-af0fc0c0 - :region: eu-central-1 - # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type - rhel-73-eu-central-1: - :image: - :aio: ami-e4c63e8b - :region: eu-central-1 - # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type - sles-12sp2-eu-central-1: - :image: - :aio: ami-c425e4ab - :region: eu-central-1 - # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ubuntu-1604-eu-central-1: - :image: - :aio: ami-fe408091 - :region: eu-central-1 - # Microsoft Windows Server 2016 Base - windows-2016-base-eu-central-1: - :image: - :aio: ami-88ec20e7 - :region: eu-central-1 diff --git a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/spec/acceptance/nodesets/ec2/rhel-73-x64.yml deleted file mode 100644 index 7fac8236..00000000 --- a/spec/acceptance/nodesets/ec2/rhel-73-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - rhel-73-x64: - roles: - - master - platform: el-7-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: rhel-73-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml deleted file mode 100644 index 8542154d..00000000 --- a/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - sles-12sp2-x64: - roles: - - master - platform: sles-12-x86_64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: sles-12sp2-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml deleted file mode 100644 index 9cf59d59..00000000 --- a/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - ubuntu-1604-x64: - roles: - - master - platform: ubuntu-16.04-amd64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: ubuntu-1604-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ubuntu -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml deleted file mode 100644 index 0932e29c..00000000 --- a/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config -# -# Additional ~/.fog config file with AWS EC2 credentials -# required. -# -# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md -# -HOSTS: - windows-2016-base-x64: - roles: - - master - platform: windows-2016-64 - hypervisor: ec2 - # refers to image_tempaltes.yaml AMI[vmname] entry: - vmname: windows-2016-base-eu-central-1 - # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: - snapshot: aio - # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): - amisize: t2.micro - # required so that beaker sanitizes sshd_config and root authorized_keys: - user: ec2-user -CONFIG: - type: aio - :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml -... -# vim: syntax=yaml diff --git a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml deleted file mode 100644 index 5ca1514e..00000000 --- a/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - ubuntu-server-10044-x64: - roles: - - master - platform: ubuntu-10.04-amd64 - box : ubuntu-server-10044-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml deleted file mode 100644 index d065b304..00000000 --- a/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml +++ /dev/null @@ -1,10 +0,0 @@ -HOSTS: - ubuntu-server-12042-x64: - roles: - - master - platform: ubuntu-12.04-amd64 - box : ubuntu-server-12042-x64-vbox4210-nocm - box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box - hypervisor : vagrant -CONFIG: - type: foss From f9a10b25ab7982fbc5e13b7c433fa7ec719ee75a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 23 Sep 2020 12:52:04 +0200 Subject: [PATCH 199/380] release 5.0.0 --- CHANGELOG.md | 88 +++++++++++++++++++-------------------------------- metadata.json | 2 +- 2 files changed, 34 insertions(+), 56 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae195523..efc7cd54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v5.0.0](https://github.com/voxpupuli/puppet-python/tree/v5.0.0) (2020-09-23) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.1.1...v5.0.0) + +**Breaking changes:** + +- Drop CentOS 6 support [\#566](https://github.com/voxpupuli/puppet-python/pull/566) ([bastelfreak](https://github.com/bastelfreak)) +- Drop EOL Debian 8 [\#563](https://github.com/voxpupuli/puppet-python/pull/563) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- Fix undefined method error in facts [\#555](https://github.com/voxpupuli/puppet-python/pull/555) ([wiebe](https://github.com/wiebe)) + +**Closed issues:** + +- "warning: already initialized constant PIP\_VERSION" when upgrading to agent 6.15.0 [\#553](https://github.com/voxpupuli/puppet-python/issues/553) +- "undefined method \[\]" in pip\_version and virtualenv\_version facts [\#527](https://github.com/voxpupuli/puppet-python/issues/527) +- Deprecation Warnings - Mocha mock\_with [\#432](https://github.com/voxpupuli/puppet-python/issues/432) + +**Merged pull requests:** + +- delete legacy nodesets [\#562](https://github.com/voxpupuli/puppet-python/pull/562) ([bastelfreak](https://github.com/bastelfreak)) +- modulesync 3.0.0 & puppet-lint updates [\#556](https://github.com/voxpupuli/puppet-python/pull/556) ([bastelfreak](https://github.com/bastelfreak)) +- Convert unit tests to rspec rather than 'mocha' [\#554](https://github.com/voxpupuli/puppet-python/pull/554) ([KeithWard](https://github.com/KeithWard)) + ## [v4.1.1](https://github.com/voxpupuli/puppet-python/tree/v4.1.1) (2020-04-30) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.1.0...v4.1.1) @@ -258,7 +283,7 @@ These should not affect the functionality of the module. - Update gunicorn.pp - Add manage\_config\_dir [\#382](https://github.com/voxpupuli/puppet-python/pull/382) ([bc-bjoern](https://github.com/bc-bjoern)) - Support latest puppet versions [\#376](https://github.com/voxpupuli/puppet-python/pull/376) ([ghoneycutt](https://github.com/ghoneycutt)) - Add python release as available facts [\#355](https://github.com/voxpupuli/puppet-python/pull/355) ([jcpunk](https://github.com/jcpunk)) -- Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([chaozhang0326](https://github.com/chaozhang0326)) +- Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([puppetninja](https://github.com/puppetninja)) - Ensure value is a string for =~ comparison [\#342](https://github.com/voxpupuli/puppet-python/pull/342) ([ghoneycutt](https://github.com/ghoneycutt)) - add an alias to the python-dev package [\#334](https://github.com/voxpupuli/puppet-python/pull/334) ([dannygoulder](https://github.com/dannygoulder)) @@ -276,7 +301,7 @@ These should not affect the functionality of the module. ## [1.18.1](https://github.com/voxpupuli/puppet-python/tree/1.18.1) (2016-12-08) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.2...1.18.1) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.18.0...1.18.1) **Closed issues:** @@ -288,23 +313,15 @@ These should not affect the functionality of the module. - Add name of package to pip uninstall command [\#340](https://github.com/voxpupuli/puppet-python/pull/340) ([dontreboot](https://github.com/dontreboot)) - EPEL only makes sense on RH systems but not Fedora [\#297](https://github.com/voxpupuli/puppet-python/pull/297) ([jcpunk](https://github.com/jcpunk)) -## [2.4.2](https://github.com/voxpupuli/puppet-python/tree/2.4.2) (2016-10-28) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.18.0...2.4.2) - ## [1.18.0](https://github.com/voxpupuli/puppet-python/tree/1.18.0) (2016-10-12) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.1...1.18.0) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.17.0...1.18.0) **Merged pull requests:** - Allow failure for Ruby 2.3.1 [\#337](https://github.com/voxpupuli/puppet-python/pull/337) ([ghoneycutt](https://github.com/ghoneycutt)) - Add support, tests and documentation for Gentoo [\#335](https://github.com/voxpupuli/puppet-python/pull/335) ([optiz0r](https://github.com/optiz0r)) -## [2.4.1](https://github.com/voxpupuli/puppet-python/tree/2.4.1) (2016-09-19) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.17.0...2.4.1) - ## [1.17.0](https://github.com/voxpupuli/puppet-python/tree/1.17.0) (2016-09-16) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.16.0...1.17.0) @@ -320,24 +337,12 @@ These should not affect the functionality of the module. ## [1.16.0](https://github.com/voxpupuli/puppet-python/tree/1.16.0) (2016-09-10) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.4.0...1.16.0) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.15.0...1.16.0) **Merged pull requests:** - RHSCL Repository installation made optional [\#328](https://github.com/voxpupuli/puppet-python/pull/328) ([diLLec](https://github.com/diLLec)) -## [2.4.0](https://github.com/voxpupuli/puppet-python/tree/2.4.0) (2016-09-04) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.3.1...2.4.0) - -## [2.3.1](https://github.com/voxpupuli/puppet-python/tree/2.3.1) (2016-08-29) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.3.0...2.3.1) - -## [2.3.0](https://github.com/voxpupuli/puppet-python/tree/2.3.0) (2016-08-29) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.15.0...2.3.0) - ## [1.15.0](https://github.com/voxpupuli/puppet-python/tree/1.15.0) (2016-08-24) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.14.2...1.15.0) @@ -374,16 +379,12 @@ These should not affect the functionality of the module. ## [1.14.0](https://github.com/voxpupuli/puppet-python/tree/1.14.0) (2016-07-20) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.2.1...1.14.0) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.13.0...1.14.0) **Merged pull requests:** - Fix regex for pip package versions [\#317](https://github.com/voxpupuli/puppet-python/pull/317) ([mdean](https://github.com/mdean)) -## [2.2.1](https://github.com/voxpupuli/puppet-python/tree/2.2.1) (2016-07-20) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.13.0...2.2.1) - ## [1.13.0](https://github.com/voxpupuli/puppet-python/tree/1.13.0) (2016-07-18) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.2.0...1.13.0) @@ -408,23 +409,7 @@ These should not affect the functionality of the module. ## [2.2.0](https://github.com/voxpupuli/puppet-python/tree/2.2.0) (2016-05-31) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.1.0...2.2.0) - -## [2.1.0](https://github.com/voxpupuli/puppet-python/tree/2.1.0) (2016-05-29) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.2...2.1.0) - -## [2.0.2](https://github.com/voxpupuli/puppet-python/tree/2.0.2) (2016-05-22) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.1...2.0.2) - -## [2.0.1](https://github.com/voxpupuli/puppet-python/tree/2.0.1) (2016-05-19) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.0.0...2.0.1) - -## [2.0.0](https://github.com/voxpupuli/puppet-python/tree/2.0.0) (2016-05-19) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.12.0...2.0.0) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.12.0...2.2.0) **Closed issues:** @@ -494,12 +479,13 @@ These should not affect the functionality of the module. ## [1.9.8](https://github.com/voxpupuli/puppet-python/tree/1.9.8) (2015-09-19) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.7...1.9.8) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.6...1.9.8) **Closed issues:** - Unable to install pip using pip provider [\#243](https://github.com/voxpupuli/puppet-python/issues/243) - Not possible to install latest version of Python [\#240](https://github.com/voxpupuli/puppet-python/issues/240) +- Exec\<| tag == 'python-virtualenv' |\> changes and breaks the API [\#230](https://github.com/voxpupuli/puppet-python/issues/230) **Merged pull requests:** @@ -514,14 +500,6 @@ These should not affect the functionality of the module. - Check that we have results before returning a value [\#238](https://github.com/voxpupuli/puppet-python/pull/238) ([xaque208](https://github.com/xaque208)) - Adjust test code to pass syntax checker [\#237](https://github.com/voxpupuli/puppet-python/pull/237) ([fluential](https://github.com/fluential)) -## [1.9.7](https://github.com/voxpupuli/puppet-python/tree/1.9.7) (2015-08-21) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.6...1.9.7) - -**Closed issues:** - -- Exec\<| tag == 'python-virtualenv' |\> changes and breaks the API [\#230](https://github.com/voxpupuli/puppet-python/issues/230) - ## [1.9.6](https://github.com/voxpupuli/puppet-python/tree/1.9.6) (2015-08-01) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.5...1.9.6) diff --git a/metadata.json b/metadata.json index 2150a810..f45228f4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "4.1.2-rc0", + "version": "5.0.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From d1141392858e93413110c4f7a58f0e848a738744 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 23 Sep 2020 21:41:52 +0200 Subject: [PATCH 200/380] [blacksmith] Bump version to 5.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index f45228f4..599e071f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "5.0.0", + "version": "5.0.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 0b5456eba39b7e00d6cc8c2baab8bf7af411467e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 2 Oct 2020 13:17:44 +0200 Subject: [PATCH 201/380] Add acceptance test for managing Python 3 --- spec/acceptance/class_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index c75207f1..82f7721b 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -13,4 +13,32 @@ class { 'python': } apply_manifest(pp, catch_changes: true) end end + context 'installing python 3' do + # Using puppet_apply as a helper + it 'works with no errors' do + pp = <<-EOS + class { 'python': + ensure => 'present', + version => '3', + pip => 'present', + dev => 'present', + virtualenv => 'present', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + fact_notices = <<-EOS + notify{"pip_version: ${facts['pip3_version']}":} + notify{"python_version: ${facts['python3_version']}":} + EOS + it 'outputs python facts when not installed' do + apply_manifest(fact_notices, catch_failures: true) do |r| + expect(r.stdout).to match(%r{python_version: 3\.\S+}) + expect(r.stdout).to match(%r{pip_version: \S+}) + end + end + end end From a8069d5fa83dbc313338329a533b74098a3424cc Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 2 Oct 2020 14:09:59 +0200 Subject: [PATCH 202/380] Add Debian 10 support --- .sync.yml | 1 + .travis.yml | 8 ++++++++ metadata.json | 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.sync.yml b/.sync.yml index 57c710b5..b3ef79fa 100644 --- a/.sync.yml +++ b/.sync.yml @@ -5,6 +5,7 @@ - set: ubuntu1604-64 - set: ubuntu1804-64 - set: debian9-64 + - set: debian10-64 - set: centos7-64 spec/spec_helper_acceptance.rb: unmanaged: false diff --git a/.travis.yml b/.travis.yml index 45f5db54..bacdfa8a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,14 @@ jobs: bundler_args: --without development release env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker + services: docker - rvm: 2.5.3 bundler_args: --without development release env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker diff --git a/metadata.json b/metadata.json index 599e071f..69895173 100644 --- a/metadata.json +++ b/metadata.json @@ -31,7 +31,8 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "9" + "9", + "10" ] }, { From d455ef153ba95f4da1157e15e68aaf98ed99c5ff Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 2 Oct 2020 14:53:04 +0200 Subject: [PATCH 203/380] tests: separate contexts with newline --- spec/acceptance/class_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 82f7721b..09ced05e 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -13,6 +13,7 @@ class { 'python': } apply_manifest(pp, catch_changes: true) end end + context 'installing python 3' do # Using puppet_apply as a helper it 'works with no errors' do From 89b33245fa6e441c9baa1b44da3ec791b913eebe Mon Sep 17 00:00:00 2001 From: Jake Yip Date: Mon, 5 Oct 2020 15:21:57 +1100 Subject: [PATCH 204/380] Use Python 3 for virtualenv test Python 2 has been deprecated, we should default to testing with Python 3 In commit 04ebe2d16d1d408f9c5d049aaa0426dce1c7bbe2, distribute was added as an option to be set to false if setting up a python3 virtualenv. Therefore, set distribute to false because we have defaulted to py3. --- spec/acceptance/virtualenv_spec.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index de60ab09..13e5888d 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -5,11 +5,8 @@ # Using puppet_apply as a helper it 'works with no errors' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + class { 'python' : version => $version, pip => 'present', @@ -19,6 +16,7 @@ class { 'python' : ensure => 'present', version => $version, systempkgs => false, + distribute => false, venv_dir => '/opt/venv', } -> python::pip { 'rpyc' : From f1f24ccb46999884cbe3c8b6e81e6f6649912b8e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 24 Oct 2020 19:45:02 +0200 Subject: [PATCH 205/380] modulesync 3.1.0 --- .github/CONTRIBUTING.md | 4 +- .msync.yml | 3 +- .overcommit.yml | 2 +- .rubocop.yml | 552 +--------------------------------------- .travis.yml | 111 ++++---- Gemfile | 2 +- spec/spec_helper.rb | 2 +- 7 files changed, 67 insertions(+), 609 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 2240a970..cace33e6 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -33,6 +33,8 @@ By participating in this project you agree to abide by its terms. Please be prepared to repeat some of these steps as our contributors review your code. +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + ## Writing proper commits - short version * Make commits of logical units. @@ -264,7 +266,7 @@ The following strings are known to work: * ubuntu1604 * ubuntu1804 -* debian8 +* ubuntu2004 * debian9 * debian10 * centos6 diff --git a/.msync.yml b/.msync.yml index 4c7999c4..5758aced 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1 +1,2 @@ -modulesync_config_version: '3.0.0' +--- +modulesync_config_version: '3.1.0' diff --git a/.overcommit.yml b/.overcommit.yml index 1b03fad7..0af0fdc0 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -61,4 +61,4 @@ PrePush: - 'validate' - 'test' - 'rubocop' - command: [ 'bundle', 'exec', 'rake' ] + command: ['bundle', 'exec', 'rake'] diff --git a/.rubocop.yml b/.rubocop.yml index 316e4ec1..198a3599 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,549 +1,3 @@ -require: rubocop-rspec -AllCops: -# Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5 - TargetRubyVersion: 1.9 - Include: - - ./**/*.rb - Exclude: - - files/**/* - - vendor/**/* - - .vendor/**/* - - pkg/**/* - - spec/fixtures/**/* - - Gemfile - - Rakefile - - Guardfile - - Vagrantfile -Lint/ConditionPosition: - Enabled: True - -Lint/ElseLayout: - Enabled: True - -Lint/UnreachableCode: - Enabled: True - -Lint/UselessComparison: - Enabled: True - -Lint/EnsureReturn: - Enabled: True - -Lint/HandleExceptions: - Enabled: True - -Lint/LiteralInCondition: - Enabled: True - -Lint/ShadowingOuterLocalVariable: - Enabled: True - -Lint/LiteralInInterpolation: - Enabled: True - -Style/HashSyntax: - Enabled: True - -Style/RedundantReturn: - Enabled: True - -Layout/EndOfLine: - Enabled: False - -Lint/AmbiguousOperator: - Enabled: True - -Lint/AssignmentInCondition: - Enabled: True - -Layout/SpaceBeforeComment: - Enabled: True - -Style/AndOr: - Enabled: True - -Style/RedundantSelf: - Enabled: True - -Metrics/BlockLength: - Enabled: False - -# Method length is not necessarily an indicator of code quality -Metrics/MethodLength: - Enabled: False - -# Module length is not necessarily an indicator of code quality -Metrics/ModuleLength: - Enabled: False - -Style/WhileUntilModifier: - Enabled: True - -Lint/AmbiguousRegexpLiteral: - Enabled: True - -Security/Eval: - Enabled: True - -Lint/BlockAlignment: - Enabled: True - -Lint/DefEndAlignment: - Enabled: True - -Lint/EndAlignment: - Enabled: True - -Lint/DeprecatedClassMethods: - Enabled: True - -Lint/Loop: - Enabled: True - -Lint/ParenthesesAsGroupedExpression: - Enabled: True - -Lint/RescueException: - Enabled: True - -Lint/StringConversionInInterpolation: - Enabled: True - -Lint/UnusedBlockArgument: - Enabled: True - -Lint/UnusedMethodArgument: - Enabled: True - -Lint/UselessAccessModifier: - Enabled: True - -Lint/UselessAssignment: - Enabled: True - -Lint/Void: - Enabled: True - -Layout/AccessModifierIndentation: - Enabled: True - -Style/AccessorMethodName: - Enabled: True - -Style/Alias: - Enabled: True - -Layout/AlignArray: - Enabled: True - -Layout/AlignHash: - Enabled: True - -Layout/AlignParameters: - Enabled: True - -Metrics/BlockNesting: - Enabled: True - -Style/AsciiComments: - Enabled: True - -Style/Attr: - Enabled: True - -Style/BracesAroundHashParameters: - Enabled: True - -Style/CaseEquality: - Enabled: True - -Layout/CaseIndentation: - Enabled: True - -Style/CharacterLiteral: - Enabled: True - -Style/ClassAndModuleCamelCase: - Enabled: True - -Style/ClassAndModuleChildren: - Enabled: False - -Style/ClassCheck: - Enabled: True - -# Class length is not necessarily an indicator of code quality -Metrics/ClassLength: - Enabled: False - -Style/ClassMethods: - Enabled: True - -Style/ClassVars: - Enabled: True - -Style/WhenThen: - Enabled: True - -Style/WordArray: - Enabled: True - -Style/UnneededPercentQ: - Enabled: True - -Layout/Tab: - Enabled: True - -Layout/SpaceBeforeSemicolon: - Enabled: True - -Layout/TrailingBlankLines: - Enabled: True - -Layout/SpaceInsideBlockBraces: - Enabled: True - -Layout/SpaceInsideBrackets: - Enabled: True - -Layout/SpaceInsideHashLiteralBraces: - Enabled: True - -Layout/SpaceInsideParens: - Enabled: True - -Layout/LeadingCommentSpace: - Enabled: True - -Layout/SpaceBeforeFirstArg: - Enabled: True - -Layout/SpaceAfterColon: - Enabled: True - -Layout/SpaceAfterComma: - Enabled: True - -Layout/SpaceAfterMethodName: - Enabled: True - -Layout/SpaceAfterNot: - Enabled: True - -Layout/SpaceAfterSemicolon: - Enabled: True - -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: True - -Layout/SpaceAroundOperators: - Enabled: True - -Layout/SpaceBeforeBlockBraces: - Enabled: True - -Layout/SpaceBeforeComma: - Enabled: True - -Style/CollectionMethods: - Enabled: True - -Layout/CommentIndentation: - Enabled: True - -Style/ColonMethodCall: - Enabled: True - -Style/CommentAnnotation: - Enabled: True - -# 'Complexity' is very relative -Metrics/CyclomaticComplexity: - Enabled: False - -Style/ConstantName: - Enabled: True - -Style/Documentation: - Enabled: False - -Style/DefWithParentheses: - Enabled: True - -Style/PreferredHashMethods: - Enabled: True - -Layout/DotPosition: - EnforcedStyle: trailing - -Style/DoubleNegation: - Enabled: True - -Style/EachWithObject: - Enabled: True - -Layout/EmptyLineBetweenDefs: - Enabled: True - -Layout/IndentArray: - Enabled: True - -Layout/IndentHash: - Enabled: True - -Layout/IndentationConsistency: - Enabled: True - -Layout/IndentationWidth: - Enabled: True - -Layout/EmptyLines: - Enabled: True - -Layout/EmptyLinesAroundAccessModifier: - Enabled: True - -Style/EmptyLiteral: - Enabled: True - -# Configuration parameters: AllowURI, URISchemes. -Metrics/LineLength: - Enabled: False - -Style/MethodCallWithoutArgsParentheses: - Enabled: True - -Style/MethodDefParentheses: - Enabled: True - -Style/LineEndConcatenation: - Enabled: True - -Layout/TrailingWhitespace: - Enabled: True - -Style/StringLiterals: - Enabled: True - -Style/TrailingCommaInArguments: - Enabled: True - -Style/TrailingCommaInLiteral: - Enabled: True - -Style/GlobalVars: - Enabled: True - -Style/GuardClause: - Enabled: True - -Style/IfUnlessModifier: - Enabled: True - -Style/MultilineIfThen: - Enabled: True - -Style/NegatedIf: - Enabled: True - -Style/NegatedWhile: - Enabled: True - -Style/Next: - Enabled: True - -Style/SingleLineBlockParams: - Enabled: True - -Style/SingleLineMethods: - Enabled: True - -Style/SpecialGlobalVars: - Enabled: True - -Style/TrivialAccessors: - Enabled: True - -Style/UnlessElse: - Enabled: True - -Style/VariableInterpolation: - Enabled: True - -Style/VariableName: - Enabled: True - -Style/WhileUntilDo: - Enabled: True - -Style/EvenOdd: - Enabled: True - -Style/FileName: - Enabled: True - -Style/For: - Enabled: True - -Style/Lambda: - Enabled: True - -Style/MethodName: - Enabled: True - -Style/MultilineTernaryOperator: - Enabled: True - -Style/NestedTernaryOperator: - Enabled: True - -Style/NilComparison: - Enabled: True - -Style/FormatString: - Enabled: True - -Style/MultilineBlockChain: - Enabled: True - -Style/Semicolon: - Enabled: True - -Style/SignalException: - Enabled: True - -Style/NonNilCheck: - Enabled: True - -Style/Not: - Enabled: True - -Style/NumericLiterals: - Enabled: True - -Style/OneLineConditional: - Enabled: True - -Style/OpMethod: - Enabled: True - -Style/ParenthesesAroundCondition: - Enabled: True - -Style/PercentLiteralDelimiters: - Enabled: True - -Style/PerlBackrefs: - Enabled: True - -Style/PredicateName: - Enabled: True - -Style/RedundantException: - Enabled: True - -Style/SelfAssignment: - Enabled: True - -Style/Proc: - Enabled: True - -Style/RaiseArgs: - Enabled: True - -Style/RedundantBegin: - Enabled: True - -Style/RescueModifier: - Enabled: True - -# based on https://github.com/voxpupuli/modulesync_config/issues/168 -Style/RegexpLiteral: - EnforcedStyle: percent_r - Enabled: True - -Lint/UnderscorePrefixedVariableName: - Enabled: True - -Metrics/ParameterLists: - Enabled: False - -Lint/RequireParentheses: - Enabled: True - -Style/ModuleFunction: - Enabled: True - -Lint/Debugger: - Enabled: True - -Style/IfWithSemicolon: - Enabled: True - -Style/Encoding: - Enabled: True - -Style/BlockDelimiters: - Enabled: True - -Layout/MultilineBlockLayout: - Enabled: True - -# 'Complexity' is very relative -Metrics/AbcSize: - Enabled: False - -# 'Complexity' is very relative -Metrics/PerceivedComplexity: - Enabled: False - -Lint/UselessAssignment: - Enabled: True - -Layout/ClosingParenthesisIndentation: - Enabled: True - -# RSpec - -RSpec/BeforeAfterAll: - Exclude: - - spec/acceptance/**/* - -# We don't use rspec in this way -RSpec/DescribeClass: - Enabled: False - -# Example length is not necessarily an indicator of code quality -RSpec/ExampleLength: - Enabled: False - -RSpec/NamedSubject: - Enabled: False - -# disabled for now since they cause a lot of issues -# these issues aren't easy to fix -RSpec/RepeatedDescription: - Enabled: False - -RSpec/NestedGroups: - Enabled: False - -RSpec/MultipleExpectations: - Enabled: false - -# this is broken on ruby1.9 -Layout/IndentHeredoc: - Enabled: False - -# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs -Security/YAMLLoad: - Enabled: false - -# This affects hiera interpolation, as well as some configs that we push. -Style/FormatStringToken: - Enabled: false - -# This is useful, but sometimes a little too picky about where unit tests files -# are located. -RSpec/FilePath: - Enabled: false +--- +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml index bacdfa8a..370b9e4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ --- +# yamllint disable rule:line-length rule:truthy os: linux -dist: bionic +dist: focal language: ruby cache: bundler before_install: @@ -11,62 +12,62 @@ script: jobs: fast_finish: true include: - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker + - rvm: 2.4.4 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=test + - rvm: 2.5.3 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls + - rvm: 2.5.3 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 6.0" CHECK=rubocop + - rvm: 2.4.4 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker + services: docker + - rvm: 2.5.3 + bundler_args: --without development release + env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker + services: docker branches: only: - - master - - /^v\d/ + - master + - /^v\d/ notifications: email: false webhooks: https://voxpupu.li/incoming/travis diff --git a/Gemfile b/Gemfile index 8592cd61..2fce93ce 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil) end group :test do - gem 'voxpupuli-test', '~> 2.0', :require => false + gem 'voxpupuli-test', '~> 2.1', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b2b27045..d266f6b4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) - facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) if facts facts.each do |name, value| add_custom_fact name.to_sym, value From 7520a85323b8d1be342bba4edb458e51ff7c942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Fr=C3=B6hner?= Date: Tue, 17 Nov 2020 08:10:25 +0100 Subject: [PATCH 206/380] fix parameter lists of manifests and puppet code style/lint/indent --- REFERENCE.md | 449 ++++++++++++++++++++----------------- manifests/config.pp | 2 +- manifests/dotfile.pp | 10 +- manifests/gunicorn.pp | 41 ++-- manifests/init.pp | 62 +++-- manifests/install.pp | 41 ++-- manifests/params.pp | 53 +++-- manifests/pip.pp | 83 +++---- manifests/pip/bootstrap.pp | 14 +- manifests/pyvenv.pp | 34 +-- manifests/requirements.pp | 31 +-- manifests/virtualenv.pp | 65 +++--- types/loglevel.pp | 3 + types/package/ensure.pp | 3 + types/provider.pp | 3 + types/umask.pp | 3 + types/version.pp | 8 + 17 files changed, 479 insertions(+), 426 deletions(-) create mode 100644 types/loglevel.pp create mode 100644 types/package/ensure.pp create mode 100644 types/provider.pp create mode 100644 types/umask.pp create mode 100644 types/version.pp diff --git a/REFERENCE.md b/REFERENCE.md index 069496bd..3bb30293 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1,22 +1,23 @@ # Reference + ## Table of Contents -**Classes** +### Classes -_Public Classes_ +#### 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_ +#### Private Classes * `python::config`: Optionally installs the gunicorn service * `python::install`: Installs core python packages * `python::params`: The python Module default configuration settings. -**Defined types** +### Defined types * [`python::dotfile`](#pythondotfile): Manages any python dotfiles with a simple config hash. * [`python::gunicorn`](#pythongunicorn): Manages Gunicorn virtual hosts. @@ -25,9 +26,17 @@ _Private Classes_ * [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. * [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv. +### 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::Version`](#pythonversion): A version type to match all valid versions for python + ## Classes -### python +### `python` Installs and manages python, python-dev, python-virtualenv and gunicorn. @@ -62,15 +71,15 @@ The following parameters are available in the `python` class. ##### `ensure` -Data type: `Enum['absent', 'present', 'latest']` +Data type: `Python::Package::Ensure` Desired installation state for the Python package. -Default value: $python::params::ensure +Default value: `$python::params::ensure` ##### `version` -Data type: `Any` +Data type: `Python::Version` Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. Allowed values: @@ -81,39 +90,39 @@ Allowed values: - 3/3.3/... means you are going to install the python3/python3.3/... package, if available on your osfamily. -Default value: $python::params::version +Default value: `$python::params::version` ##### `pip` -Data type: `Enum['absent', 'present', 'latest']` +Data type: `Python::Package::Ensure` Desired installation state for the python-pip package. -Default value: $python::params::pip +Default value: `$python::params::pip` ##### `dev` -Data type: `Enum['absent', 'present', 'latest']` +Data type: `Python::Package::Ensure` Desired installation state for the python-dev package. -Default value: $python::params::dev +Default value: `$python::params::dev` ##### `virtualenv` -Data type: `Enum['absent', 'present', 'latest']` +Data type: `Python::Package::Ensure` Desired installation state for the virtualenv package -Default value: $python::params::virtualenv +Default value: `$python::params::virtualenv` ##### `gunicorn` -Data type: `Enum['absent', 'present', 'latest']` +Data type: `Python::Package::Ensure` Desired installation state for Gunicorn. -Default value: $python::params::gunicorn +Default value: `$python::params::gunicorn` ##### `manage_gunicorn` @@ -121,15 +130,15 @@ Data type: `Boolean` Allow Installation / Removal of Gunicorn. -Default value: $python::params::manage_gunicorn +Default value: `$python::params::manage_gunicorn` ##### `provider` -Data type: `Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']]` +Data type: `Optional[Python::Provider]` What provider to use for installation of the packages, except gunicorn and Python itself. -Default value: $python::params::provider +Default value: `$python::params::provider` ##### `use_epel` @@ -137,7 +146,7 @@ Data type: `Boolean` to determine if the epel class is used. -Default value: $python::params::use_epel +Default value: `$python::params::use_epel` ##### `manage_scl` @@ -145,15 +154,15 @@ Data type: `Boolean` Whether to manage core SCL packages or not. -Default value: $python::params::manage_scl +Default value: `$python::params::manage_scl` ##### `umask` -Data type: `Optional[Pattern[/[0-7]{1,4}/]]` +Data type: `Optional[Python::Umask]` The default umask for invoked exec calls. -Default value: `undef` +Default value: ``undef`` ##### `manage_python_package` @@ -161,7 +170,7 @@ Data type: `Boolean` -Default value: $python::params::manage_python_package +Default value: `$python::params::manage_python_package` ##### `manage_virtualenv_package` @@ -169,7 +178,7 @@ Data type: `Boolean` -Default value: $python::params::manage_virtualenv_package +Default value: `$python::params::manage_virtualenv_package` ##### `manage_pip_package` @@ -177,23 +186,15 @@ Data type: `Boolean` -Default value: $python::params::manage_pip_package +Default value: `$python::params::manage_pip_package` ##### `gunicorn_package_name` -Data type: `Any` - - - -Default value: $python::params::gunicorn_package_name - -##### `valid_versions` - -Data type: `Any` +Data type: `String[1]` -Default value: $python::params::valid_versions +Default value: `$python::params::gunicorn_package_name` ##### `python_pips` @@ -201,7 +202,7 @@ Data type: `Hash` -Default value: { } +Default value: `{}` ##### `python_virtualenvs` @@ -209,7 +210,7 @@ Data type: `Hash` -Default value: { } +Default value: `{}` ##### `python_pyvenvs` @@ -217,7 +218,7 @@ Data type: `Hash` -Default value: { } +Default value: `{}` ##### `python_requirements` @@ -225,7 +226,7 @@ Data type: `Hash` -Default value: { } +Default value: `{}` ##### `python_dotfiles` @@ -233,15 +234,15 @@ Data type: `Hash` -Default value: { } +Default value: `{}` ##### `rhscl_use_public_repository` -Data type: `Any` +Data type: `Boolean` -Default value: $python::params::rhscl_use_public_repository +Default value: `$python::params::rhscl_use_public_repository` ##### `anaconda_installer_url` @@ -249,7 +250,7 @@ Data type: `Stdlib::Httpurl` -Default value: $python::params::anaconda_installer_url +Default value: `$python::params::anaconda_installer_url` ##### `anaconda_install_path` @@ -257,9 +258,9 @@ Data type: `Stdlib::Absolutepath` -Default value: $python::params::anaconda_install_path +Default value: `$python::params::anaconda_install_path` -### python::pip::bootstrap +### `python::pip::bootstrap` allow to bootstrap pip when python is managed from other module @@ -283,7 +284,7 @@ Data type: `Enum['pip', 'pip3']` should be pip or pip3 -Default value: 'pip' +Default value: `'pip'` ##### `manage_python` @@ -291,7 +292,7 @@ Data type: `Variant[Boolean, String]` if python module will manage deps -Default value: `false` +Default value: ``false`` ##### `http_proxy` @@ -299,7 +300,7 @@ Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: `undef` +Default value: ``undef`` ##### `exec_provider` @@ -307,11 +308,11 @@ Data type: `String[1]` -Default value: 'shell' +Default value: `'shell'` ## Defined types -### python::dotfile +### `python::dotfile` Manages any python dotfiles with a simple config hash. @@ -343,15 +344,15 @@ Data type: `Enum['absent', 'present']` -Default value: 'present' +Default value: `'present'` ##### `filename` -Data type: `String[1]` +Data type: `Stdlib::Absolutepath` Filename. -Default value: $title +Default value: `$title` ##### `mode` @@ -359,7 +360,7 @@ Data type: `Stdlib::Filemode` File mode. -Default value: '0644' +Default value: `'0644'` ##### `owner` @@ -367,7 +368,7 @@ Data type: `String[1]` user owner of dotfile -Default value: 'root' +Default value: `'root'` ##### `group` @@ -375,7 +376,7 @@ Data type: `String[1]` group owner of dotfile -Default value: 'root' +Default value: `'root'` ##### `config` @@ -383,9 +384,9 @@ Data type: `Hash` Config hash. This will be expanded to an ini-file. -Default value: {} +Default value: `{}` -### python::gunicorn +### `python::gunicorn` Manages Gunicorn virtual hosts. @@ -420,31 +421,31 @@ Data type: `Enum['present', 'absent']` -Default value: present +Default value: `present` ##### `config_dir` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Configure the gunicorn config directory path. -Default value: '/etc/gunicorn.d' +Default value: `'/etc/gunicorn.d'` ##### `manage_config_dir` -Data type: `Any` +Data type: `Booloean` Set if the gunicorn config directory should be created. -Default value: `false` +Default value: ``false`` ##### `virtualenv` -Data type: `Any` +Data type: `Variant[Boolean,Stdlib::Absolutepath]` Run in virtualenv, specify directory. -Default value: `false` +Default value: ``false`` ##### `mode` @@ -452,7 +453,7 @@ Data type: `Enum['wsgi', 'django']` Gunicorn mode. -Default value: 'wsgi' +Default value: `'wsgi'` ##### `dir` @@ -462,119 +463,119 @@ Application directory. ##### `bind` -Data type: `Any` +Data type: `Variant[String[1],Boolean]` Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: system-wide: unix:/tmp/gunicorn-$name.socket virtualenv: unix:${virtualenv}/${name}.socket -Default value: `false` +Default value: ``false`` ##### `environment` -Data type: `Any` +Data type: `Variant[String[1],Boolean]` Set ENVIRONMENT variable. -Default value: `false` +Default value: ``false`` ##### `appmodule` -Data type: `Any` +Data type: `String[1]` Set the application module name for gunicorn to load when not using Django. -Default value: 'app:app' +Default value: `'app:app'` ##### `osenv` -Data type: `Any` +Data type: `Variant[Boolean,Hash]` Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. -Default value: `false` +Default value: ``false`` ##### `timeout` -Data type: `Any` +Data type: `Integer` Allows setting the gunicorn idle worker process time before being killed. The unit of time is seconds. -Default value: 30 +Default value: `30` ##### `template` -Data type: `Any` +Data type: `String[1]` Which ERB template to use. -Default value: 'python/gunicorn.erb' +Default value: `'python/gunicorn.erb'` ##### `args` -Data type: `Any` +Data type: `Array` Custom arguments to add in gunicorn config file. -Default value: [] +Default value: `[]` ##### `owner` -Data type: `Any` +Data type: `String[1]` -Default value: 'www-data' +Default value: `'www-data'` ##### `group` -Data type: `Any` +Data type: `String[1]` -Default value: 'www-data' +Default value: `'www-data'` ##### `workers` -Data type: `Any` +Data type: `Variant[Boolean,Integer]` -Default value: `false` +Default value: ``false`` ##### `access_log_format` -Data type: `Any` +Data type: `Variant[Boolean,String[1]]` -Default value: `false` +Default value: ``false`` ##### `accesslog` -Data type: `Any` +Data type: `Variant[Boolean,Stdlib::Absolutepath]` -Default value: `false` +Default value: ``false`` ##### `errorlog` -Data type: `Any` +Data type: `Variant[Boolean,Stdlib::Absolutepath]` -Default value: `false` +Default value: ``false`` ##### `log_level` -Data type: `Enum['debug', 'info', 'warning', 'error', 'critical']` +Data type: `Python::Loglevel` -Default value: 'error' +Default value: `'error'` -### python::pip +### `python::pip` Installs and manages packages from pip. @@ -628,11 +629,11 @@ must be unique ##### `pkgname` -Data type: `String` +Data type: `String[1]` the name of the package. -Default value: $name +Default value: `$name` ##### `ensure` @@ -640,7 +641,7 @@ Data type: `Variant[Enum[present, absent, latest], String[1]]` Require pip to be available. -Default value: present +Default value: `present` ##### `virtualenv` @@ -648,7 +649,7 @@ Data type: `Variant[Enum['system'], Stdlib::Absolutepath]` virtualenv to run pip in. -Default value: 'system' +Default value: `'system'` ##### `pip_provider` @@ -656,7 +657,7 @@ Data type: `String[1]` version of pip you wish to use. -Default value: 'pip' +Default value: `'pip'` ##### `url` @@ -664,7 +665,7 @@ Data type: `Variant[Boolean, String]` URL to install from. -Default value: `false` +Default value: ``false`` ##### `owner` @@ -672,23 +673,23 @@ Data type: `String[1]` The owner of the virtualenv being manipulated. -Default value: 'root' +Default value: `'root'` ##### `group` -Data type: `Any` +Data type: `Optional[String[1]]` The group of the virtualenv being manipulated. -Default value: getvar('python::params::group') +Default value: `getvar('python::params::group')` ##### `index` -Data type: `Any` +Data type: `Variant[Boolean,String[1]]` Base URL of Python package index. -Default value: `false` +Default value: ``false`` ##### `proxy` @@ -696,7 +697,7 @@ Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: `undef` +Default value: ``undef`` ##### `editable` @@ -704,23 +705,23 @@ Data type: `Boolean` If true the package is installed as an editable resource. -Default value: `false` +Default value: ``false`` ##### `environment` -Data type: `Any` +Data type: `Array` Additional environment variables required to install the packages. -Default value: [] +Default value: `[]` ##### `extras` -Data type: `Any` +Data type: `Array` Extra features provided by the package which should be installed. -Default value: [] +Default value: `[]` ##### `timeout` @@ -728,7 +729,7 @@ Data type: `Numeric` The maximum time in seconds the "pip install" command should take. -Default value: 1800 +Default value: `1800` ##### `install_args` @@ -736,7 +737,7 @@ Data type: `String` Any additional installation arguments that will be supplied when running pip install. -Default value: '' +Default value: `''` ##### `uninstall_args` @@ -744,7 +745,7 @@ Data type: `String` Any additional arguments that will be supplied when running pip uninstall. -Default value: '' +Default value: `''` ##### `log_dir` @@ -752,7 +753,7 @@ Data type: `String[1]` Log directory -Default value: '/tmp' +Default value: `'/tmp'` ##### `egg` @@ -760,15 +761,15 @@ Data type: `Any` The egg name to use -Default value: `false` +Default value: ``false`` ##### `umask` -Data type: `Any` +Data type: `Optional[Python::Umask]` -Default value: `undef` +Default value: ``undef`` ##### `path` @@ -776,7 +777,7 @@ Data type: `Array[String]` -Default value: ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'] +Default value: `['/usr/local/bin','/usr/bin','/bin', '/usr/sbin']` ##### `exec_provider` @@ -784,9 +785,9 @@ Data type: `String[1]` -Default value: 'shell' +Default value: `'shell'` -### python::pyvenv +### `python::pyvenv` Create a Python3 virtualenv using pyvenv. @@ -811,77 +812,77 @@ The following parameters are available in the `python::pyvenv` defined type. ##### `ensure` -Data type: `Any` +Data type: `Python::Package::Ensure` -Default value: present +Default value: `present` ##### `version` -Data type: `Any` +Data type: `Python::Version` Python version to use. -Default value: 'system' +Default value: `'system'` ##### `systempkgs` -Data type: `Any` +Data type: `Boolean` Copy system site-packages into virtualenv -Default value: `false` +Default value: ``false`` ##### `venv_dir` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Directory to install virtualenv to -Default value: $name +Default value: `$name` ##### `owner` -Data type: `Any` +Data type: `String[1]` The owner of the virtualenv being manipulated -Default value: 'root' +Default value: `'root'` ##### `group` -Data type: `Any` +Data type: `String[1]` The group relating to the virtualenv being manipulated -Default value: 'root' +Default value: `'root'` ##### `mode` -Data type: `Any` +Data type: `Stdlib::Filemode` Optionally specify directory mode -Default value: '0755' +Default value: `'0755'` ##### `path` -Data type: `Any` +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` -Data type: `Any` +Data type: `Array` Optionally specify environment variables for pyvenv -Default value: [] +Default value: `[]` -### python::requirements +### `python::requirements` Installs and manages Python packages from requirements file. @@ -904,19 +905,19 @@ The following parameters are available in the `python::requirements` defined typ ##### `requirements` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Path to the requirements file. -Default value: $name +Default value: `$name` ##### `virtualenv` -Data type: `Any` +Data type: `Variant[Enum['system'],Stdlib::Absolutepath]` virtualenv to run pip in. -Default value: 'system' +Default value: `'system'` ##### `pip_provider` @@ -924,23 +925,23 @@ Data type: `Enum['pip', 'pip3']` version of pip you wish to use. -Default value: 'pip' +Default value: `'pip'` ##### `owner` -Data type: `Any` +Data type: `String[1]` The owner of the virtualenv being manipulated. -Default value: 'root' +Default value: `'root'` ##### `group` -Data type: `Any` +Data type: `String[1]` The group relating to the virtualenv being manipulated. -Default value: 'root' +Default value: `'root'` ##### `proxy` @@ -948,7 +949,7 @@ Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: `undef` +Default value: ``undef`` ##### `src` @@ -956,73 +957,73 @@ Data type: `Any` 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. -Default value: `false` +Default value: ``false`` ##### `environment` -Data type: `Any` +Data type: `Array` Additional environment variables required to install the packages. -Default value: [] +Default value: `[]` ##### `forceupdate` -Data type: `Any` +Data type: `Boolean` 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) -Default value: `false` +Default value: ``false`` ##### `cwd` -Data type: `Any` +Data type: `Stdlib::Absolutepath` The directory from which to run the "pip install" command. -Default value: `undef` +Default value: ``undef`` ##### `extra_pip_args` -Data type: `Any` +Data type: `String` Extra arguments to pass to pip after the requirements file -Default value: '' +Default value: `''` ##### `manage_requirements` -Data type: `Any` +Data type: `Boolean` Create the requirements file if it doesn't exist. -Default value: `true` +Default value: ``true`` ##### `fix_requirements_owner` -Data type: `Any` +Data type: `Boolean` Change owner and group of requirements file. -Default value: `true` +Default value: ``true`` ##### `log_dir` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Log directory. -Default value: '/tmp' +Default value: `'/tmp'` ##### `timeout` -Data type: `Any` +Data type: `Integer` The maximum time in seconds the "pip install" command should take. -Default value: 1800 +Default value: `1800` -### python::virtualenv +### `python::virtualenv` Creates Python virtualenv. @@ -1047,91 +1048,91 @@ The following parameters are available in the `python::virtualenv` defined type. ##### `ensure` -Data type: `Any` +Data type: `Python::Package::Ensure` -Default value: 'present' +Default value: `'present'` ##### `version` -Data type: `Any` +Data type: `Python::Version` Python version to use. -Default value: 'system' +Default value: `'system'` ##### `requirements` -Data type: `Any` +Data type: `Variant[Boolean,Stdlib::Absolutepath]` Path to pip requirements.txt file -Default value: `false` +Default value: ``false`` ##### `systempkgs` -Data type: `Any` +Data type: `Boolean` Copy system site-packages into virtualenv. -Default value: `false` +Default value: ``false`` ##### `venv_dir` -Data type: `Any` +Data type: `Stdlib::Absolutepath` Directory to install virtualenv to -Default value: $name +Default value: `$name` ##### `ensure_venv_dir` -Data type: `Any` +Data type: `Boolean` Create $venv_dir -Default value: `true` +Default value: ``true`` ##### `distribute` -Data type: `Any` +Data type: `Boolean` Include distribute in the virtualenv -Default value: `true` +Default value: ``true`` ##### `index` -Data type: `Any` +Data type: `Variant[Boolean,Stdlib::HTTPUrl]` Base URL of Python package index -Default value: `false` +Default value: ``false`` ##### `owner` -Data type: `Any` +Data type: `String[1]` The owner of the virtualenv being manipulated -Default value: 'root' +Default value: `'root'` ##### `group` -Data type: `Any` +Data type: `String[1]` The group relating to the virtualenv being manipulated -Default value: 'root' +Default value: `'root'` ##### `mode` -Data type: `Any` +Data type: `Stdlib::Filemode` Optionally specify directory mode -Default value: '0755' +Default value: `'0755'` ##### `proxy` @@ -1139,61 +1140,93 @@ Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections -Default value: `undef` +Default value: ``undef`` ##### `environment` -Data type: `Any` +Data type: `Array` Additional environment variables required to install the packages -Default value: [] +Default value: `[]` ##### `path` -Data type: `Any` +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` -Data type: `Any` +Data type: `Optional[Stdlib::Absolutepath]` The directory from which to run the "pip install" command -Default value: `undef` +Default value: ``undef`` ##### `timeout` -Data type: `Any` +Data type: `Integer` The maximum time in seconds the "pip install" command should take -Default value: 1800 +Default value: `1800` ##### `pip_args` -Data type: `Any` +Data type: `String` Arguments to pass to pip during initialization -Default value: '' +Default value: `''` ##### `extra_pip_args` -Data type: `Any` +Data type: `String` Extra arguments to pass to pip after requirements file -Default value: '' +Default value: `''` ##### `virtualenv` -Data type: `Any` +Data type: `Optional[Stdlib::Absolutepath]` + + + +Default value: ``undef`` + +## Data types + +### `Python::Loglevel` + +A version type to match all valid versions for python + +Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']` + +### `Python::Package::Ensure` + +A version type to match all valid versions for python + +Alias of `Enum['absent', 'present', 'latest']` + +### `Python::Provider` + +A version type to match all valid versions for python + +Alias of `Enum['pip', 'scl', 'rhscl', 'anaconda', '']` + +### `Python::Umask` + +A version type to match all valid versions for python + +Alias of `Pattern[/[0-7]{1,4}/]` +### `Python::Version` +A version type to match all valid versions for python -Default value: `undef` +Alias of `Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]` diff --git a/manifests/config.pp b/manifests/config.pp index cbb466f1..dfff33b6 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -12,7 +12,7 @@ Python::Virtualenv <| |> -> Python::Pip <| |> if $python::manage_gunicorn { - if $python::gunicorn != 'absent' { + unless $python::gunicorn == 'absent' { Class['python::install'] -> Python::Gunicorn <| |> Python::Gunicorn <| |> ~> Service['gunicorn'] diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index e42106c1..4961f12f 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -24,11 +24,11 @@ # define python::dotfile ( Enum['absent', 'present'] $ensure = 'present', - String[1] $filename = $title, - String[1] $owner = 'root', - String[1] $group = 'root', - Stdlib::Filemode $mode = '0644', - Hash $config = {}, + Stdlib::Absolutepath $filename = $title, + String[1] $owner = 'root', + String[1] $group = 'root', + Stdlib::Filemode $mode = '0644', + Hash $config = {}, ) { $parent_dir = dirname($filename) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index d9625a04..1b2954be 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -34,26 +34,26 @@ # } # define python::gunicorn ( - Stdlib::Absolutepath $dir, - Enum['present', 'absent'] $ensure = present, - $config_dir = '/etc/gunicorn.d', - $manage_config_dir = false, - $virtualenv = false, - Enum['wsgi', 'django'] $mode = 'wsgi', - $bind = false, - $environment = false, - $owner = 'www-data', - $group = 'www-data', - $appmodule = 'app:app', - $osenv = false, - $timeout = 30, - $workers = false, - $access_log_format = false, - $accesslog = false, - $errorlog = false, - Enum['debug', 'info', 'warning', 'error', 'critical'] $log_level = 'error', - $template = 'python/gunicorn.erb', - $args = [], + Stdlib::Absolutepath $dir, + Enum['present', 'absent'] $ensure = present, + Stdlib::Absolutepath $config_dir = '/etc/gunicorn.d', + Booloean $manage_config_dir = false, + Variant[Boolean,Stdlib::Absolutepath] $virtualenv = false, + Enum['wsgi', 'django'] $mode = 'wsgi', + Variant[String[1],Boolean] $bind = false, + Variant[String[1],Boolean] $environment = false, + String[1] $owner = 'www-data', + String[1] $group = 'www-data', + String[1] $appmodule = 'app:app', + Variant[Boolean,Hash] $osenv = false, + Integer $timeout = 30, + Variant[Boolean,Integer] $workers = false, + Variant[Boolean,String[1]] $access_log_format = false, + Variant[Boolean,Stdlib::Absolutepath] $accesslog = false, + Variant[Boolean,Stdlib::Absolutepath] $errorlog = false, + Python::Loglevel $log_level = 'error', + String[1] $template = 'python/gunicorn.erb', + Array $args = [], ) { if $manage_config_dir { file { $config_dir: @@ -62,6 +62,7 @@ owner => 'root', group => 'root', } + file { "${config_dir}/${name}": ensure => $ensure, mode => '0644', diff --git a/manifests/init.pp b/manifests/init.pp index 468725be..a4cf6957 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -36,30 +36,29 @@ # } # class python ( - Enum['absent', 'present', 'latest'] $ensure = $python::params::ensure, - $version = $python::params::version, - Enum['absent', 'present', 'latest'] $pip = $python::params::pip, - Enum['absent', 'present', 'latest'] $dev = $python::params::dev, - Enum['absent', 'present', 'latest'] $virtualenv = $python::params::virtualenv, - Enum['absent', 'present', 'latest'] $gunicorn = $python::params::gunicorn, - Boolean $manage_gunicorn = $python::params::manage_gunicorn, - Boolean $manage_python_package = $python::params::manage_python_package, - Boolean $manage_virtualenv_package = $python::params::manage_virtualenv_package, - Boolean $manage_pip_package = $python::params::manage_pip_package, - $gunicorn_package_name = $python::params::gunicorn_package_name, - Optional[Enum['pip', 'scl', 'rhscl', 'anaconda', '']] $provider = $python::params::provider, - $valid_versions = $python::params::valid_versions, - Hash $python_pips = {}, - Hash $python_virtualenvs = {}, - Hash $python_pyvenvs = {}, - Hash $python_requirements = {}, - Hash $python_dotfiles = {}, - Boolean $use_epel = $python::params::use_epel, - $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, - 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, + Python::Package::Ensure $ensure = $python::params::ensure, + Python::Version $version = $python::params::version, + Python::Package::Ensure $pip = $python::params::pip, + Python::Package::Ensure $dev = $python::params::dev, + Python::Package::Ensure $virtualenv = $python::params::virtualenv, + Python::Package::Ensure $gunicorn = $python::params::gunicorn, + Boolean $manage_gunicorn = $python::params::manage_gunicorn, + Boolean $manage_python_package = $python::params::manage_python_package, + Boolean $manage_virtualenv_package = $python::params::manage_virtualenv_package, + Boolean $manage_pip_package = $python::params::manage_pip_package, + String[1] $gunicorn_package_name = $python::params::gunicorn_package_name, + Optional[Python::Provider] $provider = $python::params::provider, + Hash $python_pips = {}, + Hash $python_virtualenvs = {}, + Hash $python_pyvenvs = {}, + Hash $python_requirements = {}, + Hash $python_dotfiles = {}, + Boolean $use_epel = $python::params::use_epel, + Boolean $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, + 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[Python::Umask] $umask = undef, ) inherits python::params { $exec_prefix = $provider ? { 'scl' => "/usr/bin/scl enable ${version} -- ", @@ -67,17 +66,6 @@ default => '', } - unless $version =~ Pattern[/\A(python)?[0-9](\.?[0-9])*/, - /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] { - fail("version needs to be pypy, system or a version string like '36', '3.6' or 'python3.6' )") - } - - # Module compatibility check - $compatible = ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX'] - if ! ($facts['os']['family'] in $compatible) { - fail("Module is not compatible with ${facts['os']['name']}") - } - contain python::install contain python::config @@ -85,8 +73,8 @@ -> Class['python::config'] # Set default umask. - if $umask != undef { - Exec { umask => $umask } + exec { default: + umask => $umask } # Allow hiera configuration of python resources diff --git a/manifests/install.pp b/manifests/install.pp index fd063cdf..56ce36ce 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -36,6 +36,7 @@ if $venv_ensure == 'present' { $dev_ensure = 'present' + unless $python::dev { # Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch # Python dev is required for virtual environment, but python environment is not required for python dev. @@ -83,7 +84,7 @@ # Respect the $pip_ensure setting unless $pip_ensure == 'absent' { # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. - include 'python::pip::bootstrap' + include python::pip::bootstrap Exec['bootstrap pip'] -> File['pip-python'] -> Package <| provider == pip |> @@ -91,6 +92,7 @@ name => 'pip', provider => 'pip', } + if $pythondev { Package <| title == 'virtualenv' |> { name => 'virtualenv', @@ -119,6 +121,7 @@ ensure => $install_scl_repo_package, before => Package['scl-utils'], } + package { 'scl-utils': ensure => 'present', before => Package['python'], @@ -131,14 +134,10 @@ } } - # This gets installed as a dependency anyway - # package { "${python::version}-python-virtualenv": - # ensure => $venv_ensure, - # require => Package['scl-utils'], - # } package { "${python}-scldevel": ensure => $dev_ensure, } + if $pip_ensure != 'absent' { exec { 'python-scl-pip-install': command => "${python::exec_prefix}easy_install pip", @@ -151,6 +150,7 @@ # rhscl is RedHat SCLs from softwarecollections.org if $python::rhscl_use_public_repository { $scl_package = "rhscl-${python::version}-epel-${facts['os']['release']['major']}-${facts['os']['architecture']}" + package { $scl_package: source => "https://www.softwarecollections.org/en/scls/rhscl/${python::version}/epel-${facts['os']['release']['major']}-${facts['os']['architecture']}/download/${scl_package}.noarch.rpm", provider => 'rpm', @@ -181,8 +181,7 @@ -> Package <| tag == 'python-scl-package' |> } - Package <| tag == 'python-scl-package' |> - -> Package <| tag == 'python-pip-package' |> + Package <| tag == 'python-scl-package' |> -> Package <| tag == 'python-pip-package' |> } 'anaconda': { $installer_path = '/var/tmp/anaconda_installer.sh' @@ -217,6 +216,7 @@ } } } + if $pythondev { package { 'python-dev': ensure => $dev_ensure, @@ -233,6 +233,7 @@ require => Package['python'], } } + if $pythondev { package { 'python-dev': ensure => $dev_ensure, @@ -245,18 +246,12 @@ case $facts['os']['family'] { 'RedHat': { - if $pip_ensure != 'absent' { - if $python::use_epel == true { - include 'epel' - if $python::manage_pip_package { Class['epel'] -> Package['pip'] } - if $python::manage_python_package { Class['epel'] -> Package['python'] } - } + if $pip_ensure != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { + require epel } - if ($venv_ensure != 'absent') and ($facts['os']['release']['full'] =~ /^6/) { - if $python::use_epel == true { - include 'epel' - Class['epel'] -> Package['virtualenv'] - } + + if $venv_ensure != 'absent' and $facts['os']['release']['full'] =~ /^6/ and $python::use_epel { + require epel } $virtualenv_package = "${python}-virtualenv" @@ -278,19 +273,19 @@ if String($python::version) =~ /^python3/ { $pip_category = undef - $pip_package = "${python}-pip" + $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { $pip_category = undef - $pip_package = 'python2-pip' + $pip_package = 'python2-pip' $pip_provider = pip2 } elsif $facts['os']['family'] == 'Gentoo' { $pip_category = 'dev-python' - $pip_package = 'pip' + $pip_package = 'pip' $pip_provider = 'pip' } else { $pip_category = undef - $pip_package = 'python-pip' + $pip_package = 'python-pip' $pip_provider = 'pip' } diff --git a/manifests/params.pp b/manifests/params.pp index 8ff6a669..338f9bd9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,28 +4,32 @@ # The python Module default configuration settings. # class python::params { - $ensure = 'present' - $version = 'system' - $pip = 'present' - $dev = 'absent' - $virtualenv = 'absent' - $gunicorn = 'absent' - $manage_gunicorn = true - $manage_python_package = true - $manage_virtualenv_package = true - $manage_pip_package = true - $provider = undef - $valid_versions = undef - $manage_scl = true + # Module compatibility check + unless $facts['os']['family'] in ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX',] { + fail("Module is not compatible with ${facts['os']['name']}") + } + + $ensure = 'present' + $version = 'system' + $pip = 'present' + $dev = 'absent' + $virtualenv = 'absent' + $gunicorn = 'absent' + $manage_gunicorn = true + $manage_python_package = true + $manage_virtualenv_package = true + $manage_pip_package = true + $provider = undef + $valid_versions = undef + $manage_scl = true + $rhscl_use_public_repository = true + $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh' + $anaconda_install_path = '/opt/python' - if $facts['os']['family'] == 'RedHat' { - if $facts['os']['name'] != 'Fedora' { - $use_epel = true - } else { - $use_epel = false - } + if $facts['os']['family'] == 'RedHat' and $facts['os']['name'] != 'Fedora' { + $use_epel = true } else { - $use_epel = false + $use_epel = false } $group = $facts['os']['family'] ? { @@ -34,17 +38,12 @@ } $pip_lookup_path = $facts['os']['family'] ? { - 'AIX' => ['/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/'], - default => ['/bin', '/usr/bin', '/usr/local/bin'] + 'AIX' => ['/bin', '/usr/bin', '/usr/local/bin', '/opt/freeware/bin/',], + default => ['/bin', '/usr/bin', '/usr/local/bin',] } $gunicorn_package_name = $facts['os']['family'] ? { 'RedHat' => 'python-gunicorn', default => 'gunicorn', } - - $rhscl_use_public_repository = true - - $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh' - $anaconda_install_path = '/opt/python' } diff --git a/manifests/pip.pp b/manifests/pip.pp index 8f09c95d..30d29ce3 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -48,26 +48,26 @@ # } # define python::pip ( - String $pkgname = $name, - Variant[Enum[present, absent, latest], String[1]] $ensure = present, - Variant[Enum['system'], Stdlib::Absolutepath] $virtualenv = 'system', - String[1] $pip_provider = 'pip', - Variant[Boolean, String] $url = false, - String[1] $owner = 'root', - $group = getvar('python::params::group'), - $umask = undef, - $index = false, - Optional[Stdlib::HTTPUrl] $proxy = undef, - $egg = false, - Boolean $editable = false, - $environment = [], - $extras = [], - String $install_args = '', - String $uninstall_args = '', - Numeric $timeout = 1800, - String[1] $log_dir = '/tmp', - Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], - String[1] $exec_provider = 'shell', + String[1] $pkgname = $name, + Variant[Enum[present, absent, latest], String[1]] $ensure = present, + Variant[Enum['system'], Stdlib::Absolutepath] $virtualenv = 'system', + String[1] $pip_provider = 'pip', + Variant[Boolean, String] $url = false, + String[1] $owner = 'root', + Optional[String[1]] $group = getvar('python::params::group'), + Optional[Python::Umask] $umask = undef, + Variant[Boolean,String[1]] $index = false, + Optional[Stdlib::HTTPUrl] $proxy = undef, + Any $egg = false, + Boolean $editable = false, + Array $environment = [], + Array $extras = [], + String $install_args = '', + String $uninstall_args = '', + Numeric $timeout = 1800, + String[1] $log_dir = '/tmp', + Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + String[1] $exec_provider = 'shell', ) { $python_provider = getparam(Class['python'], 'provider') $python_version = getparam(Class['python'], 'version') @@ -127,7 +127,7 @@ $install_editable = '' } - #TODO: Do more robust argument checking, but below is a start + # TODO: Do more robust argument checking, but below is a start if ($ensure == absent) and ($install_args != '') { fail('python::pip cannot provide install_args with ensure => absent') } @@ -137,15 +137,16 @@ } if $pkgname =~ /==/ { - $parts = split($pkgname, '==') + $parts = split($pkgname, '==') $real_pkgname = $parts[0] + $_ensure = $ensure ? { 'absent' => 'absent', default => $parts[1], } } else { $real_pkgname = $pkgname - $_ensure = $ensure + $_ensure = $ensure } # Check if searching by explicit version. @@ -166,22 +167,22 @@ } $source = $url ? { - false => "${real_pkgname}${extras_string}", - /^(\/|[a-zA-Z]\:)/ => "'${url}'", + false => "${real_pkgname}${extras_string}", + /^(\/|[a-zA-Z]\:)/ => "'${url}'", /^(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+$/ => "'${url}'", - default => "'${url}#egg=${egg_name}'", + default => "'${url}#egg=${egg_name}'", } - $pip_install = "${pip_env} --log ${log}/pip.log install" + $pip_install = "${pip_env} --log ${log}/pip.log install" $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { if $_ensure != present and $_ensure != latest { - $command = "${pip_install} ${install_args} ${pip_common_args}@${_ensure}#egg=${egg_name}" + $command = "${pip_install} ${install_args} ${pip_common_args}@${_ensure}#egg=${egg_name}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } else { - $command = "${pip_install} ${install_args} ${pip_common_args}" + $command = "${pip_install} ${install_args} ${pip_common_args}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } } else { @@ -189,13 +190,13 @@ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/: { # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. - $command = "${pip_install} ${install_args} ${pip_common_args}==${_ensure}" + $command = "${pip_install} ${install_args} ${pip_common_args}==${_ensure}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } 'present': { # Whatever version is available. - $command = "${pip_install} ${pip_common_args}" + $command = "${pip_install} ${pip_common_args}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } @@ -203,24 +204,28 @@ # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join(["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", - ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', - ' | tr -d "[:space:]"']) + $latest_version = join( + ["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", + ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + ' | tr -d "[:space:]"',] + ) # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output - $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') + $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" - $installed_version = join(["${pip_env} freeze --all", + $installed_version = join( + ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", - " | tr -d '[:space:]'"]) + " | tr -d '[:space:]'",] + ) - $command = "${pip_install} --upgrade ${pip_common_args}" + $command = "${pip_install} --upgrade ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" } default: { # Anti-action, uninstall. - $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" + $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" } } diff --git a/manifests/pip/bootstrap.pp b/manifests/pip/bootstrap.pp index 1b69c8ae..b060a6d0 100644 --- a/manifests/pip/bootstrap.pp +++ b/manifests/pip/bootstrap.pp @@ -1,19 +1,19 @@ -# # @summary allow to bootstrap pip when python is managed from other module # # @param version should be pip or pip3 # @param manage_python if python module will manage deps # @param http_proxy Proxy server to use for outbound connections. # -# @example +# @example # class { 'python::pip::bootstrap': # version => 'pip', # } +# class python::pip::bootstrap ( - Enum['pip', 'pip3'] $version = 'pip', - Variant[Boolean, String] $manage_python = false, - Optional[Stdlib::HTTPUrl] $http_proxy = undef, - String[1] $exec_provider = 'shell', + Enum['pip', 'pip3'] $version = 'pip', + Variant[Boolean, String] $manage_python = false, + Optional[Stdlib::HTTPUrl] $http_proxy = undef, + String[1] $exec_provider = 'shell', ) inherits python::params { if $manage_python { include python @@ -40,6 +40,7 @@ require => Package['python3'], provider => $exec_provider, } + # puppet is opinionated about the pip command name file { 'pip3-python': ensure => link, @@ -56,6 +57,7 @@ require => Package['python'], provider => $exec_provider, } + # puppet is opinionated about the pip command name file { 'pip-python': ensure => link, diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 5b0c91f3..aa9bd0fc 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -22,15 +22,15 @@ # } # define python::pyvenv ( - $ensure = present, - $version = 'system', - $systempkgs = false, - $venv_dir = $name, - $owner = 'root', - $group = 'root', - $mode = '0755', - $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin'], - $environment = [], + Python::Package::Ensure $ensure = present, + Python::Version $version = 'system', + Boolean $systempkgs = false, + Stdlib::Absolutepath $venv_dir = $name, + String[1] $owner = 'root', + String[1] $group = 'root', + Stdlib::Filemode $mode = '0755', + Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], + Array $environment = [], ) { include python @@ -40,15 +40,17 @@ default => $version, } - $python_version_parts = split($python_version, '[.]') + $python_version_parts = split($python_version, '[.]') $normalized_python_version = sprintf('%s.%s', $python_version_parts[0], $python_version_parts[1]) # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian') { - $python3_venv_package="python${normalized_python_version}-venv" + $python3_venv_package = "python${normalized_python_version}-venv" + case $facts['os']['distro']['codename'] { - 'xenial','bionic','cosmic','disco','stretch','buster': { - ensure_packages ($python3_venv_package) + 'xenial', 'bionic', 'cosmic', 'disco', 'stretch', 'buster': { + ensure_packages($python3_venv_package) + Package[$python3_venv_package] -> File[$venv_dir] } default: {} @@ -56,7 +58,7 @@ } # pyvenv is deprecated since 3.6 and will be removed in 3.8 - if (versioncmp($normalized_python_version, '3.6') >=0) { + if versioncmp($normalized_python_version, '3.6') >=0 { $virtualenv_cmd = "${python::exec_prefix}python${normalized_python_version} -m venv" } else { $virtualenv_cmd = "${python::exec_prefix}pyvenv-${normalized_python_version}" @@ -67,7 +69,7 @@ default => $path, } - if ( $systempkgs == true ) { + if $systempkgs == true { $system_pkgs_flag = '--system-site-packages' } else { $system_pkgs_flag = '' @@ -80,7 +82,7 @@ mode => $mode, } - $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" exec { "python_virtualenv_${venv_dir}": command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade pip && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", diff --git a/manifests/requirements.pp b/manifests/requirements.pp index e0fbcf2b..836e9097 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -26,21 +26,21 @@ # } # define python::requirements ( - $requirements = $name, - $virtualenv = 'system', - Enum['pip', 'pip3'] $pip_provider = 'pip', - $owner = 'root', - $group = 'root', - Optional[Stdlib::HTTPUrl] $proxy = undef, - $src = false, - $environment = [], - $forceupdate = false, - $cwd = undef, - $extra_pip_args = '', - $manage_requirements = true, - $fix_requirements_owner = true, - $log_dir = '/tmp', - $timeout = 1800, + Stdlib::Absolutepath $requirements = $name, + Variant[Enum['system'],Stdlib::Absolutepath] $virtualenv = 'system', + Enum['pip', 'pip3'] $pip_provider = 'pip', + String[1] $owner = 'root', + String[1] $group = 'root', + Optional[Stdlib::HTTPUrl] $proxy = undef, + Any $src = false, + Array $environment = [], + Boolean $forceupdate = false, + Stdlib::Absolutepath $cwd = undef, + String $extra_pip_args = '', + Boolean $manage_requirements = true, + Boolean $fix_requirements_owner = true, + Stdlib::Absolutepath $log_dir = '/tmp', + Integer $timeout = 1800, ) { include python @@ -88,6 +88,7 @@ replace => false, content => '# Puppet will install and/or update pip packages listed here', } + $local_subscribe = File[$requirements] } else { $local_subscribe = undef diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e19cfa3b..ad3910ad 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -31,29 +31,30 @@ # } # define python::virtualenv ( - $ensure = 'present', - $version = 'system', - $requirements = false, - $systempkgs = false, - $venv_dir = $name, - $ensure_venv_dir = true, - $distribute = true, - $index = false, - $owner = 'root', - $group = 'root', - $mode = '0755', - Optional[Stdlib::HTTPUrl] $proxy = undef, - $environment = [], - $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin'], - $cwd = undef, - $timeout = 1800, - $pip_args = '', - $extra_pip_args = '', - $virtualenv = undef, + Python::Package::Ensure $ensure = 'present', + Python::Version $version = 'system', + Variant[Boolean,Stdlib::Absolutepath] $requirements = false, + Boolean $systempkgs = false, + Stdlib::Absolutepath $venv_dir = $name, + Boolean $ensure_venv_dir = true, + Boolean $distribute = true, + Variant[Boolean,Stdlib::HTTPUrl] $index = false, + String[1] $owner = 'root', + String[1] $group = 'root', + Stdlib::Filemode $mode = '0755', + Optional[Stdlib::HTTPUrl] $proxy = undef, + Array $environment = [], + Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], + Optional[Stdlib::Absolutepath] $cwd = undef, + Integer $timeout = 1800, + String $pip_args = '', + String $extra_pip_args = '', + Optional[Stdlib::Absolutepath] $virtualenv = undef, ) { include python + $python_provider = getparam(Class['python'], 'provider') - $anaconda_path = getparam(Class['python'], 'anaconda_install_path') + $anaconda_path = getparam(Class['python'], 'anaconda_install_path') if $ensure == 'present' { $python = $version ? { @@ -81,8 +82,14 @@ $proxy_hash = $proxy ? { undef => {}, default => $facts['os']['family'] ? { - 'AIX' => { 'http_proxy' => $proxy, 'https_proxy' => $proxy }, - default => { 'HTTP_PROXY' => $proxy, 'HTTPS_PROXY' => $proxy }, + 'AIX' => { + 'http_proxy' => $proxy, + 'https_proxy' => $proxy, + }, + default => { + 'HTTP_PROXY' => $proxy, + 'HTTPS_PROXY' => $proxy, + }, } } @@ -94,15 +101,15 @@ /.*/ => getvar('virtualenv_version'), default => '', } - if (( versioncmp($_virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { + + if versioncmp($_virtualenv_version,'1.7') > 0 and $systempkgs == true { $system_pkgs_flag = '--system-site-packages' - } elsif (( versioncmp($_virtualenv_version,'1.7') < 0 ) and ( $systempkgs == false )) { + } elsif versioncmp($_virtualenv_version,'1.7') < 0 and $systempkgs == false { $system_pkgs_flag = '--no-site-packages' } else { $system_pkgs_flag = $systempkgs ? { true => '--system-site-packages', - false => '--no-site-packages', - default => fail('Invalid value for systempkgs. Boolean value is expected') + default => '--no-site-packages', } } @@ -110,6 +117,7 @@ true => 'distribute', default => 'setuptools', } + $pypi_index = $index ? { false => '', default => "-i ${index}", @@ -132,9 +140,8 @@ } $virtualenv_cmd = "${python::exec_prefix}${used_virtualenv}" - - $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" - $pip_flags = "${pypi_index} ${proxy_flag} ${pip_args}" + $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + $pip_flags = "${pypi_index} ${proxy_flag} ${pip_args}" exec { "python_virtualenv_${venv_dir}": command => "${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", diff --git a/types/loglevel.pp b/types/loglevel.pp new file mode 100644 index 00000000..3cdb653d --- /dev/null +++ b/types/loglevel.pp @@ -0,0 +1,3 @@ +# @summary A version type to match all valid loglevels for python +# +type Python::Loglevel = Enum['debug', 'info', 'warning', 'error', 'critical'] diff --git a/types/package/ensure.pp b/types/package/ensure.pp new file mode 100644 index 00000000..1eb13b82 --- /dev/null +++ b/types/package/ensure.pp @@ -0,0 +1,3 @@ +# @summary A version type to match all valid package ensures for python +# +type Python::Package::Ensure = Enum['absent', 'present', 'latest'] diff --git a/types/provider.pp b/types/provider.pp new file mode 100644 index 00000000..8c7dfd65 --- /dev/null +++ b/types/provider.pp @@ -0,0 +1,3 @@ +# @summary A version type to match all valid provider for python +# +type Python::Provider = Enum['pip', 'scl', 'rhscl', 'anaconda', ''] diff --git a/types/umask.pp b/types/umask.pp new file mode 100644 index 00000000..11296cd0 --- /dev/null +++ b/types/umask.pp @@ -0,0 +1,3 @@ +# @summary A version type to match valid umask for python +# +type Python::Umask = Pattern[/[0-7]{1,4}/] diff --git a/types/version.pp b/types/version.pp new file mode 100644 index 00000000..e0023aef --- /dev/null +++ b/types/version.pp @@ -0,0 +1,8 @@ +# @summary A version type to match all valid versions for python +# +type Python::Version = Pattern[ + /\A(python)?[0-9](\.?[0-9])*/, + /\Apypy\Z/, + /\Asystem\Z/, + /\Arh-python[0-9]{2}(?:-python)?\Z/ +] From 017875f3b1bf6fd290bd61ab27ecc3c7c2748fe8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 2 Dec 2020 20:47:49 +0100 Subject: [PATCH 207/380] python::gunicorn: Fix typo in datatype --- manifests/gunicorn.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 1b2954be..7670f394 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -37,7 +37,7 @@ Stdlib::Absolutepath $dir, Enum['present', 'absent'] $ensure = present, Stdlib::Absolutepath $config_dir = '/etc/gunicorn.d', - Booloean $manage_config_dir = false, + Boolean $manage_config_dir = false, Variant[Boolean,Stdlib::Absolutepath] $virtualenv = false, Enum['wsgi', 'django'] $mode = 'wsgi', Variant[String[1],Boolean] $bind = false, From 153e35cb287c39be182e58d4850e32cb34f45dcd Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 25 Nov 2020 17:41:33 +0100 Subject: [PATCH 208/380] modulesync 4.0.0 --- .github/CONTRIBUTING.md | 5 +- .github/workflows/ci.yml | 75 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 29 ++++++++++++ .msync.yml | 2 +- .pmtignore | 17 ++++++- .sync.yml | 8 ---- .travis.yml | 89 ----------------------------------- Gemfile | 27 +++-------- Rakefile | 9 +++- 9 files changed, 136 insertions(+), 125 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cace33e6..f1f88ccf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,14 +232,14 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake acceptance +bundle exec rake beaker ``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., ```sh -BEAKER_set=centos-7-x64 bundle exec rake acceptance +BEAKER_set=centos-7-x64 bundle exec rake beaker ``` There are default rake tasks for the various acceptance test modules, e.g., @@ -269,7 +269,6 @@ The following strings are known to work: * ubuntu2004 * debian9 * debian10 -* centos6 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b4f47e87 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: pull_request + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + outputs: + beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} + puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} + puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + env: + BUNDLE_WITHOUT: development:test:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run rake validate + run: bundle exec rake validate + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} + env: + BUNDLE_WITHOUT: development:system_tests:release + PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" + name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + run: bundle exec rake + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} + puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - name: Enable IPv6 on docker + run: | + echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json + sudo service docker restart + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..68b85284 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Build and Deploy + env: + # Configure secrets here: + # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets + BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' + BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' + run: bundle exec rake module:push diff --git a/.msync.yml b/.msync.yml index 5758aced..a0770a83 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,2 @@ --- -modulesync_config_version: '3.1.0' +modulesync_config_version: '4.0.0' diff --git a/.pmtignore b/.pmtignore index 4e6d54b8..33a8c65d 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,11 +1,12 @@ docs/ pkg/ +Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ +spec/ +Rakefile .vagrant/ .bundle/ .ruby-version @@ -13,9 +14,21 @@ coverage/ log/ .idea/ .dependencies/ +.github/ .librarian/ Puppetfile.lock *.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml .*.sw? .yardoc/ +.yardopts Dockerfile diff --git a/.sync.yml b/.sync.yml index b3ef79fa..5d21319c 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,11 +1,3 @@ --- -.travis.yml: - secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" - docker_sets: - - set: ubuntu1604-64 - - set: ubuntu1804-64 - - set: debian9-64 - - set: debian10-64 - - set: centos7-64 spec/spec_helper_acceptance.rb: unmanaged: false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 370b9e4d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ ---- -# yamllint disable rule:line-length rule:truthy -os: linux -dist: focal -language: ruby -cache: bundler -before_install: - - yes | gem update --system - - bundle --version -script: - - 'bundle exec rake $CHECK' -jobs: - fast_finish: true - include: - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64 CHECK=beaker - services: docker -branches: - only: - - master - - /^v\d/ -notifications: - email: false - webhooks: https://voxpupu.li/incoming/travis - irc: - on_success: always - on_failure: always - channels: - - "chat.freenode.org#voxpupuli-notifications" -deploy: - provider: puppetforge - username: puppet - password: - secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" - on: - tags: true - # all_branches is required to use tags - all_branches: true - # Only publish the build marked with "DEPLOY_TO_FORGE" - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index 2fce93ce..0d0a9fb2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,5 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" -def location_for(place, fake_version = nil) - if place =~ /^(git[:@][^#]*)#(.*)/ - [fake_version, { :git => $1, :branch => $2, :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path($1), :require => false }] - else - [place, { :require => false }] - end -end - group :test do gem 'voxpupuli-test', '~> 2.1', :require => false gem 'coveralls', :require => false @@ -17,14 +7,13 @@ group :test do end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - gem 'voxpupuli-acceptance', :require => false + gem 'puppet_metadata', '~> 0.3.0', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do @@ -34,15 +23,11 @@ group :release do gem 'puppet-strings', '>= 2.2', :require => false end +gem 'puppetlabs_spec_helper', '~> 2.0', :require => false +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] - -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, :require => false, :groups => [:test] -else - gem 'facter', :require => false, :groups => [:test] -end - -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b450fe7b..d1bf7491 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,10 @@ -require 'voxpupuli/test/rake' +# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + require 'puppetlabs_spec_helper/rake_tasks' +end # load optional tasks for releases # only available if gem group releases is installed @@ -26,6 +32,7 @@ end begin require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| version = (Blacksmith::Modulefile.new).version config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ From e3b28da5a59a2b0461ae9a40ece88b7401d6b4c3 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 2 Dec 2020 20:39:31 +0100 Subject: [PATCH 209/380] puppet-lint: autofix --- manifests/init.pp | 2 +- manifests/pip.pp | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a4cf6957..74c13d66 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -74,7 +74,7 @@ # Set default umask. exec { default: - umask => $umask + umask => $umask, } # Allow hiera configuration of python resources diff --git a/manifests/pip.pp b/manifests/pip.pp index 30d29ce3..cdf34e7d 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -204,20 +204,16 @@ # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join( - ["${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", - ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', - ' | tr -d "[:space:]"',] - ) + $latest_version = join( [ + "${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", + ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + ' | tr -d "[:space:]"', + ]) # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" - $installed_version = join( - ["${pip_env} freeze --all", - " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", - " | tr -d '[:space:]'",] - ) + $installed_version = join( ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",]) $command = "${pip_install} --upgrade ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" From 48a3c981f8c01e4894089c0da6d7e96011d3598b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 2 Dec 2020 21:02:04 +0100 Subject: [PATCH 210/380] fix broken unit tests --- spec/defines/requirements_spec.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index fd950dc9..79f0a9aa 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -15,10 +15,12 @@ context 'with /requirements.txt' do let :params do { - requirements: '/requirements.txt' + requirements: '/requirements.txt', + cwd: '/foo' } end + it { is_expected.to compile.with_all_deps } it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } context 'with manage_requirements => false' do @@ -33,7 +35,8 @@ let :params do { owner: 'bob', - group: 'bob' + group: 'bob', + 'cwd': '/foo' } end @@ -42,8 +45,16 @@ end context 'default' do + let :params do + { + 'cwd': '/foo' + } + end 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}) } + end end end end From 500549f96cb61eb3bffc672a7b11921c11c83b10 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 3 Dec 2020 13:10:46 +0100 Subject: [PATCH 211/380] Update spec/defines/requirements_spec.rb Co-authored-by: Ewoud Kohl van Wijngaarden --- spec/defines/requirements_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 79f0a9aa..aa941e0a 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -36,7 +36,7 @@ { owner: 'bob', group: 'bob', - 'cwd': '/foo' + cwd: '/foo' } end From 79eb9602bf7f561abdc5799f27f2c396419d5820 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 3 Dec 2020 13:11:01 +0100 Subject: [PATCH 212/380] Update spec/defines/requirements_spec.rb Co-authored-by: Ewoud Kohl van Wijngaarden --- spec/defines/requirements_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index aa941e0a..97858b7d 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -52,6 +52,7 @@ end 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}) } end From af69f6bf610a7e05c3d53edadd5d34715f422ecb Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 3 Dec 2020 13:39:33 +0100 Subject: [PATCH 213/380] python::requirements: make cwd optional (again) This was optional before https://github.com/voxpupuli/puppet-python/pull/580 was merged. --- REFERENCE.md | 24 +++++++++++------------ manifests/requirements.pp | 4 ++-- spec/defines/requirements_spec.rb | 32 +++++++++++++++++-------------- 3 files changed, 32 insertions(+), 28 deletions(-) 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 From e938d88209861f51d00859da9582d87773076a7b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 3 Dec 2020 15:30:40 +0100 Subject: [PATCH 214/380] Add pyvenv acceptance test Co-authored-by: Ewoud Kohl van Wijngaarden --- spec/acceptance/pyvenv_spec.rb | 146 +++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 spec/acceptance/pyvenv_spec.rb diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb new file mode 100644 index 00000000..1b9ad1f3 --- /dev/null +++ b/spec/acceptance/pyvenv_spec.rb @@ -0,0 +1,146 @@ +require 'spec_helper_acceptance' + +describe 'python::pyvenv defined resource' do + context 'minimal parameters' do + # Using puppet_apply as a helper + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + end + + context 'with python::pip' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + } + python::pip { 'agent' : + ensure => 'latest', + pkgname => 'agent', + pip_provider => 'pip', + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + end + + context 'with minimal python::pip' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + } + python::pip { 'agent' : + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + end + + context 'with minimal python::pip and without systempkgs' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => false, + owner => 'agent', + group => 'agent', + mode => '0755', + } + python::pip { 'agent' : + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + end +end From 9eee58b66da431d9aed6530e734de755c1805e5b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 7 Dec 2020 17:21:13 +0100 Subject: [PATCH 215/380] enhance pyvenv tests --- spec/acceptance/pyvenv_spec.rb | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index 1b9ad1f3..f648fa31 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -143,4 +143,46 @@ class { 'python': apply_manifest(pp, catch_changes: true) end end + + context 'with versioned minimal python::pip and without systempkgs' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => false, + owner => 'agent', + group => 'agent', + mode => '0755', + } + python::pip { 'agent' : + ensure => '0.1.2', + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe command('/opt/agent/venv/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } + end + end end From 911d4060cb2999e818225083a3903ef5759e2531 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Sat, 12 Dec 2020 16:32:04 -0500 Subject: [PATCH 216/380] Fix python::virtualenv to allow virtualenv to not require absolute path --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ad3910ad..0599b987 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -49,7 +49,7 @@ Integer $timeout = 1800, String $pip_args = '', String $extra_pip_args = '', - Optional[Stdlib::Absolutepath] $virtualenv = undef, + Optional[String[1]] $virtualenv = undef, ) { include python From 2777d4912439232bbe10a3f4178ebe0323503cf1 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Sun, 13 Dec 2020 12:41:14 -0500 Subject: [PATCH 217/380] Add virtualenv unit tests --- spec/defines/virtualenv_spec.rb | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 spec/defines/virtualenv_spec.rb diff --git a/spec/defines/virtualenv_spec.rb b/spec/defines/virtualenv_spec.rb new file mode 100644 index 00000000..3381977b --- /dev/null +++ b/spec/defines/virtualenv_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +describe 'python::virtualenv', 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 + end + let :title do + '/opt/env' + end + + context 'with default parameters' do + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_file('/opt/env') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('virtualenv --no-site-packages -p python /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --proxy= --upgrade pip && /opt/env/bin/pip install --proxy= --upgrade distribute') } + end + + context 'when virtualenv is defined' do + let(:params) {{ virtualenv: 'virtualenv-3' }} + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 --no-site-packages -p python .+}) } + end + + describe 'when ensure' do + context 'is absent' do + let :params do + { + ensure: 'absent' + } + end + + it { + is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true) + } + end + end + end # context + end +end From ff8df6365782515a3f35c3a0b9dabd0528daf034 Mon Sep 17 00:00:00 2001 From: treydock Date: Mon, 14 Dec 2020 11:35:19 -0500 Subject: [PATCH 218/380] Support Ubuntu 20.04 (#593) add support for Ubuntu 20.04 Co-authored-by: Tim Meusel --- manifests/install.pp | 5 ++++- manifests/params.pp | 6 ++++- manifests/pyvenv.pp | 10 ++------- manifests/virtualenv.pp | 33 ++++++++++++---------------- metadata.json | 3 ++- spec/acceptance/facts_test_spec.rb | 1 - spec/acceptance/virtualenv_spec.rb | 35 +++++++++--------------------- spec/defines/pip_spec.rb | 3 ++- spec/defines/virtualenv_spec.rb | 15 ++++++++++--- 9 files changed, 51 insertions(+), 60 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 56ce36ce..ab7daa24 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -284,8 +284,11 @@ $pip_package = 'pip' $pip_provider = 'pip' } else { + $pip_package = $facts['os']['release']['major'] ? { + '20.04' => 'python3-pip', + default => 'python-pip', + } $pip_category = undef - $pip_package = 'python-pip' $pip_provider = 'pip' } diff --git a/manifests/params.pp b/manifests/params.pp index 338f9bd9..e90e214d 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -10,7 +10,6 @@ } $ensure = 'present' - $version = 'system' $pip = 'present' $dev = 'absent' $virtualenv = 'absent' @@ -46,4 +45,9 @@ 'RedHat' => 'python-gunicorn', default => 'gunicorn', } + + $version = $facts['os']['release']['major'] ? { + '20.04' => '3', + default => 'system', + } } diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index aa9bd0fc..1f1dd573 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -46,15 +46,9 @@ # Debian splits the venv module into a seperate package if ( $facts['os']['family'] == 'Debian') { $python3_venv_package = "python${normalized_python_version}-venv" + ensure_packages($python3_venv_package) - case $facts['os']['distro']['codename'] { - 'xenial', 'bionic', 'cosmic', 'disco', 'stretch', 'buster': { - ensure_packages($python3_venv_package) - - Package[$python3_venv_package] -> File[$venv_dir] - } - default: {} - } + Package[$python3_venv_package] -> File[$venv_dir] } # pyvenv is deprecated since 3.6 and will be removed in 3.8 diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 0599b987..d4c8228d 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -7,7 +7,10 @@ # @param systempkgs Copy system site-packages into virtualenv. # @param venv_dir Directory to install virtualenv to # @param ensure_venv_dir Create $venv_dir -# @param distribute Include distribute in the virtualenv +# @param distribute +# Include distribute in the virtualenv +# Forced to `false` for Ubuntu 18.04 and 20.04 +# Forced to `false` for RedHat based systems # @param index Base URL of Python package index # @param owner The owner of the virtualenv being manipulated # @param group The group relating to the virtualenv being manipulated @@ -93,31 +96,23 @@ } } - # Virtualenv versions prior to 1.7 do not support the - # --system-site-packages flag, default off for prior versions - # Prior to version 1.7 the default was equal to --system-site-packages - # and the flag --no-site-packages had to be passed to do the opposite - $_virtualenv_version = getvar('virtualenv_version') ? { - /.*/ => getvar('virtualenv_version'), + $system_pkgs_flag = $systempkgs ? { + true => '--system-site-packages', default => '', } - if versioncmp($_virtualenv_version,'1.7') > 0 and $systempkgs == true { - $system_pkgs_flag = '--system-site-packages' - } elsif versioncmp($_virtualenv_version,'1.7') < 0 and $systempkgs == false { - $system_pkgs_flag = '--no-site-packages' + # Installing distribute does not work on these operating systems + if $facts.dig('os','distro','codename') in ['focal', 'bionic', 'buster'] { + $distribute_pkg = 'setuptools' + } elsif $facts['os']['family'] == 'RedHat' { + $distribute_pkg = 'setuptools' } else { - $system_pkgs_flag = $systempkgs ? { - true => '--system-site-packages', - default => '--no-site-packages', + $distribute_pkg = $distribute ? { + true => 'distribute', + default => 'setuptools', } } - $distribute_pkg = $distribute ? { - true => 'distribute', - default => 'setuptools', - } - $pypi_index = $index ? { false => '', default => "-i ${index}", diff --git a/metadata.json b/metadata.json index 69895173..301a05cc 100644 --- a/metadata.json +++ b/metadata.json @@ -42,7 +42,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "16.04", - "18.04" + "18.04", + "20.04" ] }, { diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 39c1ad83..ce5b2cfa 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -4,7 +4,6 @@ context 'facts' do install_python = <<-EOS class { 'python' : - version => 'system', pip => 'present', virtualenv => 'present', } diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb index 13e5888d..ca8d91b2 100644 --- a/spec/acceptance/virtualenv_spec.rb +++ b/spec/acceptance/virtualenv_spec.rb @@ -32,11 +32,8 @@ class { 'python' : it 'maintains pip version' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + class { 'python' : version => $version, pip => 'present', @@ -61,11 +58,8 @@ class { 'python' : it 'works with ensure=>latest' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + class { 'python' : version => $version, pip => 'present', @@ -92,11 +86,8 @@ class { 'python' : it 'works with ensure=>latest for package with underscore in its name' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + class { 'python' : version => $version, pip => 'present', @@ -123,11 +114,8 @@ class { 'python' : it 'works with editable=>true' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + package{ 'git' : ensure => 'present', } @@ -157,11 +145,8 @@ class { 'python' : it 'works with == in pkgname' do pp = <<-EOS - if $facts['os']['name'] == 'Ubuntu' and $facts['os']['release']['major'] == '16.04' { - $version = '3' - } else { - $version = 'system' - } + $version = '3' + class { 'python' : version => $version, pip => 'present', diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index e623dc42..3ae5a61a 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -10,7 +10,8 @@ kernel: 'Linux', lsbdistcodename: 'squeeze', os: { - family: 'Debian' + family: 'Debian', + release: { major: '6' }, }, osfamily: 'Debian', operatingsystem: 'Debian', diff --git a/spec/defines/virtualenv_spec.rb b/spec/defines/virtualenv_spec.rb index 3381977b..852f9596 100644 --- a/spec/defines/virtualenv_spec.rb +++ b/spec/defines/virtualenv_spec.rb @@ -10,18 +10,27 @@ let :title do '/opt/env' end + let(:distribute_pkg) do + if facts[:os]['family'] == 'Debian' && %w[focal bionic buster].include?(facts[:os]['distro']['codename']) + 'setuptools' + elsif facts[:os]['family'] == 'RedHat' + 'setuptools' + else + 'distribute' + end + end context 'with default parameters' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_file('/opt/env') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('virtualenv --no-site-packages -p python /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --proxy= --upgrade pip && /opt/env/bin/pip install --proxy= --upgrade distribute') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command("virtualenv -p python /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --proxy= --upgrade pip && /opt/env/bin/pip install --proxy= --upgrade #{distribute_pkg}") } end context 'when virtualenv is defined' do - let(:params) {{ virtualenv: 'virtualenv-3' }} + let(:params) { { virtualenv: 'virtualenv-3' } } it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 --no-site-packages -p python .+}) } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 -p python .+}) } end describe 'when ensure' do From bae5907138967bf73756a96b5802c4f1b39fc383 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Sun, 13 Dec 2020 11:50:08 -0500 Subject: [PATCH 219/380] Support RedHat/CentOS 8 --- manifests/install.pp | 4 ++++ manifests/params.pp | 9 ++++++--- metadata.json | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index ab7daa24..cc8b1411 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -275,6 +275,10 @@ $pip_category = undef $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') + } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { + $pip_category = undef + $pip_package = 'python3-pip' + $pip_provider = pip3 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { $pip_category = undef $pip_package = 'python2-pip' diff --git a/manifests/params.pp b/manifests/params.pp index e90e214d..89a5ccce 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -46,8 +46,11 @@ default => 'gunicorn', } - $version = $facts['os']['release']['major'] ? { - '20.04' => '3', - default => 'system', + if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { + $version = '3' + } elsif $facts['os']['release']['major'] == '20.04' { + $version = '3' + } else { + $version = 'system' } } diff --git a/metadata.json b/metadata.json index 301a05cc..29c1336a 100644 --- a/metadata.json +++ b/metadata.json @@ -25,7 +25,8 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "7", + "8" ] }, { From 6f66bc29a55edf8975792444e50b49676990618b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 15 Dec 2020 13:30:04 +0100 Subject: [PATCH 220/380] Drop python::virtualenv defined resource The whole virtualenv setup is deprecated upstream. pyvenv / the built-in python module venv should be used. Since we already have a few backwards incompatible changes on master, it makes sense to drop this now. --- REFERENCE.md | 206 +---------------------------- manifests/config.pp | 3 - manifests/init.pp | 9 +- manifests/install.pp | 72 +--------- manifests/pip.pp | 1 - manifests/virtualenv.pp | 182 ------------------------- spec/acceptance/class_spec.rb | 5 +- spec/acceptance/facts_test_spec.rb | 4 - spec/acceptance/virtualenv_spec.rb | 171 ------------------------ spec/classes/python_spec.rb | 139 ++----------------- spec/defines/requirements_spec.rb | 1 - spec/defines/virtualenv_spec.rb | 51 ------- 12 files changed, 17 insertions(+), 827 deletions(-) delete mode 100644 manifests/virtualenv.pp delete mode 100644 spec/acceptance/virtualenv_spec.rb delete mode 100644 spec/defines/virtualenv_spec.rb diff --git a/REFERENCE.md b/REFERENCE.md index d08c17ac..555cb05a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -8,7 +8,7 @@ #### Public Classes -* [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn. +* [`python`](#python): Installs and manages python, python-dev and gunicorn. * [`python::pip::bootstrap`](#pythonpipbootstrap): allow to bootstrap pip when python is managed from other module #### Private Classes @@ -24,7 +24,6 @@ * [`python::pip`](#pythonpip): Installs and manages packages from pip. * [`python::pyvenv`](#pythonpyvenv): Create a Python3 virtualenv using pyvenv. * [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. -* [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv. ### Data types @@ -38,7 +37,7 @@ ### `python` -Installs and manages python, python-dev, python-virtualenv and gunicorn. +Installs and manages python, python-dev and gunicorn. #### Examples @@ -49,7 +48,6 @@ class { 'python': version => 'system', pip => 'present', dev => 'present', - virtualenv => 'present', gunicorn => 'present', } ``` @@ -61,7 +59,6 @@ class { 'python' : ensure => 'present', version => 'rh-python36-python', dev => 'present', - virtualenv => 'present', } ``` @@ -108,14 +105,6 @@ Desired installation state for the python-dev package. Default value: `$python::params::dev` -##### `virtualenv` - -Data type: `Python::Package::Ensure` - -Desired installation state for the virtualenv package - -Default value: `$python::params::virtualenv` - ##### `gunicorn` Data type: `Python::Package::Ensure` @@ -172,14 +161,6 @@ Data type: `Boolean` Default value: `$python::params::manage_python_package` -##### `manage_virtualenv_package` - -Data type: `Boolean` - - - -Default value: `$python::params::manage_virtualenv_package` - ##### `manage_pip_package` Data type: `Boolean` @@ -202,14 +183,6 @@ Data type: `Hash` -Default value: `{}` - -##### `python_virtualenvs` - -Data type: `Hash` - - - Default value: `{}` ##### `python_pyvenvs` @@ -1023,181 +996,6 @@ The maximum time in seconds the "pip install" command should take. Default value: `1800` -### `python::virtualenv` - -Creates Python virtualenv. - -#### Examples - -##### install a virtual env at /var/www/project1 - -```puppet -python::virtualenv { '/var/www/project1': - ensure => present, - version => 'system', - requirements => '/var/www/project1/requirements.txt', - proxy => 'http://proxy.domain.com:3128', - systempkgs => true, - index => 'http://www.example.com/simple/', -} -``` - -#### Parameters - -The following parameters are available in the `python::virtualenv` defined type. - -##### `ensure` - -Data type: `Python::Package::Ensure` - - - -Default value: `'present'` - -##### `version` - -Data type: `Python::Version` - -Python version to use. - -Default value: `'system'` - -##### `requirements` - -Data type: `Variant[Boolean,Stdlib::Absolutepath]` - -Path to pip requirements.txt file - -Default value: ``false`` - -##### `systempkgs` - -Data type: `Boolean` - -Copy system site-packages into virtualenv. - -Default value: ``false`` - -##### `venv_dir` - -Data type: `Stdlib::Absolutepath` - -Directory to install virtualenv to - -Default value: `$name` - -##### `ensure_venv_dir` - -Data type: `Boolean` - -Create $venv_dir - -Default value: ``true`` - -##### `distribute` - -Data type: `Boolean` - -Include distribute in the virtualenv - -Default value: ``true`` - -##### `index` - -Data type: `Variant[Boolean,Stdlib::HTTPUrl]` - -Base URL of Python package index - -Default value: ``false`` - -##### `owner` - -Data type: `String[1]` - -The owner of the virtualenv being manipulated - -Default value: `'root'` - -##### `group` - -Data type: `String[1]` - -The group relating to the virtualenv being manipulated - -Default value: `'root'` - -##### `mode` - -Data type: `Stdlib::Filemode` - -Optionally specify directory mode - -Default value: `'0755'` - -##### `proxy` - -Data type: `Optional[Stdlib::HTTPUrl]` - -Proxy server to use for outbound connections - -Default value: ``undef`` - -##### `environment` - -Data type: `Array` - -Additional environment variables required to install the packages - -Default value: `[]` - -##### `path` - -Data type: `Array[Stdlib::Absolutepath]` - -Specifies the PATH variable - -Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` - -##### `cwd` - -Data type: `Optional[Stdlib::Absolutepath]` - -The directory from which to run the "pip install" command - -Default value: ``undef`` - -##### `timeout` - -Data type: `Integer` - -The maximum time in seconds the "pip install" command should take - -Default value: `1800` - -##### `pip_args` - -Data type: `String` - -Arguments to pass to pip during initialization - -Default value: `''` - -##### `extra_pip_args` - -Data type: `String` - -Extra arguments to pass to pip after requirements file - -Default value: `''` - -##### `virtualenv` - -Data type: `Optional[Stdlib::Absolutepath]` - - - -Default value: ``undef`` - ## Data types ### `Python::Loglevel` diff --git a/manifests/config.pp b/manifests/config.pp index dfff33b6..8c313313 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -7,9 +7,6 @@ class python::config { Class['python::install'] -> Python::Pip <| |> Class['python::install'] -> Python::Requirements <| |> - Class['python::install'] -> Python::Virtualenv <| |> - - Python::Virtualenv <| |> -> Python::Pip <| |> if $python::manage_gunicorn { unless $python::gunicorn == 'absent' { diff --git a/manifests/init.pp b/manifests/init.pp index 74c13d66..a184b2aa 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,4 +1,4 @@ -# @summary Installs and manages python, python-dev, python-virtualenv and gunicorn. +# @summary Installs and manages python, python-dev and gunicorn. # # @param ensure Desired installation state for the Python package. # @param version Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. @@ -11,7 +11,6 @@ # package, if available on your osfamily. # @param pip Desired installation state for the python-pip package. # @param dev Desired installation state for the python-dev package. -# @param virtualenv Desired installation state for the virtualenv package # @param gunicorn Desired installation state for Gunicorn. # @param manage_gunicorn Allow Installation / Removal of Gunicorn. # @param provider What provider to use for installation of the packages, except gunicorn and Python itself. @@ -24,7 +23,6 @@ # version => 'system', # pip => 'present', # dev => 'present', -# virtualenv => 'present', # gunicorn => 'present', # } # @example install python3 from scl repo @@ -32,7 +30,6 @@ # ensure => 'present', # version => 'rh-python36-python', # dev => 'present', -# virtualenv => 'present', # } # class python ( @@ -40,16 +37,13 @@ Python::Version $version = $python::params::version, Python::Package::Ensure $pip = $python::params::pip, Python::Package::Ensure $dev = $python::params::dev, - Python::Package::Ensure $virtualenv = $python::params::virtualenv, Python::Package::Ensure $gunicorn = $python::params::gunicorn, Boolean $manage_gunicorn = $python::params::manage_gunicorn, Boolean $manage_python_package = $python::params::manage_python_package, - Boolean $manage_virtualenv_package = $python::params::manage_virtualenv_package, Boolean $manage_pip_package = $python::params::manage_pip_package, String[1] $gunicorn_package_name = $python::params::gunicorn_package_name, Optional[Python::Provider] $provider = $python::params::provider, Hash $python_pips = {}, - Hash $python_virtualenvs = {}, Hash $python_pyvenvs = {}, Hash $python_requirements = {}, Hash $python_dotfiles = {}, @@ -80,7 +74,6 @@ # Allow hiera configuration of python resources create_resources('python::pip', $python_pips) create_resources('python::pyvenv', $python_pyvenvs) - create_resources('python::virtualenv', $python_virtualenvs) create_resources('python::requirements', $python_requirements) create_resources('python::dotfile', $python_dotfiles) } diff --git a/manifests/install.pp b/manifests/install.pp index cc8b1411..64f9350e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,26 +28,10 @@ default => $python::pip, } - $venv_ensure = $python::virtualenv ? { + $dev_ensure = $python::dev ? { true => 'present', false => 'absent', - default => $python::virtualenv, - } - - if $venv_ensure == 'present' { - $dev_ensure = 'present' - - unless $python::dev { - # Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch - # Python dev is required for virtual environment, but python environment is not required for python dev. - notify { 'Python virtual environment is dependent on python dev': } - } - } else { - $dev_ensure = $python::dev ? { - true => 'present', - false => 'absent', - default => $python::dev, - } + default => $python::dev, } if $python::manage_python_package { @@ -57,14 +41,6 @@ } } - if $python::manage_virtualenv_package { - package { 'virtualenv': - ensure => $venv_ensure, - name => "${python}-virtualenv", - require => Package['python'], - } - } - case $python::provider { 'pip': { if $python::manage_pip_package { @@ -92,19 +68,6 @@ name => 'pip', provider => 'pip', } - - if $pythondev { - Package <| title == 'virtualenv' |> { - name => 'virtualenv', - provider => 'pip', - require => Package['python-dev'], - } - } else { - Package <| title == 'virtualenv' |> { - name => 'virtualenv', - provider => 'pip', - } - } } } 'scl': { @@ -244,30 +207,9 @@ } } - case $facts['os']['family'] { - 'RedHat': { - if $pip_ensure != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { - require epel - } - - if $venv_ensure != 'absent' and $facts['os']['release']['full'] =~ /^6/ and $python::use_epel { - require epel - } - - $virtualenv_package = "${python}-virtualenv" - } - 'Debian': { - if fact('lsbdistcodename') == 'trusty' { - $virtualenv_package = 'python-virtualenv' - } else { - $virtualenv_package = 'virtualenv' - } - } - 'Gentoo': { - $virtualenv_package = 'virtualenv' - } - default: { - $virtualenv_package = 'python-virtualenv' + if $facts['os']['family'] == 'RedHat' { + if $pip_ensure != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { + require epel } } @@ -300,10 +242,6 @@ name => $pip_package, category => $pip_category, } - - Package <| title == 'virtualenv' |> { - name => $virtualenv_package, - } } } diff --git a/manifests/pip.pp b/manifests/pip.pp index cdf34e7d..35d46900 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -74,7 +74,6 @@ if $virtualenv != 'system' { Python::Pyvenv <| |> -> Python::Pip[$name] - Python::Virtualenv <| |> -> Python::Pip[$name] } # Get SCL exec prefix diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp deleted file mode 100644 index d4c8228d..00000000 --- a/manifests/virtualenv.pp +++ /dev/null @@ -1,182 +0,0 @@ -# -# @summary Creates Python virtualenv. -# -# @param ensure -# @param version Python version to use. -# @param requirements Path to pip requirements.txt file -# @param systempkgs Copy system site-packages into virtualenv. -# @param venv_dir Directory to install virtualenv to -# @param ensure_venv_dir Create $venv_dir -# @param distribute -# Include distribute in the virtualenv -# Forced to `false` for Ubuntu 18.04 and 20.04 -# Forced to `false` for RedHat based systems -# @param index Base URL of Python package index -# @param owner The owner of the virtualenv being manipulated -# @param group The group relating to the virtualenv being manipulated -# @param mode Optionally specify directory mode -# @param proxy Proxy server to use for outbound connections -# @param environment Additional environment variables required to install the packages -# @param path Specifies the PATH variable -# @param cwd The directory from which to run the "pip install" command -# @param timeout The maximum time in seconds the "pip install" command should take -# @param pip_args Arguments to pass to pip during initialization -# @param extra_pip_args Extra arguments to pass to pip after requirements file -# -# @example install a virtual env at /var/www/project1 -# python::virtualenv { '/var/www/project1': -# ensure => present, -# version => 'system', -# requirements => '/var/www/project1/requirements.txt', -# proxy => 'http://proxy.domain.com:3128', -# systempkgs => true, -# index => 'http://www.example.com/simple/', -# } -# -define python::virtualenv ( - Python::Package::Ensure $ensure = 'present', - Python::Version $version = 'system', - Variant[Boolean,Stdlib::Absolutepath] $requirements = false, - Boolean $systempkgs = false, - Stdlib::Absolutepath $venv_dir = $name, - Boolean $ensure_venv_dir = true, - Boolean $distribute = true, - Variant[Boolean,Stdlib::HTTPUrl] $index = false, - String[1] $owner = 'root', - String[1] $group = 'root', - Stdlib::Filemode $mode = '0755', - Optional[Stdlib::HTTPUrl] $proxy = undef, - Array $environment = [], - Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], - Optional[Stdlib::Absolutepath] $cwd = undef, - Integer $timeout = 1800, - String $pip_args = '', - String $extra_pip_args = '', - Optional[String[1]] $virtualenv = undef, -) { - include python - - $python_provider = getparam(Class['python'], 'provider') - $anaconda_path = getparam(Class['python'], 'anaconda_install_path') - - if $ensure == 'present' { - $python = $version ? { - 'system' => 'python', - 'pypy' => 'pypy', - default => "python${version}", - } - - $_path = $python_provider ? { - 'anaconda' => concat(["${anaconda_path}/bin"], $path), - default => $path, - } - - if $virtualenv == undef { - $used_virtualenv = 'virtualenv' - } else { - $used_virtualenv = $virtualenv - } - - $proxy_flag = $proxy ? { - false => '', - default => "--proxy=${proxy}", - } - - $proxy_hash = $proxy ? { - undef => {}, - default => $facts['os']['family'] ? { - 'AIX' => { - 'http_proxy' => $proxy, - 'https_proxy' => $proxy, - }, - default => { - 'HTTP_PROXY' => $proxy, - 'HTTPS_PROXY' => $proxy, - }, - } - } - - $system_pkgs_flag = $systempkgs ? { - true => '--system-site-packages', - default => '', - } - - # Installing distribute does not work on these operating systems - if $facts.dig('os','distro','codename') in ['focal', 'bionic', 'buster'] { - $distribute_pkg = 'setuptools' - } elsif $facts['os']['family'] == 'RedHat' { - $distribute_pkg = 'setuptools' - } else { - $distribute_pkg = $distribute ? { - true => 'distribute', - default => 'setuptools', - } - } - - $pypi_index = $index ? { - false => '', - default => "-i ${index}", - } - - # Python 2.6 and older does not support setuptools/distribute > 0.8 which - # is required for pip wheel support, pip therefor requires --no-use-wheel flag - # if the # pip version is more recent than 1.4.1 but using an old python or - # setuputils/distribute version - # To check for this we test for wheel parameter using help and then using - # version, this makes sure we only use wheels if they are supported - - if $ensure_venv_dir { - file { $venv_dir: - ensure => directory, - owner => $owner, - group => $group, - mode => $mode, - } - } - - $virtualenv_cmd = "${python::exec_prefix}${used_virtualenv}" - $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" - $pip_flags = "${pypi_index} ${proxy_flag} ${pip_args}" - - exec { "python_virtualenv_${venv_dir}": - command => "${virtualenv_cmd} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_flags} --upgrade pip && ${pip_cmd} install ${pip_flags} --upgrade ${distribute_pkg}", - user => $owner, - creates => "${venv_dir}/bin/activate", - path => $_path, - cwd => '/tmp', - environment => (Hash($environment.map |$val| { $val.split(/=|$/) }) + $proxy_hash).map|$key, $val| { "${key}=${val}" }, - unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv - require => File[$venv_dir], - } - - if $requirements { - exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${pip_cmd} --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --no-binary :all: -r ${requirements} ${extra_pip_args}", - refreshonly => true, - timeout => $timeout, - user => $owner, - subscribe => Exec["python_virtualenv_${venv_dir}"], - environment => $environment, - cwd => $cwd, - } - - python::requirements { "${requirements}_${venv_dir}": - requirements => $requirements, - virtualenv => $venv_dir, - proxy => $proxy, - owner => $owner, - group => $group, - cwd => $cwd, - require => Exec["python_virtualenv_${venv_dir}"], - extra_pip_args => $extra_pip_args, - } - } - } elsif $ensure == 'absent' { - file { $venv_dir: - ensure => absent, - force => true, - recurse => true, - purge => true, - } - } -} diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 09ced05e..5caac95e 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -4,9 +4,7 @@ context 'default parameters' do # Using puppet_apply as a helper it 'works with no errors' do - pp = <<-EOS - class { 'python': } - EOS + pp = 'include python' # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) @@ -23,7 +21,6 @@ class { 'python': version => '3', pip => 'present', dev => 'present', - virtualenv => 'present', } EOS diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index ce5b2cfa..20f3c54a 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -5,7 +5,6 @@ install_python = <<-EOS class { 'python' : pip => 'present', - virtualenv => 'present', } EOS @@ -13,7 +12,6 @@ class { 'python' : notify{"pip_version: ${facts['pip_version']}":} notify{"system_python_version: ${facts['system_python_version']}":} notify{"python_version: ${facts['python_version']}":} - notify{"virtualenv_version: ${facts['virtualenv_version']}":} EOS # rubocop:disable RSpec/RepeatedExample @@ -21,7 +19,6 @@ class { 'python' : apply_manifest(fact_notices, catch_failures: true) do |r| expect(r.stdout).to match(%r{python_version: \S+}) expect(r.stdout).to match(%r{pip_version: \S+}) - expect(r.stdout).to match(%r{virtualenv_version: \S+}) expect(r.stdout).to match(%r{system_python_version: \S+}) end end @@ -34,7 +31,6 @@ class { 'python' : apply_manifest(fact_notices, catch_failures: true) do |r| expect(r.stdout).to match(%r{python_version: \S+}) expect(r.stdout).to match(%r{pip_version: \S+}) - expect(r.stdout).to match(%r{virtualenv_version: \S+}) expect(r.stdout).to match(%r{system_python_version: \S+}) end end diff --git a/spec/acceptance/virtualenv_spec.rb b/spec/acceptance/virtualenv_spec.rb deleted file mode 100644 index ca8d91b2..00000000 --- a/spec/acceptance/virtualenv_spec.rb +++ /dev/null @@ -1,171 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'python class' do - context 'default parameters' do - # Using puppet_apply as a helper - it 'works with no errors' do - pp = <<-EOS - $version = '3' - - class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - distribute => false, - venv_dir => '/opt/venv', - } - -> python::pip { 'rpyc' : - ensure => '3.2.3', - virtualenv => '/opt/venv', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - it 'maintains pip version' do - pp = <<-EOS - $version = '3' - - class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - venv_dir => '/opt/venv2', - } - -> python::pip { 'pip' : - ensure => '18.0', - virtualenv => '/opt/venv2', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - it 'works with ensure=>latest' do - pp = <<-EOS - $version = '3' - - class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - venv_dir => '/opt/venv3', - } - -> python::pip { 'rpyc' : - ensure => 'latest', - virtualenv => '/opt/venv3', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - # Of course this test will fail if between the applies a new version of the package will be released, - # but probability of this happening is minimal, so it should be acceptable. - apply_manifest(pp, catch_changes: true) - end - - it 'works with ensure=>latest for package with underscore in its name' do - pp = <<-EOS - $version = '3' - - class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - venv_dir => '/opt/venv4', - } - -> python::pip { 'int_date' : - ensure => 'latest', - virtualenv => '/opt/venv4', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - # Of course this test will fail if between the applies a new version of the package will be released, - # but probability of this happening is minimal, so it should be acceptable. - apply_manifest(pp, catch_changes: true) - end - - it 'works with editable=>true' do - pp = <<-EOS - $version = '3' - - package{ 'git' : - ensure => 'present', - } - -> class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - venv_dir => '/opt/venv5', - } - -> python::pip { 'rpyc' : - ensure => '4.1.0', - url => 'git+https://github.com/tomerfiliba/rpyc.git', - editable => true, - virtualenv => '/opt/venv5', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - it 'works with == in pkgname' do - pp = <<-EOS - $version = '3' - - class { 'python' : - version => $version, - pip => 'present', - virtualenv => 'present', - } - -> python::virtualenv { 'venv' : - ensure => 'present', - version => $version, - systempkgs => false, - venv_dir => '/opt/venv6', - } - -> python::pip { 'rpyc==4.1.0' : - virtualenv => '/opt/venv6', - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - end -end diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 92712bdd..28f5f1f4 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'python', type: :class do +describe 'python' do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' context "on #{os}" do @@ -14,7 +14,6 @@ it { is_expected.to contain_class('python::params') } it { is_expected.to contain_class('python::config') } it { is_expected.to contain_package('python') } - it { is_expected.to contain_package('virtualenv') } it { is_expected.to contain_package('pip') } end @@ -22,14 +21,12 @@ let :params do { manage_python_package: false, - manage_virtualenv_package: false, manage_pip_package: false } end it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_package('python') } - it { is_expected.not_to contain_package('virtualenv') } it { is_expected.not_to contain_package('pip') } end @@ -43,8 +40,6 @@ it { is_expected.to contain_package('python') } it { is_expected.to contain_package('python-dev') } it { is_expected.to contain_package('pip') } - # Basic python packages (from pip) - it { is_expected.to contain_package('virtualenv') } describe 'with python::version' do context 'python3.7' do @@ -54,7 +49,6 @@ it { is_expected.to contain_package('pip').with_name('python3.7-pip') } it { is_expected.to contain_package('python').with_name('python3.7') } it { is_expected.to contain_package('python-dev').with_name('python3.7-dev') } - it { is_expected.to contain_package('virtualenv').with_name('virtualenv') } end end @@ -71,47 +65,12 @@ end end - describe 'with python::virtualenv, without python::dev' do - context 'true' do - let(:params) { { dev: 'absent', virtualenv: 'present' } } - - it { is_expected.to contain_package('python-dev').with_ensure('present') } - end + describe 'without python::dev' do context 'empty/default' do it { is_expected.to contain_package('python-dev').with_ensure('absent') } end end - describe 'with python::python_virtualenvs' do - context 'when `proxy` set' do - let(:params) do - { - python_virtualenvs: { - '/opt/env1' => { - proxy: 'http://example.com:3128' - } - } - } - end - - it { is_expected.to contain_exec('python_virtualenv_/opt/env1').with_environment(['HTTP_PROXY=http://example.com:3128', 'HTTPS_PROXY=http://example.com:3128']) } - end - context 'when `proxy` and `environment` have conflicting parameters' do - let(:params) do - { - python_virtualenvs: { - '/opt/env1' => { - proxy: 'http://example.com:3128', - environment: ['HTTP_PROXY=http://example.com:8080'] - } - } - } - end - - it { is_expected.to contain_exec('python_virtualenv_/opt/env1').with_environment(['HTTP_PROXY=http://example.com:3128', 'HTTPS_PROXY=http://example.com:3128']) } - end - end - describe 'with python::python_pyvenvs' do context 'with two pyenvs' do let(:params) do @@ -131,6 +90,10 @@ it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') } it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env1') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env2') } + it { is_expected.to contain_file('/opt/env1') } + it { is_expected.to contain_file('/opt/env2') } end end @@ -155,40 +118,14 @@ context 'pip' do let(:params) { { pip: 'present', provider: 'pip' } } - it { - is_expected.to contain_package('virtualenv').with( - 'provider' => 'pip' - ) - } - it { - is_expected.to contain_package('pip').with( - 'provider' => 'pip' - ) - } + it { is_expected.to contain_package('pip').with('provider' => 'pip') } end # python::provider context 'default' do let(:params) { { provider: '' } } - it { is_expected.to contain_package('virtualenv') } it { is_expected.to contain_package('pip') } - - describe 'with python::virtualenv' do - context 'true' do - let(:params) { { provider: '', virtualenv: 'present' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('present') } - end - end - - describe 'without python::virtualenv' do - context 'default/empty' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('absent') } - end - end end end @@ -237,7 +174,6 @@ it { is_expected.to contain_package('pip').with_name('python36-pip') } it { is_expected.to contain_package('python').with_name('python36') } it { is_expected.to contain_package('python-dev').with_name('python36-devel') } - it { is_expected.to contain_package('virtualenv').with_name('python36-virtualenv') } end end describe 'with python::provider' do @@ -283,8 +219,6 @@ it { is_expected.to contain_package('python-dev').with_name('python-devel') } it { is_expected.to contain_package('python-dev').with_alias('python-devel') } it { is_expected.to contain_package('pip') } - # Basic python packages (from pip) - it { is_expected.to contain_package('virtualenv') } describe 'with python::dev' do context 'true' do @@ -318,11 +252,6 @@ context 'pip' do let(:params) { { provider: 'pip' } } - it { - is_expected.to contain_package('virtualenv').with( - 'provider' => 'pip' - ) - } it { is_expected.to contain_package('pip').with( 'provider' => 'pip' @@ -334,24 +263,7 @@ context 'default' do let(:params) { { provider: '' } } - it { is_expected.to contain_package('virtualenv') } it { is_expected.to contain_package('pip') } - - describe 'with python::virtualenv' do - context 'true' do - let(:params) { { provider: '', virtualenv: 'present' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('present') } - end - end - - describe 'with python::virtualenv' do - context 'default/empty' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('absent') } - end - end end end @@ -379,8 +291,6 @@ # Base debian packages. it { is_expected.to contain_package('python') } it { is_expected.to contain_package('pip').with('category' => 'dev-python') } - # Basic python packages (from pip) - it { is_expected.to contain_package('virtualenv') } # Python::Dev it { is_expected.not_to contain_package('python-dev') } @@ -405,40 +315,7 @@ context 'pip' do let(:params) { { pip: 'present', provider: 'pip' } } - it { - is_expected.to contain_package('virtualenv').with( - 'provider' => 'pip' - ) - } - it { - is_expected.to contain_package('pip').with( - 'provider' => 'pip' - ) - } - end - - # python::provider - context 'default' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv') } - it { is_expected.to contain_package('pip') } - - describe 'with python::virtualenv' do - context 'true' do - let(:params) { { provider: '', virtualenv: 'present' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('present') } - end - end - - describe 'with python::virtualenv' do - context 'default/empty' do - let(:params) { { provider: '' } } - - it { is_expected.to contain_package('virtualenv').with_ensure('absent') } - end - end + it { is_expected.to contain_package('pip').with('provider' => 'pip') } end end end diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 84204a43..17db0595 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -50,7 +50,6 @@ 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') } diff --git a/spec/defines/virtualenv_spec.rb b/spec/defines/virtualenv_spec.rb deleted file mode 100644 index 852f9596..00000000 --- a/spec/defines/virtualenv_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper' - -describe 'python::virtualenv', 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 - end - let :title do - '/opt/env' - end - let(:distribute_pkg) do - if facts[:os]['family'] == 'Debian' && %w[focal bionic buster].include?(facts[:os]['distro']['codename']) - 'setuptools' - elsif facts[:os]['family'] == 'RedHat' - 'setuptools' - else - 'distribute' - end - end - - context 'with default parameters' do - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_file('/opt/env') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command("virtualenv -p python /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --proxy= --upgrade pip && /opt/env/bin/pip install --proxy= --upgrade #{distribute_pkg}") } - end - - context 'when virtualenv is defined' do - let(:params) { { virtualenv: 'virtualenv-3' } } - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command(%r{virtualenv-3 -p python .+}) } - end - - describe 'when ensure' do - context 'is absent' do - let :params do - { - ensure: 'absent' - } - end - - it { - is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true) - } - end - end - end # context - end -end From c0e9c2625365fd7ebeee0bde2bf221f2e575f70a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 15 Dec 2020 15:30:49 +0100 Subject: [PATCH 221/380] pyvenv: increase default timeout debian sometimes takes a bit longer in CI to pass, this fixes it. --- manifests/pyvenv.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 1f1dd573..269cf69c 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -85,6 +85,7 @@ path => $_path, cwd => '/tmp', environment => $environment, + timeout => 600, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv require => File[$venv_dir], } From da2b6b59c12908e9a9ea4d45910a8c06aee82627 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 15 Dec 2020 11:27:33 +0100 Subject: [PATCH 222/380] Set default python to 3 --- REFERENCE.md | 2 +- manifests/init.pp | 2 +- manifests/params.pp | 8 -------- spec/acceptance/pyvenv_spec.rb | 2 +- spec/classes/python_spec.rb | 4 ++-- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 555cb05a..a12a230c 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -87,7 +87,7 @@ Allowed values: - 3/3.3/... means you are going to install the python3/python3.3/... package, if available on your osfamily. -Default value: `$python::params::version` +Default value: `'3'` ##### `pip` diff --git a/manifests/init.pp b/manifests/init.pp index a184b2aa..74da7eb6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -34,7 +34,7 @@ # class python ( Python::Package::Ensure $ensure = $python::params::ensure, - Python::Version $version = $python::params::version, + Python::Version $version = '3', Python::Package::Ensure $pip = $python::params::pip, Python::Package::Ensure $dev = $python::params::dev, Python::Package::Ensure $gunicorn = $python::params::gunicorn, diff --git a/manifests/params.pp b/manifests/params.pp index 89a5ccce..e1ed7c21 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -45,12 +45,4 @@ 'RedHat' => 'python-gunicorn', default => 'gunicorn', } - - if $facts['os']['family'] == 'RedHat' and $facts['os']['release']['major'] == '8' { - $version = '3' - } elsif $facts['os']['release']['major'] == '20.04' { - $version = '3' - } else { - $version = 'system' - } } diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index f648fa31..c137d0b9 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper_acceptance' -describe 'python::pyvenv defined resource' do +describe 'python::pyvenv defined resource with python 3' do context 'minimal parameters' do # Using puppet_apply as a helper it 'works with no errors' do diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 28f5f1f4..f8223d2d 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -216,8 +216,8 @@ it { is_expected.to contain_class('python::install') } # Base Suse packages. it { is_expected.to contain_package('python') } - it { is_expected.to contain_package('python-dev').with_name('python-devel') } - it { is_expected.to contain_package('python-dev').with_alias('python-devel') } + it { is_expected.to contain_package('python-dev').with_name('python3-devel') } + it { is_expected.to contain_package('python-dev').with_alias('python3-devel') } it { is_expected.to contain_package('pip') } describe 'with python::dev' do From a96f0386e94b8dae53dd1c3c29f22ba9fee38631 Mon Sep 17 00:00:00 2001 From: Sascha Doering Date: Mon, 8 Feb 2021 16:10:17 +0000 Subject: [PATCH 223/380] Add the possibility to specify the pip version in virtual envs --- manifests/pyvenv.pp | 8 ++- spec/acceptance/pyvenv_spec.rb | 55 +++++++++++--------- spec/classes/python_spec.rb | 62 +++++++++++++++++++++++ spec/type_aliases/venv/pipversion_spec.rb | 58 +++++++++++++++++++++ types/venv/pipversion.pp | 6 +++ 5 files changed, 163 insertions(+), 26 deletions(-) create mode 100644 spec/type_aliases/venv/pipversion_spec.rb create mode 100644 types/venv/pipversion.pp diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 269cf69c..ca710015 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -31,6 +31,7 @@ Stdlib::Filemode $mode = '0755', Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], Array $environment = [], + Python::Venv::PipVersion $pip_version = 'latest', ) { include python @@ -78,8 +79,13 @@ $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" + $pip_upgrade = ($pip_version != 'latest') ? { + true => "--upgrade 'pip ${pip_version}'", + false => '--upgrade pip', + } + exec { "python_virtualenv_${venv_dir}": - command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade pip && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", + command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_upgrade} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", user => $owner, creates => "${venv_dir}/bin/activate", path => $_path, diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index c137d0b9..a6234637 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -19,11 +19,12 @@ class { 'python': system => true, } python::pyvenv { '/opt/agent/venv': - ensure => 'present', - systempkgs => true, - owner => 'agent', - group => 'agent', - mode => '0755', + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', } PUPPET @@ -50,11 +51,12 @@ class { 'python': system => true, } python::pyvenv { '/opt/agent/venv': - ensure => 'present', - systempkgs => true, - owner => 'agent', - group => 'agent', - mode => '0755', + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', } python::pip { 'agent' : ensure => 'latest', @@ -89,11 +91,12 @@ class { 'python': system => true, } python::pyvenv { '/opt/agent/venv': - ensure => 'present', - systempkgs => true, - owner => 'agent', - group => 'agent', - mode => '0755', + ensure => 'present', + systempkgs => true, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', } python::pip { 'agent' : virtualenv => '/opt/agent/venv', @@ -125,11 +128,12 @@ class { 'python': system => true, } python::pyvenv { '/opt/agent/venv': - ensure => 'present', - systempkgs => false, - owner => 'agent', - group => 'agent', - mode => '0755', + ensure => 'present', + systempkgs => false, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', } python::pip { 'agent' : virtualenv => '/opt/agent/venv', @@ -161,11 +165,12 @@ class { 'python': system => true, } python::pyvenv { '/opt/agent/venv': - ensure => 'present', - systempkgs => false, - owner => 'agent', - group => 'agent', - mode => '0755', + ensure => 'present', + systempkgs => false, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', } python::pip { 'agent' : ensure => '0.1.2', diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index f8223d2d..bc5af262 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -97,6 +97,68 @@ end end + describe 'with python::python_pyvenvs and pip version defined' do + context 'with two pyenvs' do + let(:params) do + { + python_pyvenvs: { + '/opt/env1' => { + version: '3.8', + pip_version: 'latest' + }, + '/opt/env2' => { + version: '3.8', + pip_version: '<= 20.3.4' + } + } + } + end + + it { is_expected.to compile } + + it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') } + it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env1') + .with( + command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', + user: 'root', + creates: '/opt/env1/bin/activate', + path: [ + '/bin', + '/usr/bin', + '/usr/sbin', + '/usr/local/bin' + ], + cwd: '/tmp', + environment: [], + timeout: 600, + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} + ) + .that_requires('File[/opt/env1]') + } + it { is_expected.to contain_exec('python_virtualenv_/opt/env2') + .with( + command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', + user: 'root', + creates: '/opt/env2/bin/activate', + path: [ + '/bin', + '/usr/bin', + '/usr/sbin', + '/usr/local/bin' + ], + cwd: '/tmp', + environment: [], + timeout: 600, + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} + ) + .that_requires('File[/opt/env2]') + } + it { is_expected.to contain_file('/opt/env1') } + it { is_expected.to contain_file('/opt/env2') } + end + end + describe 'with manage_gunicorn' do context 'true' do let(:params) { { manage_gunicorn: true } } diff --git a/spec/type_aliases/venv/pipversion_spec.rb b/spec/type_aliases/venv/pipversion_spec.rb new file mode 100644 index 00000000..986eeb1e --- /dev/null +++ b/spec/type_aliases/venv/pipversion_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +describe 'Python::Venv::PipVersion' do + describe 'valid values' do + [ + '< 1', + '< 0.1', + '< 1.2.3', + '< 1.2.3.40', + '<= 1', + '<= 0.1', + '<= 1.2.3', + '<= 1.2.3.40', + '> 1', + '> 0.1', + '> 1.2.3', + '> 1.2.3.40', + '>= 1', + '>= 0.1', + '>= 1.2.3', + '>= 1.2.3.40', + '== 1', + '== 0.1', + '== 1.2.3', + '== 1.2.3.40', + ].each do |value| + describe value.inspect do + it { + is_expected.to allow_value(value) + } + end + end + end + + describe 'invalid values' do + [ + '+ 1', + '- 0.1', + '< -1', + '< 1.+2.3.40', + '<=', + '<= 0.-1', + '<= 1.f.3', + '1.2.3.0', + 'pip > 1', + 'all', + -1, + 65_536, + :undef, + ].each do |value| + describe value.inspect do + it { + is_expected.not_to allow_value(value) + } + end + end + end +end diff --git a/types/venv/pipversion.pp b/types/venv/pipversion.pp new file mode 100644 index 00000000..37584264 --- /dev/null +++ b/types/venv/pipversion.pp @@ -0,0 +1,6 @@ +# @summary A version type to ensure a specific Pip version in a virtual env. +# +type Python::Venv::PipVersion = Pattern[ + /^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, + /\Alatest\Z/ +] From d0d929f21b0fa12cd0f084830c39a92ccea0f889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Wed, 24 Mar 2021 14:46:09 +0200 Subject: [PATCH 224/380] Support Puppet 7 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 29c1336a..9eaa5fd9 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 5.5.8 < 7.0.0" + "version_requirement": ">= 5.5.8 < 8.0.0" } ], "dependencies": [ From 91741e0156bd092fb64ffb2656ca25a0c30dce8e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 2 Apr 2021 11:05:50 +0200 Subject: [PATCH 225/380] Drop Puppet 5 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9eaa5fd9..a4c252b9 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 5.5.8 < 8.0.0" + "version_requirement": ">= 6.1.0 < 8.0.0" } ], "dependencies": [ From a1602cc7e3148fe13114151ee24aab803e2ed538 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 2 Apr 2021 11:06:32 +0200 Subject: [PATCH 226/380] puppetlabs/stdlib: Allow 7.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a4c252b9..4bcf29bd 100644 --- a/metadata.json +++ b/metadata.json @@ -63,7 +63,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.19.0 < 7.0.0" + "version_requirement": ">= 4.19.0 < 8.0.0" }, { "name": "puppet/epel", From d80a778462ea9fe226d8203a4fdeb101bce0d136 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 3 Apr 2021 15:23:03 +0200 Subject: [PATCH 227/380] release 6.0.0 --- CHANGELOG.md | 59 +++++++++++++++++++++++++++++++++++++++++---------- metadata.json | 2 +- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efc7cd54..0db8682b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.0.0](https://github.com/voxpupuli/puppet-python/tree/v6.0.0) (2021-04-03) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v5.0.0...v6.0.0) + +**Breaking changes:** + +- Drop Puppet 5 support [\#603](https://github.com/voxpupuli/puppet-python/pull/603) ([bastelfreak](https://github.com/bastelfreak)) +- Drop python::virtualenv defined resource [\#596](https://github.com/voxpupuli/puppet-python/pull/596) ([bastelfreak](https://github.com/bastelfreak)) +- Set default python to 3 [\#595](https://github.com/voxpupuli/puppet-python/pull/595) ([bastelfreak](https://github.com/bastelfreak)) + +**Implemented enhancements:** + +- Add the possibility to specify the pip version in virtual envs [\#599](https://github.com/voxpupuli/puppet-python/pull/599) ([SaschaDoering](https://github.com/SaschaDoering)) +- Add Support for RedHat/CentOS 8 [\#594](https://github.com/voxpupuli/puppet-python/pull/594) ([treydock](https://github.com/treydock)) +- enhance pyvenv tests [\#590](https://github.com/voxpupuli/puppet-python/pull/590) ([bastelfreak](https://github.com/bastelfreak)) +- Add Debian 10 support [\#573](https://github.com/voxpupuli/puppet-python/pull/573) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- Fix python::virtualenv to allow virtualenv to not require absolute path [\#592](https://github.com/voxpupuli/puppet-python/pull/592) ([treydock](https://github.com/treydock)) +- python::gunicorn: Fix typo in datatype [\#585](https://github.com/voxpupuli/puppet-python/pull/585) ([bastelfreak](https://github.com/bastelfreak)) + +**Closed issues:** + +- Setting Pip Version for Virtual Environments [\#559](https://github.com/voxpupuli/puppet-python/issues/559) +- Can't install this using librarian-puppet [\#406](https://github.com/voxpupuli/puppet-python/issues/406) + +**Merged pull requests:** + +- puppetlabs/stdlib: Allow 7.x [\#604](https://github.com/voxpupuli/puppet-python/pull/604) ([bastelfreak](https://github.com/bastelfreak)) +- Support Puppet 7 [\#602](https://github.com/voxpupuli/puppet-python/pull/602) ([mattock](https://github.com/mattock)) +- Support Ubuntu 20.04 [\#593](https://github.com/voxpupuli/puppet-python/pull/593) ([treydock](https://github.com/treydock)) +- Add pyvenv acceptance test [\#588](https://github.com/voxpupuli/puppet-python/pull/588) ([bastelfreak](https://github.com/bastelfreak)) +- General linting/indent/syntax [\#580](https://github.com/voxpupuli/puppet-python/pull/580) ([crazymind1337](https://github.com/crazymind1337)) +- Use Python 3 for virtualenv tests [\#575](https://github.com/voxpupuli/puppet-python/pull/575) ([waipeng](https://github.com/waipeng)) +- Add acceptance test for managing Python 3 [\#572](https://github.com/voxpupuli/puppet-python/pull/572) ([bastelfreak](https://github.com/bastelfreak)) + ## [v5.0.0](https://github.com/voxpupuli/puppet-python/tree/v5.0.0) (2020-09-23) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v4.1.1...v5.0.0) @@ -387,11 +424,12 @@ These should not affect the functionality of the module. ## [1.13.0](https://github.com/voxpupuli/puppet-python/tree/1.13.0) (2016-07-18) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/2.2.0...1.13.0) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.12.0...1.13.0) **Closed issues:** - SCL package installation returns an error [\#308](https://github.com/voxpupuli/puppet-python/issues/308) +- Patch Release [\#295](https://github.com/voxpupuli/puppet-python/issues/295) - Can't install pip3 with Ubuntu [\#287](https://github.com/voxpupuli/puppet-python/issues/287) - SCL python27: add a workaround for libpython2.7.so.1.0 issue \(LD\_LIBRARY\_PATH\) [\#234](https://github.com/voxpupuli/puppet-python/issues/234) @@ -407,14 +445,6 @@ These should not affect the functionality of the module. - Configure workers [\#301](https://github.com/voxpupuli/puppet-python/pull/301) ([steverecio](https://github.com/steverecio)) - Fix support for Ruby 1.8.7 [\#298](https://github.com/voxpupuli/puppet-python/pull/298) ([ghoneycutt](https://github.com/ghoneycutt)) -## [2.2.0](https://github.com/voxpupuli/puppet-python/tree/2.2.0) (2016-05-31) - -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.12.0...2.2.0) - -**Closed issues:** - -- Patch Release [\#295](https://github.com/voxpupuli/puppet-python/issues/295) - ## [1.12.0](https://github.com/voxpupuli/puppet-python/tree/1.12.0) (2016-03-27) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.11.0...1.12.0) @@ -479,13 +509,12 @@ These should not affect the functionality of the module. ## [1.9.8](https://github.com/voxpupuli/puppet-python/tree/1.9.8) (2015-09-19) -[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.6...1.9.8) +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.7...1.9.8) **Closed issues:** - Unable to install pip using pip provider [\#243](https://github.com/voxpupuli/puppet-python/issues/243) - Not possible to install latest version of Python [\#240](https://github.com/voxpupuli/puppet-python/issues/240) -- Exec\<| tag == 'python-virtualenv' |\> changes and breaks the API [\#230](https://github.com/voxpupuli/puppet-python/issues/230) **Merged pull requests:** @@ -500,6 +529,14 @@ These should not affect the functionality of the module. - Check that we have results before returning a value [\#238](https://github.com/voxpupuli/puppet-python/pull/238) ([xaque208](https://github.com/xaque208)) - Adjust test code to pass syntax checker [\#237](https://github.com/voxpupuli/puppet-python/pull/237) ([fluential](https://github.com/fluential)) +## [1.9.7](https://github.com/voxpupuli/puppet-python/tree/1.9.7) (2015-08-21) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.6...1.9.7) + +**Closed issues:** + +- Exec\<| tag == 'python-virtualenv' |\> changes and breaks the API [\#230](https://github.com/voxpupuli/puppet-python/issues/230) + ## [1.9.6](https://github.com/voxpupuli/puppet-python/tree/1.9.6) (2015-08-01) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/1.9.5...1.9.6) diff --git a/metadata.json b/metadata.json index 4bcf29bd..9246199e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "5.0.1-rc0", + "version": "6.0.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 7dd4543fb5d39c897e0acb2571d18239caa5a852 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 3 Apr 2021 16:01:32 +0200 Subject: [PATCH 228/380] [blacksmith] Bump version to 6.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 9246199e..8cd9ee42 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.0.0", + "version": "6.0.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From e271d85bac36ec65d2d663fbb75fe7da2d73333f Mon Sep 17 00:00:00 2001 From: BR Date: Tue, 20 Apr 2021 11:08:46 +0200 Subject: [PATCH 229/380] Use $real_pkgname for pip uninstall command Fix #606 --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 35d46900..3935df72 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -220,7 +220,7 @@ default: { # Anti-action, uninstall. - $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}" + $command = "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${real_pkgname}" $unless_command = "! ${pip_env} list | grep -i -e '${grep_regex}'" } } From 2fd2a90b33f3dba527b2b0f76b29848ce20bcf5a Mon Sep 17 00:00:00 2001 From: BR Date: Mon, 26 Apr 2021 21:53:50 +0200 Subject: [PATCH 230/380] Added tests for pip uninstall --- spec/defines/pip_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 3ae5a61a..c2162e08 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -116,6 +116,14 @@ it { is_expected.to contain_exec('pip_uninstall_rpyc').with_command(%r{uninstall.*rpyc$}) } end + + context 'passes correct package name' do + let(:params) { { ensure: 'absent', 'pkgname': 'r-pyc' } } + + it { is_expected.not_to contain_exec('pip_install_rpyc') } + + it { is_expected.to contain_exec('pip_uninstall_rpyc').with_command(%r{uninstall.*r-pyc$}) } + end end end end From 7f5f52b465a09ea14e90dd4f3c25f1b136c75278 Mon Sep 17 00:00:00 2001 From: BR Date: Tue, 27 Apr 2021 22:56:46 +0200 Subject: [PATCH 231/380] Initial pip acceptance tests --- spec/acceptance/pip_spec.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 spec/acceptance/pip_spec.rb diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb new file mode 100644 index 00000000..372d905f --- /dev/null +++ b/spec/acceptance/pip_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper_acceptance' + +describe 'python::pip defined resource' do + context 'install package with custom name' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + + python::pip { 'agent package': + pkgname => 'agent' + ensure => '0.1.2' + } + PUPPET + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + describe command('/opt/agent/venv/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } + end +end + From 1c177bd4ce7358756f04f694b3ce5751fbb8de79 Mon Sep 17 00:00:00 2001 From: BR Date: Tue, 27 Apr 2021 22:57:46 +0200 Subject: [PATCH 232/380] Fixed pip path --- spec/acceptance/pip_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index 372d905f..c88bd5d3 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -18,7 +18,7 @@ class { 'python': apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end - describe command('/opt/agent/venv/bin/pip list') do + describe command('/usr/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } end From 9985ea0a36f5ae2d14e423f380ad65787230b150 Mon Sep 17 00:00:00 2001 From: BR Date: Tue, 27 Apr 2021 23:01:11 +0200 Subject: [PATCH 233/380] Added pip uninstall acceptance test --- spec/acceptance/pip_spec.rb | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index c88bd5d3..f1ba7f26 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -10,17 +10,48 @@ class { 'python': } python::pip { 'agent package': - pkgname => 'agent' - ensure => '0.1.2' + pkgname => 'agent', + ensure => '0.1.2', } PUPPET apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + describe command('/usr/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } end + + context 'uninstall package with custom name' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + + python::pip { 'agent package install': + pkgname => 'agent', + ensure => '0.1.2', + } + + python::pip { 'agent package uninstall': + pkgname => 'agent', + ensure => 'absent', + require => Python::Pip['agent package install'], + } + + PUPPET + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe command('/usr/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } + end end From 6599b7647a1e3c818daf63dc3cfff6c21df04281 Mon Sep 17 00:00:00 2001 From: BR Date: Wed, 28 Apr 2021 08:22:14 +0200 Subject: [PATCH 234/380] Fixed syntax in acceptance tests --- spec/acceptance/pip_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index f1ba7f26..b62c82a0 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -17,6 +17,7 @@ class { 'python': apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) + end end describe command('/usr/bin/pip list') do @@ -47,6 +48,7 @@ class { 'python': apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) + end end describe command('/usr/bin/pip list') do From f36ea4abe4499fd6ef7a99ecd8eaf603ab0a4bef Mon Sep 17 00:00:00 2001 From: BR Date: Wed, 28 Apr 2021 22:18:04 +0200 Subject: [PATCH 235/380] Use virtualenv for pip acceptance tests --- spec/acceptance/pip_spec.rb | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index b62c82a0..b7d6d4e1 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -9,9 +9,17 @@ class { 'python': dev => 'present', } + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + python::pip { 'agent package': - pkgname => 'agent', - ensure => '0.1.2', + virtualenv => '/opt/test-venv', + pkgname => 'agent', + ensure => '0.1.2', } PUPPET @@ -20,7 +28,7 @@ class { 'python': end end - describe command('/usr/bin/pip list') do + describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } end @@ -33,25 +41,33 @@ class { 'python': dev => 'present', } + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + python::pip { 'agent package install': - pkgname => 'agent', - ensure => '0.1.2', + ensure => '0.1.2', + pkgname => 'agent', + virtualenv => '/opt/test-venv', } - python::pip { 'agent package uninstall': - pkgname => 'agent', + python::pip { 'agent package uninstall custom pkgname': ensure => 'absent', + pkgname => 'agent', + virtualenv => '/opt/test-venv', require => Python::Pip['agent package install'], } PUPPET apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) end end - describe command('/usr/bin/pip list') do + describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end From b1127ee52638f166d46e3440bbd3b6f7dcb03556 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 28 Apr 2021 22:50:57 +0200 Subject: [PATCH 236/380] release 6.0.1 --- CHANGELOG.md | 12 ++++++++++++ metadata.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db8682b..87e485ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-28) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.0.0...v6.0.1) + +**Fixed bugs:** + +- Use $real\_pkgname for pip uninstall command [\#607](https://github.com/voxpupuli/puppet-python/pull/607) ([brabiega](https://github.com/brabiega)) + +**Closed issues:** + +- Pip uninstall does not support pkgname variable [\#606](https://github.com/voxpupuli/puppet-python/issues/606) + ## [v6.0.0](https://github.com/voxpupuli/puppet-python/tree/v6.0.0) (2021-04-03) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v5.0.0...v6.0.0) diff --git a/metadata.json b/metadata.json index 8cd9ee42..f0b58861 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.0.1-rc0", + "version": "6.0.1", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 0f522f6b866b091d75ecb5d122ee50543d618dab Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Apr 2021 10:09:39 +0200 Subject: [PATCH 237/380] [blacksmith] Bump version to 6.0.2-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index f0b58861..9bba9594 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.0.1", + "version": "6.0.2-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From e9cec26d782222739b4c395cddc73273344f332a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Apr 2021 10:30:19 +0200 Subject: [PATCH 238/380] modulesync 4.1.0 --- .github/CONTRIBUTING.md | 34 ++-------------------------------- .github/workflows/ci.yml | 10 +++++----- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 8 ++++---- 5 files changed, 13 insertions(+), 43 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index f1f88ccf..887d571a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,33 +232,7 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake beaker -``` - -This will run the tests on the module's default nodeset. You can override the -nodeset used, e.g., - -```sh -BEAKER_set=centos-7-x64 bundle exec rake beaker -``` - -There are default rake tasks for the various acceptance test modules, e.g., - -```sh -bundle exec rake beaker:centos-7-x64 -bundle exec rake beaker:ssh:centos-7-x64 -``` - -If you don't want to have to recreate the virtual machine every time you can -use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at -least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the -created virtual machines will be in `.vagrant/beaker_vagrant_files`. - -Beaker also supports docker containers. We also use that in our automated CI -pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: - -```sh -PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker +BEAKER_setfile=debian10-x64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. @@ -272,11 +246,7 @@ The following strings are known to work: * centos7 * centos8 -The easiest way to debug in a docker container is to open a shell: - -```sh -docker exec -it -u root ${container_id_or_name} bash -``` +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) repository. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4f47e87..97ddc620 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,12 +6,13 @@ jobs: setup_matrix: name: 'Setup Test Matrix' runs-on: ubuntu-latest + timeout-minutes: 40 outputs: beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} env: - BUNDLE_WITHOUT: development:test:release + BUNDLE_WITHOUT: development:release steps: - uses: actions/checkout@v2 - name: Setup ruby @@ -21,6 +22,8 @@ jobs: bundler-cache: true - name: Run rake validate run: bundle exec rake validate + - name: Run rake rubocop + run: bundle exec rake rubocop - name: Setup Test Matrix id: get-outputs run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false @@ -28,6 +31,7 @@ jobs: unit: needs: setup_matrix runs-on: ubuntu-latest + timeout-minutes: 40 strategy: fail-fast: false matrix: @@ -58,10 +62,6 @@ jobs: puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} steps: - - name: Enable IPv6 on docker - run: | - echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json - sudo service docker restart - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 diff --git a/.msync.yml b/.msync.yml index a0770a83..57ff5038 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,2 @@ --- -modulesync_config_version: '4.0.0' +modulesync_config_version: '4.1.0' diff --git a/Dockerfile b/Dockerfile index 6fd63422..a51c6416 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.5.3 +FROM ruby:2.7 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index 0d0a9fb2..f4855f64 100644 --- a/Gemfile +++ b/Gemfile @@ -17,10 +17,10 @@ group :system_tests do end group :release do - gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end gem 'puppetlabs_spec_helper', '~> 2.0', :require => false From 697a6d9a449e742f48a6f2d6615cb907048e9976 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Apr 2021 10:33:42 +0200 Subject: [PATCH 239/380] rubocop: autofix --- spec/acceptance/pip_spec.rb | 1 - spec/classes/python_spec.rb | 70 +++++++++++++++++++------------------ spec/defines/pip_spec.rb | 7 ++-- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index b7d6d4e1..f2da5ecd 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -72,4 +72,3 @@ class { 'python': its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end end - diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index bc5af262..4e2bc1ac 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -118,41 +118,43 @@ it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') } it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env1') - .with( - command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', - user: 'root', - creates: '/opt/env1/bin/activate', - path: [ - '/bin', - '/usr/bin', - '/usr/sbin', - '/usr/local/bin' - ], - cwd: '/tmp', - environment: [], - timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} - ) - .that_requires('File[/opt/env1]') + it { + is_expected.to contain_exec('python_virtualenv_/opt/env1'). + with( + command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', + user: 'root', + creates: '/opt/env1/bin/activate', + path: [ + '/bin', + '/usr/bin', + '/usr/sbin', + '/usr/local/bin' + ], + cwd: '/tmp', + environment: [], + timeout: 600, + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} + ). + that_requires('File[/opt/env1]') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env2') - .with( - command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', - user: 'root', - creates: '/opt/env2/bin/activate', - path: [ - '/bin', - '/usr/bin', - '/usr/sbin', - '/usr/local/bin' - ], - cwd: '/tmp', - environment: [], - timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} - ) - .that_requires('File[/opt/env2]') + it { + is_expected.to contain_exec('python_virtualenv_/opt/env2'). + with( + command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', + user: 'root', + creates: '/opt/env2/bin/activate', + path: [ + '/bin', + '/usr/bin', + '/usr/sbin', + '/usr/local/bin' + ], + cwd: '/tmp', + environment: [], + timeout: 600, + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} + ). + that_requires('File[/opt/env2]') } it { is_expected.to contain_file('/opt/env1') } it { is_expected.to contain_file('/opt/env2') } diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index c2162e08..a51e916a 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' - -describe 'python::pip', type: :define do # rubocop:disable RSpec/MultipleDescribes +# rubocop:disable RSpec/MultipleDescribes +describe 'python::pip', type: :define do let(:title) { 'rpyc' } context 'on Debian OS' do @@ -118,7 +118,7 @@ end context 'passes correct package name' do - let(:params) { { ensure: 'absent', 'pkgname': 'r-pyc' } } + let(:params) { { ensure: 'absent', pkgname: 'r-pyc' } } it { is_expected.not_to contain_exec('pip_install_rpyc') } @@ -162,3 +162,4 @@ end end end +# rubocop:enable RSpec/MultipleDescribes From 237d7a095c3fa2e70a02e62d523a81a4e4fa5d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 2 May 2021 15:19:53 -1000 Subject: [PATCH 240/380] Add support for FreeBSD Make this module usable on FreeBSD. While here, sort operating system lists in alphabetical order for consistency. --- manifests/install.pp | 15 ++++++++++----- manifests/params.pp | 2 +- metadata.json | 8 ++++++++ spec/defines/requirements_spec.rb | 2 +- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 64f9350e..4645bdcb 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,11 +15,12 @@ } $pythondev = $facts['os']['family'] ? { - 'AIX' => "${python}-devel", - 'RedHat' => "${python}-devel", - 'Debian' => "${python}-dev", - 'Suse' => "${python}-devel", - 'Gentoo' => undef, + 'AIX' => "${python}-devel", + 'Debian' => "${python}-dev", + 'FreeBSD' => undef, + 'Gentoo' => undef, + 'RedHat' => "${python}-devel", + 'Suse' => "${python}-devel", } $pip_ensure = $python::pip ? { @@ -225,6 +226,10 @@ $pip_category = undef $pip_package = 'python2-pip' $pip_provider = pip2 + } elsif $facts['os']['family'] == 'FreeBSD' { + $pip_category = undef + $pip_package = "py${python::version}-pip" + $pip_provider = 'pip' } elsif $facts['os']['family'] == 'Gentoo' { $pip_category = 'dev-python' $pip_package = 'pip' diff --git a/manifests/params.pp b/manifests/params.pp index e1ed7c21..32f13a72 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,7 @@ # class python::params { # Module compatibility check - unless $facts['os']['family'] in ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX',] { + unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse'] { fail("Module is not compatible with ${facts['os']['name']}") } diff --git a/metadata.json b/metadata.json index 9bba9594..a139041d 100644 --- a/metadata.json +++ b/metadata.json @@ -36,6 +36,14 @@ "10" ] }, + { + "operatingsystem": "FreeBSD", + "operatingsystemrelease": [ + "11", + "12", + "13" + ] + }, { "operatingsystem": "Gentoo" }, diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 17db0595..4e659b79 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -53,7 +53,7 @@ it { is_expected.to contain_package('gunicorn') } it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } - if facts[:os]['name'] == 'Gentoo' + if %w[FreeBSD Gentoo].include?(facts[:os]['name']) it { is_expected.not_to contain_package('python-dev') } else it { is_expected.to contain_package('python-dev') } From 893ae3f4405c9787cb2a123df08726f87bfcf290 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 29 Apr 2021 11:01:13 +0200 Subject: [PATCH 241/380] release 6.1.0 --- CHANGELOG.md | 17 ++++++++++++++++- metadata.json | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87e485ea..86374eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,22 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. -## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-28) +## [v6.1.0](https://github.com/voxpupuli/puppet-python/tree/v6.1.0) (2021-06-05) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.0.1...v6.1.0) + +Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge. v6.0.2 just contains [modulesync 4.1.0](https://github.com/voxpupuli/modulesync_config/blob/master/CHANGELOG.md#410-2021-04-03) patch. + +**Implemented enhancements:** + +- Add support for FreeBSD [\#612](https://github.com/voxpupuli/puppet-python/pull/612) ([smortex](https://github.com/smortex)) + +**Closed issues:** + +- Can't uninstall pip package because of duplicate variable name [\#532](https://github.com/voxpupuli/puppet-python/issues/532) +- audit metaparameter is deprecated [\#375](https://github.com/voxpupuli/puppet-python/issues/375) + +## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-29) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.0.0...v6.0.1) diff --git a/metadata.json b/metadata.json index a139041d..43bd3fec 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.0.2-rc0", + "version": "6.1.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From fd345d896c19582ffc95ca2a464fdb01a8528382 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 5 Jun 2021 17:20:28 +0200 Subject: [PATCH 242/380] [blacksmith] Bump version to 6.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 43bd3fec..6c1e3089 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.1.0", + "version": "6.1.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 70e753d0c0ac60cb9dc41f988429619f33ecb89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jul 2021 12:11:02 -1000 Subject: [PATCH 243/380] New function: any_puppet_to_python() This function return a String representation of the value passed as parameter. --- lib/puppet/functions/any_puppet_to_python.rb | 25 +++++++++++++ spec/acceptance/any_puppet_to_python_spec.rb | 38 ++++++++++++++++++++ spec/functions/any_puppet_to_python_spec.rb | 26 ++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 lib/puppet/functions/any_puppet_to_python.rb create mode 100644 spec/acceptance/any_puppet_to_python_spec.rb create mode 100644 spec/functions/any_puppet_to_python_spec.rb diff --git a/lib/puppet/functions/any_puppet_to_python.rb b/lib/puppet/functions/any_puppet_to_python.rb new file mode 100644 index 00000000..477569e8 --- /dev/null +++ b/lib/puppet/functions/any_puppet_to_python.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# @summary +# Return the Python representation of the passed variable +Puppet::Functions.create_function(:any_puppet_to_python) do + dispatch :any_puppet_to_python do + param 'Any', :value + end + + # @param value + # The value to be converted + # + # @return [String] + # The String representation of value + def any_puppet_to_python(value) + case value + when true then 'True' + when false then 'False' + when :undef then 'None' + when Array then "[#{value.map { |x| any_puppet_to_python(x) }.join(', ')}]" + when Hash then "{#{value.map { |k, v| "#{any_puppet_to_python(k)}: #{any_puppet_to_python(v)}" }.join(', ')}}" + else value.inspect + end + end +end diff --git a/spec/acceptance/any_puppet_to_python_spec.rb b/spec/acceptance/any_puppet_to_python_spec.rb new file mode 100644 index 00000000..52ea33fc --- /dev/null +++ b/spec/acceptance/any_puppet_to_python_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper_acceptance' + +describe 'any_puppet_to_python function' do + it 'works with no errors' do + pp = <<-EOS + class { 'python': + ensure => 'present', + version => '3', + } + + $var = { + 1 => 2, + 3 => [ + 5, + 7, + 'bar' + ], + 'foo' => 11, + } + file { '/tmp/foo.py': + ensure => file, + mode => '0755', + content => inline_epp(@(PYTHON), { var => $var }), + <%- |Any $var| -%> + #!/usr/bin/env python3 + var = <%= $var.any_puppet_to_python() %> + print(var[1] + var[3][1] + var["foo"]) + print(var[3][2] * var[3][0]) + | PYTHON + } + EOS + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + + expect(shell('/tmp/foo.py').stdout).to eq("20\nbarbarbarbarbar\n") + end +end diff --git a/spec/functions/any_puppet_to_python_spec.rb b/spec/functions/any_puppet_to_python_spec.rb new file mode 100644 index 00000000..b95c6398 --- /dev/null +++ b/spec/functions/any_puppet_to_python_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'any_puppet_to_python' do + context 'with Array[Any]' do + it { is_expected.to run.with_params([]).and_return('[]') } + it { is_expected.to run.with_params([[[[], 1], '2'], 3]).and_return('[[[[], 1], "2"], 3]') } + it { is_expected.to run.with_params([42, 'foo', true, {}]).and_return('[42, "foo", True, {}]') } + end + context 'with Hash[Any]' do + it { is_expected.to run.with_params({}).and_return('{}') } + it { is_expected.to run.with_params({ '1' => { 2 => { '3' => {} } } }).and_return('{"1": {2: {"3": {}}}}') } + it { is_expected.to run.with_params({ 42 => 42, 'foo' => 'bar', '6 * 9' => { 'answer' => [42] } }).and_return('{42: 42, "foo": "bar", "6 * 9": {"answer": [42]}}') } + end + context 'with Boolean' do + it { is_expected.to run.with_params(true).and_return('True') } + it { is_expected.to run.with_params(false).and_return('False') } + end + context 'with String' do + it { is_expected.to run.with_params('').and_return('""') } + it { is_expected.to run.with_params('foo').and_return('"foo"') } + it { is_expected.to run.with_params("foo\nbar").and_return('"foo\nbar"') } + end + context 'with Undef' do + it { is_expected.to run.with_params(:undef).and_return('None') } + end +end From 8591aed9e8ba0a24a64914f8c302ffc4a8178f6d Mon Sep 17 00:00:00 2001 From: Alex Cullen Date: Thu, 19 Aug 2021 12:08:31 -0400 Subject: [PATCH 244/380] If user declares their own requirements, don't set subscribe to undef. --- manifests/requirements.pp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 9d245be3..e8c253fa 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -88,11 +88,8 @@ replace => false, content => '# Puppet will install and/or update pip packages listed here', } - - $local_subscribe = File[$requirements] - } else { - $local_subscribe = undef } + $local_subscribe = File[$requirements] exec { "python_requirements${name}": provider => shell, From 564e9e5359dd4872305140b75658ac30ca4c14b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 23 Aug 2021 06:15:42 -1000 Subject: [PATCH 245/380] Delete the any_puppet_to_python() function It was integrated into the stdlib as to_python(). --- lib/puppet/functions/any_puppet_to_python.rb | 25 ------------- spec/acceptance/any_puppet_to_python_spec.rb | 38 -------------------- spec/functions/any_puppet_to_python_spec.rb | 26 -------------- 3 files changed, 89 deletions(-) delete mode 100644 lib/puppet/functions/any_puppet_to_python.rb delete mode 100644 spec/acceptance/any_puppet_to_python_spec.rb delete mode 100644 spec/functions/any_puppet_to_python_spec.rb diff --git a/lib/puppet/functions/any_puppet_to_python.rb b/lib/puppet/functions/any_puppet_to_python.rb deleted file mode 100644 index 477569e8..00000000 --- a/lib/puppet/functions/any_puppet_to_python.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -# @summary -# Return the Python representation of the passed variable -Puppet::Functions.create_function(:any_puppet_to_python) do - dispatch :any_puppet_to_python do - param 'Any', :value - end - - # @param value - # The value to be converted - # - # @return [String] - # The String representation of value - def any_puppet_to_python(value) - case value - when true then 'True' - when false then 'False' - when :undef then 'None' - when Array then "[#{value.map { |x| any_puppet_to_python(x) }.join(', ')}]" - when Hash then "{#{value.map { |k, v| "#{any_puppet_to_python(k)}: #{any_puppet_to_python(v)}" }.join(', ')}}" - else value.inspect - end - end -end diff --git a/spec/acceptance/any_puppet_to_python_spec.rb b/spec/acceptance/any_puppet_to_python_spec.rb deleted file mode 100644 index 52ea33fc..00000000 --- a/spec/acceptance/any_puppet_to_python_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'any_puppet_to_python function' do - it 'works with no errors' do - pp = <<-EOS - class { 'python': - ensure => 'present', - version => '3', - } - - $var = { - 1 => 2, - 3 => [ - 5, - 7, - 'bar' - ], - 'foo' => 11, - } - file { '/tmp/foo.py': - ensure => file, - mode => '0755', - content => inline_epp(@(PYTHON), { var => $var }), - <%- |Any $var| -%> - #!/usr/bin/env python3 - var = <%= $var.any_puppet_to_python() %> - print(var[1] + var[3][1] + var["foo"]) - print(var[3][2] * var[3][0]) - | PYTHON - } - EOS - - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - - expect(shell('/tmp/foo.py').stdout).to eq("20\nbarbarbarbarbar\n") - end -end diff --git a/spec/functions/any_puppet_to_python_spec.rb b/spec/functions/any_puppet_to_python_spec.rb deleted file mode 100644 index b95c6398..00000000 --- a/spec/functions/any_puppet_to_python_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -require 'spec_helper' - -describe 'any_puppet_to_python' do - context 'with Array[Any]' do - it { is_expected.to run.with_params([]).and_return('[]') } - it { is_expected.to run.with_params([[[[], 1], '2'], 3]).and_return('[[[[], 1], "2"], 3]') } - it { is_expected.to run.with_params([42, 'foo', true, {}]).and_return('[42, "foo", True, {}]') } - end - context 'with Hash[Any]' do - it { is_expected.to run.with_params({}).and_return('{}') } - it { is_expected.to run.with_params({ '1' => { 2 => { '3' => {} } } }).and_return('{"1": {2: {"3": {}}}}') } - it { is_expected.to run.with_params({ 42 => 42, 'foo' => 'bar', '6 * 9' => { 'answer' => [42] } }).and_return('{42: 42, "foo": "bar", "6 * 9": {"answer": [42]}}') } - end - context 'with Boolean' do - it { is_expected.to run.with_params(true).and_return('True') } - it { is_expected.to run.with_params(false).and_return('False') } - end - context 'with String' do - it { is_expected.to run.with_params('').and_return('""') } - it { is_expected.to run.with_params('foo').and_return('"foo"') } - it { is_expected.to run.with_params("foo\nbar").and_return('"foo\nbar"') } - end - context 'with Undef' do - it { is_expected.to run.with_params(:undef).and_return('None') } - end -end From c02dcc7534a30d25da36f79d70079d72492e7427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 24 Aug 2021 08:33:47 -1000 Subject: [PATCH 246/380] Add support for Debian 11 --- manifests/install.pp | 13 +++++++++---- metadata.json | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 4645bdcb..af4a26ff 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -234,12 +234,17 @@ $pip_category = 'dev-python' $pip_package = 'pip' $pip_provider = 'pip' + } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) { + $pip_category = undef + $pip_package = 'python3-pip' + $pip_provider = 'pip3' + } elsif ($facts['os']['name'] == 'Debian') and (versioncmp($facts['os']['release']['major'], '11') >= 0) { + $pip_category = undef + $pip_package = 'python3-pip' + $pip_provider = 'pip3' } else { - $pip_package = $facts['os']['release']['major'] ? { - '20.04' => 'python3-pip', - default => 'python-pip', - } $pip_category = undef + $pip_package = 'python-pip' $pip_provider = 'pip' } diff --git a/metadata.json b/metadata.json index 6c1e3089..3ac190ce 100644 --- a/metadata.json +++ b/metadata.json @@ -33,7 +33,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "9", - "10" + "10", + "11" ] }, { From 8768a815f05b1ccdd27e89c5e4f33f73ac4cc941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 25 Aug 2021 07:42:37 -1000 Subject: [PATCH 247/380] Allow stdlib 8.0.0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 3ac190ce..b86bb557 100644 --- a/metadata.json +++ b/metadata.json @@ -72,7 +72,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.19.0 < 8.0.0" + "version_requirement": ">= 4.19.0 < 9.0.0" }, { "name": "puppet/epel", From b9c84a3071a12322eb9676e0efc57cca25236054 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Thu, 26 Aug 2021 16:37:17 +0300 Subject: [PATCH 248/380] Release 6.2.0 --- CHANGELOG.md | 12 ++ README.md | 6 +- REFERENCE.md | 388 ++++++++++++++++++++++++++++++++++---------------- metadata.json | 2 +- 4 files changed, 282 insertions(+), 126 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86374eb8..9ba619d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.2.0](https://github.com/voxpupuli/puppet-python/tree/v6.2.0) (2021-08-26) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.1.0...v6.2.0) + +**Implemented enhancements:** + +- Add support for Debian 11 [\#621](https://github.com/voxpupuli/puppet-python/pull/621) ([smortex](https://github.com/smortex)) + +**Merged pull requests:** + +- Allow stdlib 8.0.0 [\#622](https://github.com/voxpupuli/puppet-python/pull/622) ([smortex](https://github.com/smortex)) + ## [v6.1.0](https://github.com/voxpupuli/puppet-python/tree/v6.1.0) (2021-06-05) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.0.1...v6.1.0) diff --git a/README.md b/README.md index dcfafdb2..a91504ca 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # puppet-python -[![License](https://img.shields.io/github/license/voxpupuli/puppet-python.svg)](https://github.com/voxpupuli/puppet-python/blob/master/LICENSE) -[![Build Status](https://travis-ci.org/voxpupuli/puppet-python.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-python) +[![Build Status](https://github.com/voxpupuli/puppet-python/workflows/CI/badge.svg)](https://github.com/voxpupuli/puppet-python/actions?query=workflow%3ACI) +[![Release](https://github.com/voxpupuli/puppet-python/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet-python/actions/workflows/release.yml) [![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) [![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) [![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) [![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/python.svg)](https://forge.puppetlabs.com/puppet/python) +[![puppetmodule.info docs](http://www.puppetmodule.info/images/badge.png)](http://www.puppetmodule.info/m/puppet-python) +[![License](https://img.shields.io/github/license/voxpupuli/puppet-python.svg)](https://github.com/voxpupuli/puppet-python/blob/master/LICENSE) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. diff --git a/REFERENCE.md b/REFERENCE.md index a12a230c..8a84e95d 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -31,11 +31,12 @@ * [`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::Venv::PipVersion`](#pythonvenvpipversion): A version type to ensure a specific Pip version in a virtual env. * [`Python::Version`](#pythonversion): A version type to match all valid versions for python ## Classes -### `python` +### `python` Installs and manages python, python-dev and gunicorn. @@ -64,9 +65,30 @@ class { 'python' : #### Parameters -The following parameters are available in the `python` class. - -##### `ensure` +The following parameters are available in the `python` class: + +* [`ensure`](#ensure) +* [`version`](#version) +* [`pip`](#pip) +* [`dev`](#dev) +* [`gunicorn`](#gunicorn) +* [`manage_gunicorn`](#manage_gunicorn) +* [`provider`](#provider) +* [`use_epel`](#use_epel) +* [`manage_scl`](#manage_scl) +* [`umask`](#umask) +* [`manage_python_package`](#manage_python_package) +* [`manage_pip_package`](#manage_pip_package) +* [`gunicorn_package_name`](#gunicorn_package_name) +* [`python_pips`](#python_pips) +* [`python_pyvenvs`](#python_pyvenvs) +* [`python_requirements`](#python_requirements) +* [`python_dotfiles`](#python_dotfiles) +* [`rhscl_use_public_repository`](#rhscl_use_public_repository) +* [`anaconda_installer_url`](#anaconda_installer_url) +* [`anaconda_install_path`](#anaconda_install_path) + +##### `ensure` Data type: `Python::Package::Ensure` @@ -74,7 +96,7 @@ Desired installation state for the Python package. Default value: `$python::params::ensure` -##### `version` +##### `version` Data type: `Python::Version` @@ -89,7 +111,7 @@ Allowed values: Default value: `'3'` -##### `pip` +##### `pip` Data type: `Python::Package::Ensure` @@ -97,7 +119,7 @@ Desired installation state for the python-pip package. Default value: `$python::params::pip` -##### `dev` +##### `dev` Data type: `Python::Package::Ensure` @@ -105,7 +127,7 @@ Desired installation state for the python-dev package. Default value: `$python::params::dev` -##### `gunicorn` +##### `gunicorn` Data type: `Python::Package::Ensure` @@ -113,7 +135,7 @@ Desired installation state for Gunicorn. Default value: `$python::params::gunicorn` -##### `manage_gunicorn` +##### `manage_gunicorn` Data type: `Boolean` @@ -121,7 +143,7 @@ Allow Installation / Removal of Gunicorn. Default value: `$python::params::manage_gunicorn` -##### `provider` +##### `provider` Data type: `Optional[Python::Provider]` @@ -129,7 +151,7 @@ What provider to use for installation of the packages, except gunicorn and Pytho Default value: `$python::params::provider` -##### `use_epel` +##### `use_epel` Data type: `Boolean` @@ -137,7 +159,7 @@ to determine if the epel class is used. Default value: `$python::params::use_epel` -##### `manage_scl` +##### `manage_scl` Data type: `Boolean` @@ -145,7 +167,7 @@ Whether to manage core SCL packages or not. Default value: `$python::params::manage_scl` -##### `umask` +##### `umask` Data type: `Optional[Python::Umask]` @@ -153,7 +175,7 @@ The default umask for invoked exec calls. Default value: ``undef`` -##### `manage_python_package` +##### `manage_python_package` Data type: `Boolean` @@ -161,7 +183,7 @@ Data type: `Boolean` Default value: `$python::params::manage_python_package` -##### `manage_pip_package` +##### `manage_pip_package` Data type: `Boolean` @@ -169,7 +191,7 @@ Data type: `Boolean` Default value: `$python::params::manage_pip_package` -##### `gunicorn_package_name` +##### `gunicorn_package_name` Data type: `String[1]` @@ -177,7 +199,7 @@ Data type: `String[1]` Default value: `$python::params::gunicorn_package_name` -##### `python_pips` +##### `python_pips` Data type: `Hash` @@ -185,7 +207,7 @@ Data type: `Hash` Default value: `{}` -##### `python_pyvenvs` +##### `python_pyvenvs` Data type: `Hash` @@ -193,7 +215,7 @@ Data type: `Hash` Default value: `{}` -##### `python_requirements` +##### `python_requirements` Data type: `Hash` @@ -201,7 +223,7 @@ Data type: `Hash` Default value: `{}` -##### `python_dotfiles` +##### `python_dotfiles` Data type: `Hash` @@ -209,7 +231,7 @@ Data type: `Hash` Default value: `{}` -##### `rhscl_use_public_repository` +##### `rhscl_use_public_repository` Data type: `Boolean` @@ -217,7 +239,7 @@ Data type: `Boolean` Default value: `$python::params::rhscl_use_public_repository` -##### `anaconda_installer_url` +##### `anaconda_installer_url` Data type: `Stdlib::Httpurl` @@ -225,7 +247,7 @@ Data type: `Stdlib::Httpurl` Default value: `$python::params::anaconda_installer_url` -##### `anaconda_install_path` +##### `anaconda_install_path` Data type: `Stdlib::Absolutepath` @@ -233,7 +255,7 @@ Data type: `Stdlib::Absolutepath` Default value: `$python::params::anaconda_install_path` -### `python::pip::bootstrap` +### `python::pip::bootstrap` allow to bootstrap pip when python is managed from other module @@ -249,9 +271,14 @@ class { 'python::pip::bootstrap': #### Parameters -The following parameters are available in the `python::pip::bootstrap` class. +The following parameters are available in the `python::pip::bootstrap` class: + +* [`version`](#version) +* [`manage_python`](#manage_python) +* [`http_proxy`](#http_proxy) +* [`exec_provider`](#exec_provider) -##### `version` +##### `version` Data type: `Enum['pip', 'pip3']` @@ -259,7 +286,7 @@ should be pip or pip3 Default value: `'pip'` -##### `manage_python` +##### `manage_python` Data type: `Variant[Boolean, String]` @@ -267,7 +294,7 @@ if python module will manage deps Default value: ``false`` -##### `http_proxy` +##### `http_proxy` Data type: `Optional[Stdlib::HTTPUrl]` @@ -275,7 +302,7 @@ Proxy server to use for outbound connections. Default value: ``undef`` -##### `exec_provider` +##### `exec_provider` Data type: `String[1]` @@ -285,7 +312,7 @@ Default value: `'shell'` ## Defined types -### `python::dotfile` +### `python::dotfile` Manages any python dotfiles with a simple config hash. @@ -309,9 +336,16 @@ python::dotfile { '/var/lib/jenkins/.pip/pip.conf': #### Parameters -The following parameters are available in the `python::dotfile` defined type. +The following parameters are available in the `python::dotfile` defined type: + +* [`ensure`](#ensure) +* [`filename`](#filename) +* [`mode`](#mode) +* [`owner`](#owner) +* [`group`](#group) +* [`config`](#config) -##### `ensure` +##### `ensure` Data type: `Enum['absent', 'present']` @@ -319,7 +353,7 @@ Data type: `Enum['absent', 'present']` Default value: `'present'` -##### `filename` +##### `filename` Data type: `Stdlib::Absolutepath` @@ -327,7 +361,7 @@ Filename. Default value: `$title` -##### `mode` +##### `mode` Data type: `Stdlib::Filemode` @@ -335,7 +369,7 @@ File mode. Default value: `'0644'` -##### `owner` +##### `owner` Data type: `String[1]` @@ -343,7 +377,7 @@ user owner of dotfile Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -351,7 +385,7 @@ group owner of dotfile Default value: `'root'` -##### `config` +##### `config` Data type: `Hash` @@ -359,7 +393,7 @@ Config hash. This will be expanded to an ini-file. Default value: `{}` -### `python::gunicorn` +### `python::gunicorn` Manages Gunicorn virtual hosts. @@ -386,9 +420,30 @@ python::gunicorn { 'vhost': #### Parameters -The following parameters are available in the `python::gunicorn` defined type. - -##### `ensure` +The following parameters are available in the `python::gunicorn` defined type: + +* [`ensure`](#ensure) +* [`config_dir`](#config_dir) +* [`manage_config_dir`](#manage_config_dir) +* [`virtualenv`](#virtualenv) +* [`mode`](#mode) +* [`dir`](#dir) +* [`bind`](#bind) +* [`environment`](#environment) +* [`appmodule`](#appmodule) +* [`osenv`](#osenv) +* [`timeout`](#timeout) +* [`template`](#template) +* [`args`](#args) +* [`owner`](#owner) +* [`group`](#group) +* [`workers`](#workers) +* [`access_log_format`](#access_log_format) +* [`accesslog`](#accesslog) +* [`errorlog`](#errorlog) +* [`log_level`](#log_level) + +##### `ensure` Data type: `Enum['present', 'absent']` @@ -396,7 +451,7 @@ Data type: `Enum['present', 'absent']` Default value: `present` -##### `config_dir` +##### `config_dir` Data type: `Stdlib::Absolutepath` @@ -404,7 +459,7 @@ Configure the gunicorn config directory path. Default value: `'/etc/gunicorn.d'` -##### `manage_config_dir` +##### `manage_config_dir` Data type: `Boolean` @@ -412,7 +467,7 @@ Set if the gunicorn config directory should be created. Default value: ``false`` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Boolean,Stdlib::Absolutepath]` @@ -420,7 +475,7 @@ Run in virtualenv, specify directory. Default value: ``false`` -##### `mode` +##### `mode` Data type: `Enum['wsgi', 'django']` @@ -428,13 +483,13 @@ Gunicorn mode. Default value: `'wsgi'` -##### `dir` +##### `dir` Data type: `Stdlib::Absolutepath` Application directory. -##### `bind` +##### `bind` Data type: `Variant[String[1],Boolean]` @@ -444,7 +499,7 @@ Default: system-wide: unix:/tmp/gunicorn-$name.socket Default value: ``false`` -##### `environment` +##### `environment` Data type: `Variant[String[1],Boolean]` @@ -452,7 +507,7 @@ Set ENVIRONMENT variable. Default value: ``false`` -##### `appmodule` +##### `appmodule` Data type: `String[1]` @@ -460,7 +515,7 @@ Set the application module name for gunicorn to load when not using Django. Default value: `'app:app'` -##### `osenv` +##### `osenv` Data type: `Variant[Boolean,Hash]` @@ -468,7 +523,7 @@ Allows setting environment variables for the gunicorn service. Accepts a hash of Default value: ``false`` -##### `timeout` +##### `timeout` Data type: `Integer` @@ -476,7 +531,7 @@ Allows setting the gunicorn idle worker process time before being killed. The un Default value: `30` -##### `template` +##### `template` Data type: `String[1]` @@ -484,7 +539,7 @@ Which ERB template to use. Default value: `'python/gunicorn.erb'` -##### `args` +##### `args` Data type: `Array` @@ -492,7 +547,7 @@ Custom arguments to add in gunicorn config file. Default value: `[]` -##### `owner` +##### `owner` Data type: `String[1]` @@ -500,7 +555,7 @@ Data type: `String[1]` Default value: `'www-data'` -##### `group` +##### `group` Data type: `String[1]` @@ -508,7 +563,7 @@ Data type: `String[1]` Default value: `'www-data'` -##### `workers` +##### `workers` Data type: `Variant[Boolean,Integer]` @@ -516,7 +571,7 @@ Data type: `Variant[Boolean,Integer]` Default value: ``false`` -##### `access_log_format` +##### `access_log_format` Data type: `Variant[Boolean,String[1]]` @@ -524,7 +579,7 @@ Data type: `Variant[Boolean,String[1]]` Default value: ``false`` -##### `accesslog` +##### `accesslog` Data type: `Variant[Boolean,Stdlib::Absolutepath]` @@ -532,7 +587,7 @@ Data type: `Variant[Boolean,Stdlib::Absolutepath]` Default value: ``false`` -##### `errorlog` +##### `errorlog` Data type: `Variant[Boolean,Stdlib::Absolutepath]` @@ -540,7 +595,7 @@ Data type: `Variant[Boolean,Stdlib::Absolutepath]` Default value: ``false`` -##### `log_level` +##### `log_level` Data type: `Python::Loglevel` @@ -548,7 +603,7 @@ Data type: `Python::Loglevel` Default value: `'error'` -### `python::pip` +### `python::pip` Installs and manages packages from pip. @@ -594,13 +649,35 @@ python::pip { 'requests' : #### Parameters -The following parameters are available in the `python::pip` defined type. - -##### `name` +The following parameters are available in the `python::pip` defined type: + +* [`name`](#name) +* [`pkgname`](#pkgname) +* [`ensure`](#ensure) +* [`virtualenv`](#virtualenv) +* [`pip_provider`](#pip_provider) +* [`url`](#url) +* [`owner`](#owner) +* [`group`](#group) +* [`index`](#index) +* [`proxy`](#proxy) +* [`editable`](#editable) +* [`environment`](#environment) +* [`extras`](#extras) +* [`timeout`](#timeout) +* [`install_args`](#install_args) +* [`uninstall_args`](#uninstall_args) +* [`log_dir`](#log_dir) +* [`egg`](#egg) +* [`umask`](#umask) +* [`path`](#path) +* [`exec_provider`](#exec_provider) + +##### `name` must be unique -##### `pkgname` +##### `pkgname` Data type: `String[1]` @@ -608,7 +685,7 @@ the name of the package. Default value: `$name` -##### `ensure` +##### `ensure` Data type: `Variant[Enum[present, absent, latest], String[1]]` @@ -616,7 +693,7 @@ Require pip to be available. Default value: `present` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Enum['system'], Stdlib::Absolutepath]` @@ -624,7 +701,7 @@ virtualenv to run pip in. Default value: `'system'` -##### `pip_provider` +##### `pip_provider` Data type: `String[1]` @@ -632,7 +709,7 @@ version of pip you wish to use. Default value: `'pip'` -##### `url` +##### `url` Data type: `Variant[Boolean, String]` @@ -640,7 +717,7 @@ URL to install from. Default value: ``false`` -##### `owner` +##### `owner` Data type: `String[1]` @@ -648,7 +725,7 @@ The owner of the virtualenv being manipulated. Default value: `'root'` -##### `group` +##### `group` Data type: `Optional[String[1]]` @@ -656,7 +733,7 @@ The group of the virtualenv being manipulated. Default value: `getvar('python::params::group')` -##### `index` +##### `index` Data type: `Variant[Boolean,String[1]]` @@ -664,7 +741,7 @@ Base URL of Python package index. Default value: ``false`` -##### `proxy` +##### `proxy` Data type: `Optional[Stdlib::HTTPUrl]` @@ -672,7 +749,7 @@ Proxy server to use for outbound connections. Default value: ``undef`` -##### `editable` +##### `editable` Data type: `Boolean` @@ -680,7 +757,7 @@ If true the package is installed as an editable resource. Default value: ``false`` -##### `environment` +##### `environment` Data type: `Array` @@ -688,7 +765,7 @@ Additional environment variables required to install the packages. Default value: `[]` -##### `extras` +##### `extras` Data type: `Array` @@ -696,7 +773,7 @@ Extra features provided by the package which should be installed. Default value: `[]` -##### `timeout` +##### `timeout` Data type: `Numeric` @@ -704,7 +781,7 @@ The maximum time in seconds the "pip install" command should take. Default value: `1800` -##### `install_args` +##### `install_args` Data type: `String` @@ -712,7 +789,7 @@ Any additional installation arguments that will be supplied when running pip ins Default value: `''` -##### `uninstall_args` +##### `uninstall_args` Data type: `String` @@ -720,7 +797,7 @@ Any additional arguments that will be supplied when running pip uninstall. Default value: `''` -##### `log_dir` +##### `log_dir` Data type: `String[1]` @@ -728,7 +805,7 @@ Log directory Default value: `'/tmp'` -##### `egg` +##### `egg` Data type: `Any` @@ -736,7 +813,7 @@ The egg name to use Default value: ``false`` -##### `umask` +##### `umask` Data type: `Optional[Python::Umask]` @@ -744,7 +821,7 @@ Data type: `Optional[Python::Umask]` Default value: ``undef`` -##### `path` +##### `path` Data type: `Array[String]` @@ -752,7 +829,7 @@ Data type: `Array[String]` Default value: `['/usr/local/bin','/usr/bin','/bin', '/usr/sbin']` -##### `exec_provider` +##### `exec_provider` Data type: `String[1]` @@ -760,7 +837,7 @@ Data type: `String[1]` Default value: `'shell'` -### `python::pyvenv` +### `python::pyvenv` Create a Python3 virtualenv using pyvenv. @@ -781,9 +858,20 @@ python::pyvenv { '/var/www/project1' : #### Parameters -The following parameters are available in the `python::pyvenv` defined type. +The following parameters are available in the `python::pyvenv` defined type: -##### `ensure` +* [`ensure`](#ensure) +* [`version`](#version) +* [`systempkgs`](#systempkgs) +* [`venv_dir`](#venv_dir) +* [`owner`](#owner) +* [`group`](#group) +* [`mode`](#mode) +* [`path`](#path) +* [`environment`](#environment) +* [`pip_version`](#pip_version) + +##### `ensure` Data type: `Python::Package::Ensure` @@ -791,7 +879,7 @@ Data type: `Python::Package::Ensure` Default value: `present` -##### `version` +##### `version` Data type: `Python::Version` @@ -799,7 +887,7 @@ Python version to use. Default value: `'system'` -##### `systempkgs` +##### `systempkgs` Data type: `Boolean` @@ -807,7 +895,7 @@ Copy system site-packages into virtualenv Default value: ``false`` -##### `venv_dir` +##### `venv_dir` Data type: `Stdlib::Absolutepath` @@ -815,7 +903,7 @@ Directory to install virtualenv to Default value: `$name` -##### `owner` +##### `owner` Data type: `String[1]` @@ -823,7 +911,7 @@ The owner of the virtualenv being manipulated Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -831,7 +919,7 @@ The group relating to the virtualenv being manipulated Default value: `'root'` -##### `mode` +##### `mode` Data type: `Stdlib::Filemode` @@ -839,7 +927,7 @@ Optionally specify directory mode Default value: `'0755'` -##### `path` +##### `path` Data type: `Array[Stdlib::Absolutepath]` @@ -847,7 +935,7 @@ Specifies the PATH variable. Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` -##### `environment` +##### `environment` Data type: `Array` @@ -855,7 +943,15 @@ Optionally specify environment variables for pyvenv Default value: `[]` -### `python::requirements` +##### `pip_version` + +Data type: `Python::Venv::PipVersion` + + + +Default value: `'latest'` + +### `python::requirements` Installs and manages Python packages from requirements file. @@ -874,9 +970,25 @@ python::requirements { '/var/www/project1/requirements.txt' : #### Parameters -The following parameters are available in the `python::requirements` defined type. - -##### `requirements` +The following parameters are available in the `python::requirements` defined type: + +* [`requirements`](#requirements) +* [`virtualenv`](#virtualenv) +* [`pip_provider`](#pip_provider) +* [`owner`](#owner) +* [`group`](#group) +* [`proxy`](#proxy) +* [`src`](#src) +* [`environment`](#environment) +* [`forceupdate`](#forceupdate) +* [`cwd`](#cwd) +* [`extra_pip_args`](#extra_pip_args) +* [`manage_requirements`](#manage_requirements) +* [`fix_requirements_owner`](#fix_requirements_owner) +* [`log_dir`](#log_dir) +* [`timeout`](#timeout) + +##### `requirements` Data type: `Stdlib::Absolutepath` @@ -884,7 +996,7 @@ Path to the requirements file. Default value: `$name` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Enum['system'],Stdlib::Absolutepath]` @@ -892,7 +1004,7 @@ virtualenv to run pip in. Default value: `'system'` -##### `pip_provider` +##### `pip_provider` Data type: `Enum['pip', 'pip3']` @@ -900,7 +1012,7 @@ version of pip you wish to use. Default value: `'pip'` -##### `owner` +##### `owner` Data type: `String[1]` @@ -908,7 +1020,7 @@ The owner of the virtualenv being manipulated. Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -916,7 +1028,7 @@ The group relating to the virtualenv being manipulated. Default value: `'root'` -##### `proxy` +##### `proxy` Data type: `Optional[Stdlib::HTTPUrl]` @@ -924,7 +1036,7 @@ Proxy server to use for outbound connections. Default value: ``undef`` -##### `src` +##### `src` Data type: `Any` @@ -932,7 +1044,7 @@ Pip --src parameter to; if the requirements file contains --editable resources, Default value: ``false`` -##### `environment` +##### `environment` Data type: `Array` @@ -940,7 +1052,7 @@ Additional environment variables required to install the packages. Default value: `[]` -##### `forceupdate` +##### `forceupdate` Data type: `Boolean` @@ -948,7 +1060,7 @@ Run a pip install requirements even if we don't receive an event from the requir Default value: ``false`` -##### `cwd` +##### `cwd` Data type: `Optional[Stdlib::Absolutepath]` @@ -956,7 +1068,7 @@ The directory from which to run the "pip install" command. Default value: ``undef`` -##### `extra_pip_args` +##### `extra_pip_args` Data type: `String` @@ -964,7 +1076,7 @@ Extra arguments to pass to pip after the requirements file Default value: `''` -##### `manage_requirements` +##### `manage_requirements` Data type: `Boolean` @@ -972,7 +1084,7 @@ Create the requirements file if it doesn't exist. Default value: ``true`` -##### `fix_requirements_owner` +##### `fix_requirements_owner` Data type: `Boolean` @@ -980,7 +1092,7 @@ Change owner and group of requirements file. Default value: ``true`` -##### `log_dir` +##### `log_dir` Data type: `Stdlib::Absolutepath` @@ -988,7 +1100,7 @@ Log directory. Default value: `'/tmp'` -##### `timeout` +##### `timeout` Data type: `Integer` @@ -998,33 +1110,63 @@ Default value: `1800` ## Data types -### `Python::Loglevel` +### `Python::Loglevel` A version type to match all valid loglevels for python -Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']` +Alias of + +```puppet +Enum['debug', 'info', 'warning', 'error', 'critical'] +``` -### `Python::Package::Ensure` +### `Python::Package::Ensure` A version type to match all valid package ensures for python -Alias of `Enum['absent', 'present', 'latest']` +Alias of -### `Python::Provider` +```puppet +Enum['absent', 'present', 'latest'] +``` + +### `Python::Provider` A version type to match all valid provider for python -Alias of `Enum['pip', 'scl', 'rhscl', 'anaconda', '']` +Alias of + +```puppet +Enum['pip', 'scl', 'rhscl', 'anaconda', ''] +``` -### `Python::Umask` +### `Python::Umask` A version type to match valid umask for python -Alias of `Pattern[/[0-7]{1,4}/]` +Alias of + +```puppet +Pattern[/[0-7]{1,4}/] +``` + +### `Python::Venv::PipVersion` -### `Python::Version` +A version type to ensure a specific Pip version in a virtual env. + +Alias of + +```puppet +Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/] +``` + +### `Python::Version` A version type to match all valid versions for python -Alias of `Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]` +Alias of + +```puppet +Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] +``` diff --git a/metadata.json b/metadata.json index b86bb557..865dfbb4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.1.1-rc0", + "version": "6.2.0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From 92ad355d1051aec77aac53e3dfcdd1655c13acf0 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Thu, 26 Aug 2021 17:25:40 +0300 Subject: [PATCH 249/380] [blacksmith] Bump version to 6.2.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 865dfbb4..b65cdc34 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.2.0", + "version": "6.2.1-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From d72954ba192db503f5414a5825f0d1f106315468 Mon Sep 17 00:00:00 2001 From: Christos Papageorgiou Date: Fri, 27 Aug 2021 12:33:55 +0300 Subject: [PATCH 250/380] Modulesync 4.2.0 --- .editorconfig | 3 ++- .github/CONTRIBUTING.md | 2 +- .github/workflows/ci.yml | 31 +++++++++++++++++++++---------- .github/workflows/release.yml | 5 +++++ .gitignore | 3 +++ .msync.yml | 5 ++++- .overcommit.yml | 3 ++- .pmtignore | 3 +++ .rspec | 3 +++ .rspec_parallel | 3 +++ .rubocop.yml | 3 +++ .yardopts | 2 -- Dockerfile | 3 +++ Gemfile | 21 +++++++++++---------- Rakefile | 23 +++++++++++++++++------ spec/spec_helper.rb | 5 ++--- spec/spec_helper_acceptance.rb | 4 +++- 17 files changed, 86 insertions(+), 36 deletions(-) delete mode 100644 .yardopts diff --git a/.editorconfig b/.editorconfig index d77700e3..ecb10a80 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,7 @@ # editorconfig.org -# MANAGED BY MODULESYNC +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ root = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 887d571a..048d2b55 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -25,7 +25,7 @@ By participating in this project you agree to abide by its terms. * Fork the repo. * Create a separate branch for your change. -* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). * Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. * Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. * Squash your commits down into logical components. Make sure to rebase against our current master. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97ddc620..2ce5b055 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,7 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: CI on: pull_request @@ -8,20 +12,19 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 40 outputs: - beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} - puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} env: - BUNDLE_WITHOUT: development:release + BUNDLE_WITHOUT: development:system_tests:release steps: - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true - - name: Run rake validate - run: bundle exec rake validate + - name: Run static validations + run: bundle exec rake validate lint check - name: Run rake rubocop run: bundle exec rake rubocop - name: Setup Test Matrix @@ -48,7 +51,7 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests - run: bundle exec rake + run: bundle exec rake parallel_spec acceptance: needs: setup_matrix @@ -58,18 +61,26 @@ jobs: strategy: fail-fast: false matrix: - setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} - puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} steps: - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true - name: Run tests run: bundle exec rake beaker env: BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} BEAKER_setfile: ${{ matrix.setfile.value }} + + tests: + needs: + - unit + - acceptance + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68b85284..664ba694 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,3 +1,7 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: Release on: @@ -12,6 +16,7 @@ jobs: deploy: name: 'deploy to forge' runs-on: ubuntu-latest + if: github.repository_owner == 'voxpupuli' steps: - name: Checkout repository uses: actions/checkout@v2 diff --git a/.gitignore b/.gitignore index e9b3cf4b..9b95224c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + pkg/ Gemfile.lock Gemfile.local diff --git a/.msync.yml b/.msync.yml index 57ff5038..43966c2f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,5 @@ --- -modulesync_config_version: '4.1.0' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '4.2.0' diff --git a/.overcommit.yml b/.overcommit.yml index 0af0fdc0..d367adae 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -1,4 +1,5 @@ -# Managed by https://github.com/voxpupuli/modulesync_configs +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # # Hooks are only enabled if you take action. # diff --git a/.pmtignore b/.pmtignore index 33a8c65d..65f50514 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,3 +1,6 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + docs/ pkg/ Gemfile diff --git a/.rspec b/.rspec index 8c18f1ab..f634583d 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation --color diff --git a/.rspec_parallel b/.rspec_parallel index e4d136b7..a9a84f85 100644 --- a/.rspec_parallel +++ b/.rspec_parallel @@ -1 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format progress diff --git a/.rubocop.yml b/.rubocop.yml index 198a3599..53ac1898 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + inherit_gem: voxpupuli-test: rubocop.yml diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 3687f518..00000000 --- a/.yardopts +++ /dev/null @@ -1,2 +0,0 @@ ---markup markdown ---output-dir docs/ diff --git a/Dockerfile b/Dockerfile index a51c6416..e3cf307f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + FROM ruby:2.7 WORKDIR /opt/puppet diff --git a/Gemfile b/Gemfile index f4855f64..a39114ce 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,13 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.1', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false + gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end group :development do @@ -12,22 +16,19 @@ group :development do end group :system_tests do - gem 'puppet_metadata', '~> 0.3.0', :require => false - gem 'voxpupuli-acceptance', :require => false + gem 'voxpupuli-acceptance', '~> 1.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.0.2', :require => false gem 'puppet-strings', '>= 2.2', :require => false end -gem 'puppetlabs_spec_helper', '~> 2.0', :require => false gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index d1bf7491..80b799d6 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,22 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + # Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' rescue LoadError - require 'puppetlabs_spec_helper/rake_tasks' + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end +end + +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError end # load optional tasks for releases @@ -34,14 +47,12 @@ begin require 'github_changelog_generator/task' require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - version = (Blacksmith::Modulefile.new).version - config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' - metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') - metadata = JSON.load(File.read(metadata_json)) - config.project = metadata['name'] + config.project = metadata.metadata['name'] end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d266f6b4..fb5f0cbe 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,5 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index bec34fdd..d3b906bf 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,4 +1,6 @@ -# This file is completely managed via modulesync +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + require 'voxpupuli/acceptance/spec_helper_acceptance' configure_beaker From f962dc943a6b4cc070f02fd167369c6a0bfec367 Mon Sep 17 00:00:00 2001 From: Alex Cullen <62033527+acullenhms@users.noreply.github.com> Date: Fri, 27 Aug 2021 11:50:29 -0400 Subject: [PATCH 251/380] Add declared requirements install test (#1) Add unit test for verifying requirements installation to declared venv --- .../declared_requirements_install_spec.rb | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 spec/acceptance/declared_requirements_install_spec.rb diff --git a/spec/acceptance/declared_requirements_install_spec.rb b/spec/acceptance/declared_requirements_install_spec.rb new file mode 100644 index 00000000..185e6db2 --- /dev/null +++ b/spec/acceptance/declared_requirements_install_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper_acceptance' + +describe 'requirements' do + it 'checks declared requirements file is installed to venv' do + pp = <<-EOS + file { '/tmp/requirements.txt': + ensure => 'present', + content => 'requests', + } + + python::pyvenv { '/tmp/pyvenv': + ensure => 'present', + } + + python::requirements { '/tmp/requirements.txt': + virtualenv => '/tmp/pyvenv' + } + EOS + + apply_manifest(pp, catch_failures: true) + + expect(shell('/tmp/pyvenv/bin/pip3 list --no-index | grep requests').stdout).to match(%r{requests +\d+.\d+.\d+}) + end +end From 2d0da576a53fabce6ca86e0644b00e5d78d9c8d9 Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 18 Sep 2021 00:26:30 +0200 Subject: [PATCH 252/380] modulesync 4.2.0 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ce5b055..d08d05e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ name: CI on: pull_request +concurrency: + group: ${{ github.head_ref }} + cancel-in-progress: true + jobs: setup_matrix: name: 'Setup Test Matrix' From 2db549d114648ba22a3824c9ba8b02bda0b16071 Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Sun, 14 Nov 2021 21:06:30 +0900 Subject: [PATCH 253/380] remove duplicated args --- manifests/pip.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 3935df72..352ea6a5 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -173,7 +173,7 @@ } $pip_install = "${pip_env} --log ${log}/pip.log install" - $pip_common_args = "${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${source}" + $pip_common_args = "${pypi_index} ${proxy_flag} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { @@ -195,7 +195,7 @@ 'present': { # Whatever version is available. - $command = "${pip_install} ${pip_common_args}" + $command = "${pip_install} ${install_args} ${pip_common_args}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } @@ -214,7 +214,7 @@ $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" $installed_version = join( ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",]) - $command = "${pip_install} --upgrade ${pip_common_args}" + $command = "${pip_install} --upgrade ${install_args} ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" } From 6aece7ee19ff8d710708b99fcdb494a728edec61 Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Sun, 14 Nov 2021 22:09:37 +0900 Subject: [PATCH 254/380] fix expected command --- spec/defines/pip_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index a51e916a..2c815a08 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -68,7 +68,7 @@ context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } end end @@ -81,7 +81,7 @@ context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } end end From 1318ea22b5fac4d9f019fbea6869de2db15d851f Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 15 Nov 2021 12:38:33 -0500 Subject: [PATCH 255/380] RHEL8 has a different package name --- manifests/params.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/params.pp b/manifests/params.pp index 32f13a72..a10e1eb4 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -42,7 +42,10 @@ } $gunicorn_package_name = $facts['os']['family'] ? { - 'RedHat' => 'python-gunicorn', + 'RedHat' => $facts['os']['release']['major'] ? { + '8' => 'python3-gunicorn', + default => 'python-gunicorn', + }, default => 'gunicorn', } } From 117b7411d0466953b2ffc7c7cf7e2f7a91a2ecf9 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Mon, 15 Nov 2021 22:44:50 -0500 Subject: [PATCH 256/380] Add gunicorn tests for RHEL7 and all tests for RHEL8 --- spec/classes/python_spec.rb | 83 ++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 4e2bc1ac..535796ee 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' - describe 'python' do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' @@ -240,6 +239,88 @@ it { is_expected.to contain_package('python-dev').with_name('python36-devel') } end end + + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn') } + end + end + + describe 'with python::provider' do + context 'scl' do + describe 'with version' do + context '3.6 SCL meta package' do + let(:params) { { version: 'rh-python36' } } + + it { is_expected.to compile.with_all_deps } + end + context '3.6 SCL python package' do + let(:params) { { version: 'rh-python36-python' } } + + it { is_expected.to compile.with_all_deps } + end + end + describe 'with manage_scl' do + context 'true' do + let(:params) { { provider: 'scl', manage_scl: true } } + + it { is_expected.to contain_package('centos-release-scl') } + it { is_expected.to contain_package('scl-utils') } + end + context 'false' do + let(:params) { { provider: 'scl', manage_scl: false } } + + it { is_expected.not_to contain_package('centos-release-scl') } + it { is_expected.not_to contain_package('scl-utils') } + end + end + end + end + end + when '8' + context 'on a Redhat 8 OS' do + it { is_expected.to contain_class('python::install') } + it { is_expected.to contain_package('pip').with_name('python3-pip') } + + describe 'with python::version' do + context 'python36' do + let(:params) { { version: 'python36' } } + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_package('pip').with_name('python36-pip') } + it { is_expected.to contain_package('python').with_name('python36') } + it { is_expected.to contain_package('python-dev').with_name('python36-devel') } + end + end + + describe 'with manage_gunicorn' do + context 'true' do + let(:params) { { manage_gunicorn: true } } + + it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') } + end + context 'empty args' do + # let(:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') } + end + context 'false' do + let(:params) { { manage_gunicorn: false } } + + it { is_expected.not_to contain_package('gunicorn').with_name('python3-gunicorn') } + end + end + describe 'with python::provider' do context 'scl' do describe 'with version' do From fe1c01828a9be5c9d26f612f547a9536f65e4abb Mon Sep 17 00:00:00 2001 From: Kentaro Horio Date: Wed, 17 Nov 2021 00:53:32 +0900 Subject: [PATCH 257/380] add test for install_args --- spec/defines/pip_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 2c815a08..7ef1c57d 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -94,6 +94,14 @@ end end + describe 'install_args as' do + context 'adds install_args to install command if install_args set' do + let(:params) { { install_args: '--pre' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') } + end + end + describe 'install latest' do context 'does not use pip search in unless' do let(:params) { { ensure: 'latest' } } From 371dc10ca4ae6481565901511b73867ea5c65b58 Mon Sep 17 00:00:00 2001 From: Steve Traylen Date: Thu, 2 Dec 2021 16:31:23 +0100 Subject: [PATCH 258/380] Correct python::pip::environment parameter example The example for `python::pip{'cx_Oracle':...}` used and invalid environment parameter. --- REFERENCE.md | 2 +- manifests/pip.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 8a84e95d..34f99698 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -628,7 +628,7 @@ python::pip { 'cx_Oracle' : virtualenv => '/var/www/project1', owner => 'appuser', proxy => 'http://proxy.domain.com:3128', - environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', + environment => ['ORACLE_HOME=/usr/lib/oracle/11.2/client64'], install_args => '-e', timeout => 1800, } diff --git a/manifests/pip.pp b/manifests/pip.pp index 3935df72..d14b5093 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -33,7 +33,7 @@ # virtualenv => '/var/www/project1', # owner => 'appuser', # proxy => 'http://proxy.domain.com:3128', -# environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', +# environment => ['ORACLE_HOME=/usr/lib/oracle/11.2/client64'], # install_args => '-e', # timeout => 1800, # } From 2bf0d3815aef101afccd146cea910f21f28b6f10 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 10:23:35 +0100 Subject: [PATCH 259/380] modulesync 5.1.0 --- .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 4 ++-- Rakefile | 2 +- spec/spec_helper.rb | 10 +++++----- spec/spec_helper_acceptance.rb | 2 ++ 6 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .puppet-lint.rc diff --git a/.msync.yml b/.msync.yml index 43966c2f..a83abd9b 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '4.2.0' +modulesync_config_version: '5.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc new file mode 100644 index 00000000..dd8272c7 --- /dev/null +++ b/.puppet-lint.rc @@ -0,0 +1,3 @@ +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/Gemfile b/Gemfile index a39114ce..b6dcf456 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'voxpupuli-test', '~> 5.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -21,7 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.0.2', :require => false + gem 'voxpupuli-release', '>= 1.2.0', :require => false gem 'puppet-strings', '>= 2.2', :require => false end diff --git a/Rakefile b/Rakefile index 80b799d6..f92f0516 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb5f0cbe..4d617f39 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,17 +1,17 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. -ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) - if facts - facts.each do |name, value| - add_custom_fact name.to_sym, value - end + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3b906bf..d3a6e23c 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ From 665f4dd2e53f79ae633d1dd6539f06d7962f57ab Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 10:31:28 +0100 Subject: [PATCH 260/380] puppet-lint: fix params_empty_string_assignment --- REFERENCE.md | 12 ++++++------ manifests/pip.pp | 8 ++++---- manifests/requirements.pp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 34f99698..6f4bc8aa 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -783,19 +783,19 @@ Default value: `1800` ##### `install_args` -Data type: `String` +Data type: `Optional[String[1]]` Any additional installation arguments that will be supplied when running pip install. -Default value: `''` +Default value: ``undef`` ##### `uninstall_args` -Data type: `String` +Data type: `Optional[String[1]]` Any additional arguments that will be supplied when running pip uninstall. -Default value: `''` +Default value: ``undef`` ##### `log_dir` @@ -1070,11 +1070,11 @@ Default value: ``undef`` ##### `extra_pip_args` -Data type: `String` +Data type: `Optional[String[1]]` Extra arguments to pass to pip after the requirements file -Default value: `''` +Default value: ``undef`` ##### `manage_requirements` diff --git a/manifests/pip.pp b/manifests/pip.pp index 183f1cdc..33c7faa4 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -62,8 +62,8 @@ Boolean $editable = false, Array $environment = [], Array $extras = [], - String $install_args = '', - String $uninstall_args = '', + Optional[String[1]] $install_args = undef, + Optional[String[1]] $uninstall_args = undef, Numeric $timeout = 1800, String[1] $log_dir = '/tmp', Array[String] $path = ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], @@ -127,11 +127,11 @@ } # TODO: Do more robust argument checking, but below is a start - if ($ensure == absent) and ($install_args != '') { + if ($ensure == absent) and $install_args { fail('python::pip cannot provide install_args with ensure => absent') } - if ($ensure == present) and ($uninstall_args != '') { + if ($ensure == present) and $uninstall_args { fail('python::pip cannot provide uninstall_args with ensure => present') } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 9d245be3..0b191ea0 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -36,7 +36,7 @@ Array $environment = [], Boolean $forceupdate = false, Optional[Stdlib::Absolutepath] $cwd = undef, - String $extra_pip_args = '', + Optional[String[1]] $extra_pip_args = undef, Boolean $manage_requirements = true, Boolean $fix_requirements_owner = true, Stdlib::Absolutepath $log_dir = '/tmp', From ec5ec2df502965b91df484a2d0f7d21e540ba3a1 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 10:38:34 +0100 Subject: [PATCH 261/380] rubocop: fix violations --- lib/facter/pip_version.rb | 2 ++ lib/facter/python_release.rb | 2 ++ lib/facter/python_version.rb | 2 ++ lib/facter/virtualenv_version.rb | 2 ++ spec/acceptance/class_spec.rb | 5 ++- spec/acceptance/facts_test_spec.rb | 6 ++-- spec/acceptance/pip_spec.rb | 4 +++ spec/acceptance/pyvenv_spec.rb | 2 ++ spec/classes/python_spec.rb | 38 ++++++++++++++++++--- spec/defines/dotfile_spec.rb | 9 ++++- spec/defines/gunicorn_spec.rb | 2 ++ spec/defines/pip_spec.rb | 14 +++++++- spec/defines/pyvenv_spec.rb | 11 +++--- spec/defines/requirements_spec.rb | 2 ++ spec/type_aliases/venv/pipversion_spec.rb | 6 ++-- spec/unit/facter/pip_version_spec.rb | 20 ++++++----- spec/unit/facter/python_release_spec.rb | 14 ++++---- spec/unit/facter/python_version_spec.rb | 14 ++++---- spec/unit/facter/virtualenv_version_spec.rb | 14 ++++---- 19 files changed, 125 insertions(+), 44 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 11db4d60..3303b237 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Make pip version available as a fact def get_pip_version(executable) diff --git a/lib/facter/python_release.rb b/lib/facter/python_release.rb index 5013b5c3..fab88dbd 100644 --- a/lib/facter/python_release.rb +++ b/lib/facter/python_release.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Make python release available as facts def get_python_release(executable) diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index e21723bb..fe70684e 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Make python versions available as facts def get_python_version(executable) diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index dbaba059..c8bfdab3 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Make virtualenv version available as a fact Facter.add('virtualenv_version') do diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 5caac95e..e700abc2 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'python class' do @@ -28,10 +30,11 @@ class { 'python': apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end + fact_notices = <<-EOS notify{"pip_version: ${facts['pip3_version']}":} notify{"python_version: ${facts['python3_version']}":} - EOS + EOS it 'outputs python facts when not installed' do apply_manifest(fact_notices, catch_failures: true) do |r| expect(r.stdout).to match(%r{python_version: 3\.\S+}) diff --git a/spec/acceptance/facts_test_spec.rb b/spec/acceptance/facts_test_spec.rb index 20f3c54a..b6393a79 100644 --- a/spec/acceptance/facts_test_spec.rb +++ b/spec/acceptance/facts_test_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'python class' do @@ -6,13 +8,13 @@ class { 'python' : pip => 'present', } - EOS + EOS fact_notices = <<-EOS notify{"pip_version: ${facts['pip_version']}":} notify{"system_python_version: ${facts['system_python_version']}":} notify{"python_version: ${facts['python_version']}":} - EOS + EOS # rubocop:disable RSpec/RepeatedExample it 'outputs python facts when not installed' do diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index f2da5ecd..a67eeafa 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'python::pip defined resource' do @@ -28,6 +30,7 @@ class { 'python': end end + # rubocop:disable RSpec/RepeatedExampleGroupDescription describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } @@ -71,4 +74,5 @@ class { 'python': its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end + # rubocop:enable RSpec/RepeatedExampleGroupDescription end diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index a6234637..b8fb327a 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'python::pyvenv defined resource with python 3' do diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 535796ee..c539d97e 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,7 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'python' do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' + context "on #{os}" do let :facts do facts @@ -51,6 +54,7 @@ end end + # rubocop:disable RSpec/RepeatedExampleGroupDescription describe 'with python::dev' do context 'true' do let(:params) { { dev: 'present' } } @@ -58,6 +62,7 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('python-dev').with_ensure('present') } end + context 'empty/default' do it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('python-dev').with_ensure('absent') } @@ -117,8 +122,9 @@ it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') } it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } + it { - is_expected.to contain_exec('python_virtualenv_/opt/env1'). + expect(subject).to contain_exec('python_virtualenv_/opt/env1'). with( command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', user: 'root', @@ -132,12 +138,13 @@ cwd: '/tmp', environment: [], timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env1\[\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} ). that_requires('File[/opt/env1]') } + it { - is_expected.to contain_exec('python_virtualenv_/opt/env2'). + expect(subject).to contain_exec('python_virtualenv_/opt/env2'). with( command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', user: 'root', @@ -151,10 +158,11 @@ cwd: '/tmp', environment: [], timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env2\[\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} ). that_requires('File[/opt/env2]') } + it { is_expected.to contain_file('/opt/env1') } it { is_expected.to contain_file('/opt/env2') } end @@ -166,10 +174,12 @@ it { is_expected.to contain_package('gunicorn') } end + context 'empty args' do # let(:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package('gunicorn') } end + context 'false' do let(:params) { { manage_gunicorn: false } } @@ -198,6 +208,7 @@ it { is_expected.to contain_package('python-dev').with_ensure('present') } end + context 'default/empty' do it { is_expected.to contain_package('python-dev').with_ensure('absent') } end @@ -246,10 +257,12 @@ it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } end + context 'empty args' do # let(:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } end + context 'false' do let(:params) { { manage_gunicorn: false } } @@ -265,12 +278,14 @@ it { is_expected.to compile.with_all_deps } end + context '3.6 SCL python package' do let(:params) { { version: 'rh-python36-python' } } it { is_expected.to compile.with_all_deps } end end + describe 'with manage_scl' do context 'true' do let(:params) { { provider: 'scl', manage_scl: true } } @@ -278,6 +293,7 @@ it { is_expected.to contain_package('centos-release-scl') } it { is_expected.to contain_package('scl-utils') } end + context 'false' do let(:params) { { provider: 'scl', manage_scl: false } } @@ -310,10 +326,12 @@ it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') } end + context 'empty args' do # let(:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package('gunicorn').with_name('python3-gunicorn') } end + context 'false' do let(:params) { { manage_gunicorn: false } } @@ -329,12 +347,14 @@ it { is_expected.to compile.with_all_deps } end + context '3.6 SCL python package' do let(:params) { { version: 'rh-python36-python' } } it { is_expected.to compile.with_all_deps } end end + describe 'with manage_scl' do context 'true' do let(:params) { { provider: 'scl', manage_scl: true } } @@ -342,6 +362,7 @@ it { is_expected.to contain_package('centos-release-scl') } it { is_expected.to contain_package('scl-utils') } end + context 'false' do let(:params) { { provider: 'scl', manage_scl: false } } @@ -371,6 +392,7 @@ it { is_expected.to contain_package('python-dev').with_ensure('present') } end + context 'empty/default' do it { is_expected.to contain_package('python-dev').with_ensure('absent') } end @@ -382,10 +404,12 @@ it { is_expected.to contain_package('gunicorn') } end + context 'empty args' do # let(:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package('gunicorn') } end + context 'false' do let(:params) { { manage_gunicorn: false } } @@ -398,7 +422,7 @@ let(:params) { { provider: 'pip' } } it { - is_expected.to contain_package('pip').with( + expect(subject).to contain_package('pip').with( 'provider' => 'pip' ) } @@ -418,6 +442,7 @@ it { is_expected.to contain_package('python-dev').with_ensure('present') } end + context 'default/empty' do it { is_expected.to contain_package('python-dev').with_ensure('absent') } end @@ -445,10 +470,12 @@ it { is_expected.to contain_package('gunicorn') } end + context 'empty args' do # let(:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package('gunicorn') } end + context 'false' do let(:params) { { manage_gunicorn: false } } @@ -468,3 +495,4 @@ end end end +# rubocop:enable RSpec/RepeatedExampleGroupDescription diff --git a/spec/defines/dotfile_spec.rb b/spec/defines/dotfile_spec.rb index d7d469e4..30ce21b3 100644 --- a/spec/defines/dotfile_spec.rb +++ b/spec/defines/dotfile_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'python::dotfile', type: :define do on_supported_os.each do |os, facts| - context("on #{os} ") do + context("on #{os}") do let :facts do facts end @@ -13,23 +15,27 @@ it { is_expected.to raise_error(%r{Evaluation Error: Empty string title at 0. Title strings must have a length greater than zero.}) } end + context 'fails with incorrect mode' do let(:title) { '/etc/pip.conf' } let(:params) { { mode: 'not-a-mode' } } it { is_expected.to raise_error(%r{Evaluation Error: Error while evaluating a Resource}) } end + context 'succeeds with filename in existing path' do let(:title) { '/etc/pip.conf' } it { is_expected.to contain_file('/etc/pip.conf').with_mode('0644') } end + context 'succeeds with filename in a non-existing path' do let(:title) { '/home/someuser/.pip/pip.conf' } it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o root -g root -d /home/someuser/.pip') } it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_mode('0644') } end + context 'succeeds when set owner' do let(:title) { '/home/someuser/.pip/pip.conf' } let(:params) { { owner: 'someuser' } } @@ -37,6 +43,7 @@ it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o someuser -g root -d /home/someuser/.pip') } it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_owner('someuser') } end + context 'succeeds when set group set' do let(:title) { '/home/someuser/.pip/pip.conf' } let(:params) { { group: 'somegroup' } } diff --git a/spec/defines/gunicorn_spec.rb b/spec/defines/gunicorn_spec.rb index d2563054..13284087 100644 --- a/spec/defines/gunicorn_spec.rb +++ b/spec/defines/gunicorn_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'python::gunicorn', type: :define do diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 7ef1c57d..5124c4ec 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -1,5 +1,8 @@ +# frozen_string_literal: true + require 'spec_helper' # rubocop:disable RSpec/MultipleDescribes +# rubocop:disable RSpec/RepeatedExampleGroupDescription describe 'python::pip', type: :define do let(:title) { 'rpyc' } @@ -25,13 +28,15 @@ context 'fails with non qualified path' do let(:params) { { virtualenv: 'venv' } } - it { is_expected.to raise_error(%r{expects a match for Variant\[Enum\['system'\].*Stdlib::Windowspath = Pattern\[\/.*\/\], Stdlib::Unixpath = Pattern\[\/.*\/\]\]}) } + it { is_expected.to raise_error(%r{expects a match for Variant\[Enum\['system'\].*Stdlib::Windowspath = Pattern\[/.*/\], Stdlib::Unixpath = Pattern\[/.*/\]\]}) } end + context 'suceeds with qualified path' do let(:params) { { virtualenv: '/opt/venv' } } it { is_expected.to contain_exec('pip_install_rpyc').with_cwd('/opt/venv') } end + context 'defaults to system' do let(:params) { {} } @@ -46,12 +51,14 @@ it { is_expected.to contain_exec('pip_install_rpyc').with_command(%r{pip}) } it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{pip3}) } end + context 'use pip instead of pip3 when specified' do let(:params) { { pip_provider: 'pip' } } it { is_expected.to contain_exec('pip_install_rpyc').with_command(%r{pip}) } it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{pip3}) } end + context 'use pip3 instead of pip when specified' do let(:params) { { pip_provider: 'pip3' } } @@ -65,6 +72,7 @@ it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--proxy}) } end + context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } @@ -78,6 +86,7 @@ it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--index-url}) } end + context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } @@ -108,6 +117,7 @@ it { is_expected.not_to contain_exec('pip_install_rpyc').with_unless(%r{search}) } end + context 'checks installed version of a package by converting underscores in its name to dashes' do let(:params) { { ensure: 'latest', pkgname: 'wordpress_json' } } @@ -137,6 +147,7 @@ end describe 'python::pip', type: :define do + # rubocop:enable RSpec/RepeatedExampleGroupDescription let(:title) { 'requests' } context 'on Debian OS' do @@ -162,6 +173,7 @@ it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests') } end + context 'succeeds with extras' do let(:params) { { extras: ['security'] } } diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 36452839..5194c4e2 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -1,8 +1,11 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'python::pyvenv', type: :define do on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' + context "on #{os}" do let :facts do # python3 is required to use pyvenv @@ -18,9 +21,7 @@ it { is_expected.to contain_file('/opt/env') } it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } - if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename]) - it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } - end + it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename]) end describe 'when ensure' do @@ -32,10 +33,10 @@ end it { - is_expected.to contain_file('/opt/env').with_ensure('absent').with_purge(true) + expect(subject).to contain_file('/opt/env').with_ensure('absent').with_purge(true) } end end - end # context + end end end diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 4e659b79..19f6832e 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'python::requirements', type: :define do diff --git a/spec/type_aliases/venv/pipversion_spec.rb b/spec/type_aliases/venv/pipversion_spec.rb index 986eeb1e..920cf061 100644 --- a/spec/type_aliases/venv/pipversion_spec.rb +++ b/spec/type_aliases/venv/pipversion_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Python::Venv::PipVersion' do @@ -26,7 +28,7 @@ ].each do |value| describe value.inspect do it { - is_expected.to allow_value(value) + expect(subject).to allow_value(value) } end end @@ -50,7 +52,7 @@ ].each do |value| describe value.inspect do it { - is_expected.not_to allow_value(value) + expect(subject).not_to allow_value(value) } end end diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 379323ed..4d7df96a 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Facter::Util::Fact do @@ -6,21 +8,21 @@ end let(:pip_version_output) do - <<-EOS -pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7) -EOS + <<~EOS + pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7) + EOS end let(:pip2_version_output) do - <<-EOS -pip 9.0.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7) -EOS + <<~EOS + pip 9.0.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7) + EOS end let(:pip3_version_output) do - <<-EOS -pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) -EOS + <<~EOS + pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) + EOS end describe 'pip_version' do diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index e6870b9f..d8ec3e5d 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Facter::Util::Fact do @@ -6,14 +8,14 @@ end let(:python2_version_output) do - <<-EOS -Python 2.7.9 -EOS + <<~EOS + Python 2.7.9 + EOS end let(:python3_version_output) do - <<-EOS -Python 3.3.0 -EOS + <<~EOS + Python 3.3.0 + EOS end describe 'python_release' do diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index db302b27..922cb3d6 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Facter::Util::Fact do @@ -6,14 +8,14 @@ end let(:python2_version_output) do - <<-EOS -Python 2.7.9 -EOS + <<~EOS + Python 2.7.9 + EOS end let(:python3_version_output) do - <<-EOS -Python 3.3.0 -EOS + <<~EOS + Python 3.3.0 + EOS end describe 'python_version' do diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb index 3cfd4c99..a6298c1f 100644 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ b/spec/unit/facter/virtualenv_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Facter::Util::Fact do @@ -6,15 +8,15 @@ end let(:virtualenv_old_version_output) do - <<-EOS -12.0.7 -EOS + <<~EOS + 12.0.7 + EOS end let(:virtualenv_new_version_output) do - <<-EOS -virtualenv 20.0.17 from /opt/python/lib/python3.5/site-packages/virtualenv/__init__.py -EOS + <<~EOS + virtualenv 20.0.17 from /opt/python/lib/python3.5/site-packages/virtualenv/__init__.py + EOS end describe 'virtualenv_version old' do From 08898ae8032411c323cd08dcb134160ba7241a4e Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 10:45:07 +0100 Subject: [PATCH 262/380] Enforce types for all params --- .puppet-lint.rc | 1 - .sync.yml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c7..558d766b 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,2 @@ --fail-on-warnings --no-parameter_documentation-check ---no-parameter_types-check diff --git a/.sync.yml b/.sync.yml index 5d21319c..4fa6b004 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,6 @@ --- spec/spec_helper_acceptance.rb: unmanaged: false +.puppet-lint.rc: + enabled_lint_checks: + - parameter_types From 0fd8fed936e76788e813efb8e5efe7631450fa93 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 11:27:10 +0100 Subject: [PATCH 263/380] Release 6.2.1 --- CHANGELOG.md | 18 ++++++++++++++++++ metadata.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba619d2..b788395b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.2.1](https://github.com/voxpupuli/puppet-python/tree/v6.2.1) (2021-12-10) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.2.0...v6.2.1) + +**Fixed bugs:** + +- Correct python::pip::environment parameter example [\#629](https://github.com/voxpupuli/puppet-python/pull/629) ([traylenator](https://github.com/traylenator)) +- gunicorn: RHEL8 has a different package name [\#628](https://github.com/voxpupuli/puppet-python/pull/628) ([yakatz](https://github.com/yakatz)) +- Remove duplicate arguments in the pip install command [\#627](https://github.com/voxpupuli/puppet-python/pull/627) ([zanyou](https://github.com/zanyou)) + +**Closed issues:** + +- Package with provider pip3 tries installing every run. [\#626](https://github.com/voxpupuli/puppet-python/issues/626) + +**Merged pull requests:** + +- modulesync 5.1.0 & puppet-lint: fix params\_empty\_string\_assignment [\#631](https://github.com/voxpupuli/puppet-python/pull/631) ([bastelfreak](https://github.com/bastelfreak)) + ## [v6.2.0](https://github.com/voxpupuli/puppet-python/tree/v6.2.0) (2021-08-26) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.1.0...v6.2.0) diff --git a/metadata.json b/metadata.json index b65cdc34..24fd6ac3 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.2.1-rc0", + "version": "6.2.1", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From f87c9c2963be633394dad44a1a8ed047291f838a Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 10 Dec 2021 11:38:43 +0100 Subject: [PATCH 264/380] [blacksmith] Bump version to 6.2.2-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 24fd6ac3..740f76d8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.2.1", + "version": "6.2.2-rc0", "author": "Vox Pupuli", "summary": "Python Module", "license": "Apache-2.0", From b8c374167ec7013f35e1473699812a9c4c4d751e Mon Sep 17 00:00:00 2001 From: Alex Cullen Date: Tue, 4 Jan 2022 15:55:04 -0500 Subject: [PATCH 265/380] use ensure_package instead of package for python install (test) --- manifests/install.pp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 4645bdcb..dd827e36 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -36,10 +36,15 @@ } if $python::manage_python_package { - package { 'python': - ensure => $python::ensure, - name => $python, - } + ensure_package({ + 'python' => { + ensure => $python::ensure + } + }) + # package { 'python': + # ensure => $python::ensure, + # name => $python, + # } } case $python::provider { From 680bd8c83351e27aa574d11b2c3cb80d3f8338f5 Mon Sep 17 00:00:00 2001 From: Alex Cullen Date: Tue, 4 Jan 2022 16:12:38 -0500 Subject: [PATCH 266/380] revert use ensure_package instead of package for python install (test) --- manifests/install.pp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index dd827e36..4645bdcb 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -36,15 +36,10 @@ } if $python::manage_python_package { - ensure_package({ - 'python' => { - ensure => $python::ensure - } - }) - # package { 'python': - # ensure => $python::ensure, - # name => $python, - # } + package { 'python': + ensure => $python::ensure, + name => $python, + } } case $python::provider { From bba491a573506e4cb58e5a930f2c2dd34e8fd4f4 Mon Sep 17 00:00:00 2001 From: Alex Cullen Date: Tue, 22 Feb 2022 14:06:51 -0500 Subject: [PATCH 267/380] replace all package declarations with ensure_packages() --- manifests/install.pp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 4645bdcb..a3daef14 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -36,26 +36,26 @@ } if $python::manage_python_package { - package { 'python': + ensure_packages (['python'], ensure => $python::ensure, name => $python, - } + ) } case $python::provider { 'pip': { if $python::manage_pip_package { - package { 'pip': + ensure_packages (['pip'], ensure => $pip_ensure, require => Package['python'], - } + ) } if $pythondev { - package { 'python-dev': + ensure_packages (['python-dev'], ensure => $dev_ensure, name => $pythondev, - } + ) } # Respect the $pip_ensure setting @@ -182,28 +182,28 @@ } if $pythondev { - package { 'python-dev': - ensure => $dev_ensure, - name => $pythondev, - alias => $pythondev, + ensure_packages (['python-dev'], + ensure => $dev_ensure, + name => $pythondev, + alias => $pythondev, provider => 'yum', - } + ) } } default: { if $python::manage_pip_package { - package { 'pip': + ensure_packages (['pip'], ensure => $pip_ensure, require => Package['python'], - } + ) } if $pythondev { - package { 'python-dev': + ensure_packages (['python-dev'], ensure => $dev_ensure, name => $pythondev, alias => $pythondev, - } + ) } } } From 4cf8bee172cd82510d2a205280315b64fddd325d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Fr=C3=B6hner?= Date: Mon, 16 Nov 2020 10:48:34 +0100 Subject: [PATCH 268/380] Add python-venv installation --- REFERENCE.md | 49 ++++++++++++++++++++++------- manifests/init.pp | 6 ++++ manifests/install.pp | 57 ++++++++++++++++------------------ manifests/params.pp | 3 +- manifests/pyvenv.pp | 17 +++------- spec/acceptance/class_spec.rb | 1 + spec/acceptance/pyvenv_spec.rb | 5 +++ spec/classes/python_spec.rb | 22 ++++++++++++- spec/defines/pyvenv_spec.rb | 4 +-- types/loglevel.pp | 2 +- types/package/ensure.pp | 2 +- types/provider.pp | 2 +- types/umask.pp | 2 +- types/version.pp | 2 +- 14 files changed, 110 insertions(+), 64 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 6f4bc8aa..3a5caa87 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -27,12 +27,12 @@ ### Data types -* [`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::Loglevel`](#pythonloglevel): Match all valid loglevels for python +* [`Python::Package::Ensure`](#pythonpackageensure): Match all valid package ensures for python +* [`Python::Provider`](#pythonprovider): Match all valid provider for python +* [`Python::Umask`](#pythonumask): Match valid umask for python * [`Python::Venv::PipVersion`](#pythonvenvpipversion): A version type to ensure a specific Pip version in a virtual env. -* [`Python::Version`](#pythonversion): A version type to match all valid versions for python +* [`Python::Version`](#pythonversion): Match all valid versions for python ## Classes @@ -77,8 +77,11 @@ The following parameters are available in the `python` class: * [`use_epel`](#use_epel) * [`manage_scl`](#manage_scl) * [`umask`](#umask) +* [`manage_gunicorn`](#manage_gunicorn) * [`manage_python_package`](#manage_python_package) +* [`manage_venv_package`](#manage_venv_package) * [`manage_pip_package`](#manage_pip_package) +* [`venv`](#venv) * [`gunicorn_package_name`](#gunicorn_package_name) * [`python_pips`](#python_pips) * [`python_pyvenvs`](#python_pyvenvs) @@ -175,22 +178,44 @@ The default umask for invoked exec calls. Default value: ``undef`` +##### `manage_gunicorn` + +manage the state for package gunicorn + +Default value: `$python::params::manage_gunicorn` + ##### `manage_python_package` Data type: `Boolean` - +manage the state for package python Default value: `$python::params::manage_python_package` -##### `manage_pip_package` +##### `manage_venv_package` Data type: `Boolean` +manage the state for package venv +Default value: `$python::params::manage_venv_package` + +##### `manage_pip_package` + +Data type: `Boolean` + +manage the state for package pip Default value: `$python::params::manage_pip_package` +##### `venv` + +Data type: `Python::Package::Ensure` + + + +Default value: `$python::params::venv` + ##### `gunicorn_package_name` Data type: `String[1]` @@ -1112,7 +1137,7 @@ Default value: `1800` ### `Python::Loglevel` -A version type to match all valid loglevels for python +Match all valid loglevels for python Alias of @@ -1122,7 +1147,7 @@ Enum['debug', 'info', 'warning', 'error', 'critical'] ### `Python::Package::Ensure` -A version type to match all valid package ensures for python +Match all valid package ensures for python Alias of @@ -1132,7 +1157,7 @@ Enum['absent', 'present', 'latest'] ### `Python::Provider` -A version type to match all valid provider for python +Match all valid provider for python Alias of @@ -1142,7 +1167,7 @@ Enum['pip', 'scl', 'rhscl', 'anaconda', ''] ### `Python::Umask` -A version type to match valid umask for python +Match valid umask for python Alias of @@ -1162,7 +1187,7 @@ Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/] ### `Python::Version` -A version type to match all valid versions for python +Match all valid versions for python Alias of diff --git a/manifests/init.pp b/manifests/init.pp index 74da7eb6..3c5ed97a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,6 +17,10 @@ # @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. +# @param manage_gunicorn manage the state for package gunicorn +# @param manage_python_package manage the state for package python +# @param manage_venv_package manage the state for package venv +# @param manage_pip_package manage the state for package pip # # @example install python from system python # class { 'python': @@ -37,9 +41,11 @@ Python::Version $version = '3', Python::Package::Ensure $pip = $python::params::pip, Python::Package::Ensure $dev = $python::params::dev, + Python::Package::Ensure $venv = $python::params::venv, Python::Package::Ensure $gunicorn = $python::params::gunicorn, Boolean $manage_gunicorn = $python::params::manage_gunicorn, Boolean $manage_python_package = $python::params::manage_python_package, + Boolean $manage_venv_package = $python::params::manage_venv_package, Boolean $manage_pip_package = $python::params::manage_pip_package, String[1] $gunicorn_package_name = $python::params::gunicorn_package_name, Optional[Python::Provider] $provider = $python::params::provider, diff --git a/manifests/install.pp b/manifests/install.pp index af4a26ff..775edb7e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -23,18 +23,6 @@ 'Suse' => "${python}-devel", } - $pip_ensure = $python::pip ? { - true => 'present', - false => 'absent', - default => $python::pip, - } - - $dev_ensure = $python::dev ? { - true => 'present', - false => 'absent', - default => $python::dev, - } - if $python::manage_python_package { package { 'python': ensure => $python::ensure, @@ -42,24 +30,37 @@ } } + if $python::manage_venv_package { + ## + ## CentOS has no extra package for venv + ## + unless $facts['os']['name'] == 'CentOS' { + package { 'python-venv': + ensure => $python::venv, + name => "${python}-venv", + require => Package['python'], + } + } + } + case $python::provider { 'pip': { if $python::manage_pip_package { package { 'pip': - ensure => $pip_ensure, + ensure => $python::pip, require => Package['python'], } } if $pythondev { package { 'python-dev': - ensure => $dev_ensure, + ensure => $python::dev, name => $pythondev, } } - # Respect the $pip_ensure setting - unless $pip_ensure == 'absent' { + # Respect the $python::pip setting + unless $python::pip == 'absent' { # Install pip without pip, see https://pip.pypa.io/en/stable/installing/. include python::pip::bootstrap @@ -93,16 +94,16 @@ Package['scl-utils'] -> Package["${python}-scldevel"] - if $pip_ensure != 'absent' { + if $python::pip != 'absent' { Package['scl-utils'] -> Exec['python-scl-pip-install'] } } package { "${python}-scldevel": - ensure => $dev_ensure, + ensure => $python::dev, } - if $pip_ensure != 'absent' { + if $python::pip != 'absent' { exec { 'python-scl-pip-install': command => "${python::exec_prefix}easy_install pip", path => ['/usr/bin', '/bin'], @@ -126,17 +127,13 @@ tag => 'python-scl-package', } - Package <| title == 'virtualenv' |> { - name => "${python}-python-virtualenv", - } - package { "${python}-scldevel": - ensure => $dev_ensure, + ensure => $python::dev, tag => 'python-scl-package', } package { "${python}-python-pip": - ensure => $pip_ensure, + ensure => $python::pip, tag => 'python-pip-package', } @@ -174,7 +171,7 @@ } else { if $python::manage_pip_package { package { 'python-pip': - ensure => $pip_ensure, + ensure => $python::pip, require => Package['python'], provider => 'yum', } @@ -183,7 +180,7 @@ if $pythondev { package { 'python-dev': - ensure => $dev_ensure, + ensure => $python::dev, name => $pythondev, alias => $pythondev, provider => 'yum', @@ -193,14 +190,14 @@ default: { if $python::manage_pip_package { package { 'pip': - ensure => $pip_ensure, + ensure => $python::pip, require => Package['python'], } } if $pythondev { package { 'python-dev': - ensure => $dev_ensure, + ensure => $python::dev, name => $pythondev, alias => $pythondev, } @@ -209,7 +206,7 @@ } if $facts['os']['family'] == 'RedHat' { - if $pip_ensure != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { + if $python::pip != 'absent' and $python::use_epel and ($python::manage_pip_package or $python::manage_python_package) { require epel } } diff --git a/manifests/params.pp b/manifests/params.pp index a10e1eb4..6650bfaf 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -13,10 +13,11 @@ $pip = 'present' $dev = 'absent' $virtualenv = 'absent' + $venv = 'absent' $gunicorn = 'absent' $manage_gunicorn = true $manage_python_package = true - $manage_virtualenv_package = true + $manage_venv_package = true $manage_pip_package = true $provider = undef $valid_versions = undef diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index ca710015..bbc05277 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -44,14 +44,6 @@ $python_version_parts = split($python_version, '[.]') $normalized_python_version = sprintf('%s.%s', $python_version_parts[0], $python_version_parts[1]) - # Debian splits the venv module into a seperate package - if ( $facts['os']['family'] == 'Debian') { - $python3_venv_package = "python${normalized_python_version}-venv" - ensure_packages($python3_venv_package) - - Package[$python3_venv_package] -> File[$venv_dir] - } - # pyvenv is deprecated since 3.6 and will be removed in 3.8 if versioncmp($normalized_python_version, '3.6') >=0 { $virtualenv_cmd = "${python::exec_prefix}python${normalized_python_version} -m venv" @@ -71,10 +63,11 @@ } file { $venv_dir: - ensure => directory, - owner => $owner, - group => $group, - mode => $mode, + ensure => directory, + owner => $owner, + group => $group, + mode => $mode, + require => Class['python::install'], } $pip_cmd = "${python::exec_prefix}${venv_dir}/bin/pip" diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index e700abc2..d573a055 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -23,6 +23,7 @@ class { 'python': version => '3', pip => 'present', dev => 'present', + venv => 'present', } EOS diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index b8fb327a..ac778f21 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -10,6 +10,7 @@ class { 'python': version => '3', dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -42,6 +43,7 @@ class { 'python': class { 'python': version => '3', dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -82,6 +84,7 @@ class { 'python': class { 'python': version => '3', dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -119,6 +122,7 @@ class { 'python': class { 'python': version => '3', dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -156,6 +160,7 @@ class { 'python': class { 'python': version => '3', dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index c539d97e..279fffaa 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -17,19 +17,39 @@ it { is_expected.to contain_class('python::config') } it { is_expected.to contain_package('python') } it { is_expected.to contain_package('pip') } + + it { is_expected.to contain_package('python-venv') } unless facts[:os]['name'] == 'CentOS' end context 'without managing things' do let :params do { manage_python_package: false, - manage_pip_package: false + manage_pip_package: false, + manage_venv_package: false } end it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_package('python') } it { is_expected.not_to contain_package('pip') } + it { is_expected.not_to contain_package('python-venv') } + end + + context 'with packages present' do + let :params do + { + manage_pip_package: true, + manage_venv_package: true, + pip: 'present', + venv: 'present' + } + end + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_package('pip').with(ensure: 'present') } + + it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['name'] == 'CentOS' end case facts[:os]['family'] diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 5194c4e2..7bc623b2 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -18,10 +18,8 @@ end context 'with default parameters' do - it { is_expected.to contain_file('/opt/env') } + it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') } it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } - - it { is_expected.to contain_package('python3.5-venv').that_comes_before('File[/opt/env]') } if %w[xenial bionic cosmic disco stretch buster].include?(facts[:lsbdistcodename]) end describe 'when ensure' do diff --git a/types/loglevel.pp b/types/loglevel.pp index 3cdb653d..849c2236 100644 --- a/types/loglevel.pp +++ b/types/loglevel.pp @@ -1,3 +1,3 @@ -# @summary A version type to match all valid loglevels for python +# @summary Match all valid loglevels for python # type Python::Loglevel = Enum['debug', 'info', 'warning', 'error', 'critical'] diff --git a/types/package/ensure.pp b/types/package/ensure.pp index 1eb13b82..34189e4b 100644 --- a/types/package/ensure.pp +++ b/types/package/ensure.pp @@ -1,3 +1,3 @@ -# @summary A version type to match all valid package ensures for python +# @summary Match all valid package ensures for python # type Python::Package::Ensure = Enum['absent', 'present', 'latest'] diff --git a/types/provider.pp b/types/provider.pp index 8c7dfd65..68fd7ff6 100644 --- a/types/provider.pp +++ b/types/provider.pp @@ -1,3 +1,3 @@ -# @summary A version type to match all valid provider for python +# @summary Match all valid provider for python # type Python::Provider = Enum['pip', 'scl', 'rhscl', 'anaconda', ''] diff --git a/types/umask.pp b/types/umask.pp index 11296cd0..39038093 100644 --- a/types/umask.pp +++ b/types/umask.pp @@ -1,3 +1,3 @@ -# @summary A version type to match valid umask for python +# @summary Match valid umask for python # type Python::Umask = Pattern[/[0-7]{1,4}/] diff --git a/types/version.pp b/types/version.pp index e0023aef..5bbcaaa8 100644 --- a/types/version.pp +++ b/types/version.pp @@ -1,4 +1,4 @@ -# @summary A version type to match all valid versions for python +# @summary Match all valid versions for python # type Python::Version = Pattern[ /\A(python)?[0-9](\.?[0-9])*/, From 21e0c4fa3176005bd7726455b51c767ada277e2e Mon Sep 17 00:00:00 2001 From: Vadym Chepkov Date: Mon, 4 Apr 2022 18:51:42 -0400 Subject: [PATCH 269/380] allow puppet/epel v4 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 740f76d8..bdfdb6c5 100644 --- a/metadata.json +++ b/metadata.json @@ -76,7 +76,7 @@ }, { "name": "puppet/epel", - "version_requirement": ">= 3.0.0 < 4.0.0" + "version_requirement": ">= 3.0.0 < 5.0.0" } ] } From a69f7121bf75ec4d9c0748677bc8d1df7be2aad9 Mon Sep 17 00:00:00 2001 From: Vadym Chepkov Date: Mon, 4 Apr 2022 18:48:59 -0400 Subject: [PATCH 270/380] cleanup references to obsolete virtualenv parameter/command --- examples/gunicorn.pp | 5 +-- examples/init.pp | 5 +-- examples/pip.pp | 5 +-- examples/requirements.pp | 5 +-- examples/virtualenv.pp | 13 ------ lib/facter/virtualenv_version.rb | 12 ------ manifests/params.pp | 1 - metadata.json | 4 +- spec/unit/facter/virtualenv_version_spec.rb | 48 --------------------- 9 files changed, 9 insertions(+), 89 deletions(-) delete mode 100644 examples/virtualenv.pp delete mode 100644 lib/facter/virtualenv_version.rb delete mode 100644 spec/unit/facter/virtualenv_version_spec.rb diff --git a/examples/gunicorn.pp b/examples/gunicorn.pp index 9308f000..c83a8224 100644 --- a/examples/gunicorn.pp +++ b/examples/gunicorn.pp @@ -1,7 +1,6 @@ class { 'python': - version => 'system', - dev => true, - virtualenv => true, + version => 'system', + dev => true, } python::gunicorn { 'vhost': diff --git a/examples/init.pp b/examples/init.pp index 4c51cc80..ab934fa9 100644 --- a/examples/init.pp +++ b/examples/init.pp @@ -1,5 +1,4 @@ class { 'python': - version => 'system', - dev => true, - virtualenv => true, + version => 'system', + dev => true, } diff --git a/examples/pip.pp b/examples/pip.pp index f0db1728..a65be945 100644 --- a/examples/pip.pp +++ b/examples/pip.pp @@ -1,7 +1,6 @@ class { 'python': - version => 'system', - dev => true, - virtualenv => true, + version => 'system', + dev => true, } python::pip { 'flask': diff --git a/examples/requirements.pp b/examples/requirements.pp index 90dccd8b..4dcf289e 100644 --- a/examples/requirements.pp +++ b/examples/requirements.pp @@ -1,7 +1,6 @@ class { 'python': - version => 'system', - dev => true, - virtualenv => true, + version => 'system', + dev => true, } python::requirements { '/var/www/project1/requirements.txt': diff --git a/examples/virtualenv.pp b/examples/virtualenv.pp deleted file mode 100644 index da5ab57c..00000000 --- a/examples/virtualenv.pp +++ /dev/null @@ -1,13 +0,0 @@ -class { 'python': - version => 'system', - dev => true, - virtualenv => true, -} - -python::virtualenv { '/var/www/project1': - ensure => present, - version => 'system', - requirements => '/var/www/project1/requirements.txt', - proxy => 'http://proxy.domain.com:3128', - systempkgs => true, -} diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb deleted file mode 100644 index c8bfdab3..00000000 --- a/lib/facter/virtualenv_version.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -# Make virtualenv version available as a fact - -Facter.add('virtualenv_version') do - setcode do - if Facter::Util::Resolution.which('virtualenv') - results = Facter::Util::Resolution.exec('virtualenv --version 2>&1').match(%r{(\d+\.\d+\.?\d*).*$}) - results[1] if results - end - end -end diff --git a/manifests/params.pp b/manifests/params.pp index 6650bfaf..e69d4c43 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -12,7 +12,6 @@ $ensure = 'present' $pip = 'present' $dev = 'absent' - $virtualenv = 'absent' $venv = 'absent' $gunicorn = 'absent' $manage_gunicorn = true diff --git a/metadata.json b/metadata.json index bdfdb6c5..fb6434c7 100644 --- a/metadata.json +++ b/metadata.json @@ -2,16 +2,14 @@ "name": "puppet-python", "version": "6.2.2-rc0", "author": "Vox Pupuli", - "summary": "Python Module", + "summary": "Puppet module for Python", "license": "Apache-2.0", "source": "https://github.com/voxpupuli/puppet-python.git", "project_page": "https://github.com/voxpupuli/puppet-python", "issues_url": "https://github.com/voxpupuli/puppet-python/issues", - "description": "Puppet module for Python", "tags": [ "python", "pip", - "virtualenv", "gunicorn" ], "operatingsystem_support": [ diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb deleted file mode 100644 index a6298c1f..00000000 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Facter::Util::Fact do - before do - Facter.clear - end - - let(:virtualenv_old_version_output) do - <<~EOS - 12.0.7 - EOS - end - - let(:virtualenv_new_version_output) do - <<~EOS - virtualenv 20.0.17 from /opt/python/lib/python3.5/site-packages/virtualenv/__init__.py - EOS - end - - describe 'virtualenv_version old' do - context 'returns virtualenv version when virtualenv present' do - it do - allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(true) - allow(Facter::Util::Resolution).to receive(:exec).with('virtualenv --version 2>&1').and_return(virtualenv_old_version_output) - expect(Facter.value(:virtualenv_version)).to eq('12.0.7') - end - end - - context 'returns nil when virtualenv not present' do - it do - allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(false) - expect(Facter.value(:virtualenv_version)).to eq(nil) - end - end - end - - describe 'virtualenv_version new' do - context 'returns virtualenv version when virtualenv present' do - it do - allow(Facter::Util::Resolution).to receive(:which).with('virtualenv').and_return(true) - allow(Facter::Util::Resolution).to receive(:exec).with('virtualenv --version 2>&1').and_return(virtualenv_new_version_output) - expect(Facter.value(:virtualenv_version)).to eq('20.0.17') - end - end - end -end From bcf6262359f42be935d714632825b547ddb116b5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 18 Jul 2022 13:55:59 +0200 Subject: [PATCH 271/380] Release 6.3.0 --- CHANGELOG.md | 13 +++++++++++++ metadata.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b788395b..7e71ae10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.3.0](https://github.com/voxpupuli/puppet-python/tree/v6.3.0) (2022-07-18) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.2.1...v6.3.0) + +**Implemented enhancements:** + +- allow puppet/epel v4 [\#634](https://github.com/voxpupuli/puppet-python/pull/634) ([vchepkov](https://github.com/vchepkov)) +- cleanup references to obsolete virtualenv parameter/command [\#633](https://github.com/voxpupuli/puppet-python/pull/633) ([vchepkov](https://github.com/vchepkov)) + +**Fixed bugs:** + +- Add python-venv installation [\#579](https://github.com/voxpupuli/puppet-python/pull/579) ([crazymind1337](https://github.com/crazymind1337)) + ## [v6.2.1](https://github.com/voxpupuli/puppet-python/tree/v6.2.1) (2021-12-10) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.2.0...v6.2.1) diff --git a/metadata.json b/metadata.json index fb6434c7..a2eb404a 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.2.2-rc0", + "version": "6.3.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From d22f9c75f736342d71a4de3bec8bcda69cd27be8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 18 Jul 2022 14:02:32 +0200 Subject: [PATCH 272/380] modulesync 5.3.0 --- .github/CONTRIBUTING.md | 7 ++- .github/workflows/ci.yml | 84 +++-------------------------------- .github/workflows/release.yml | 32 +++++-------- .msync.yml | 2 +- Dockerfile | 2 +- Gemfile | 6 +-- 6 files changed, 24 insertions(+), 109 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 048d2b55..8b466cfb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet, you must set an environment variable such as: ```sh -export PUPPET_VERSION="~> 5.5.6" +export PUPPET_GEM_VERSION="~> 6.1.0" ``` You can install all needed gems for spec tests into the modules directory by @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian10-x64 bundle exec rake beaker +BEAKER_setfile=debian11-64 bundle exec rake beaker ``` You can replace the string `debian10` with any common operating system. The following strings are known to work: -* ubuntu1604 * ubuntu1804 * ubuntu2004 -* debian9 * debian10 +* debian11 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d08d05e8..8a077911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,84 +7,12 @@ name: CI on: pull_request concurrency: - group: ${{ github.head_ref }} + group: ${{ github.ref_name }} cancel-in-progress: true jobs: - setup_matrix: - name: 'Setup Test Matrix' - runs-on: ubuntu-latest - timeout-minutes: 40 - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - env: - BUNDLE_WITHOUT: development:system_tests:release - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run static validations - run: bundle exec rake validate lint check - - name: Run rake rubocop - run: bundle exec rake rubocop - - name: Setup Test Matrix - id: get-outputs - run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false - - unit: - needs: setup_matrix - runs-on: ubuntu-latest - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} - env: - BUNDLE_WITHOUT: development:system_tests:release - PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" - name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - run: bundle exec rake parallel_spec - - acceptance: - needs: setup_matrix - runs-on: ubuntu-latest - env: - BUNDLE_WITHOUT: development:test:release - strategy: - fail-fast: false - matrix: - include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}} - name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} - steps: - - uses: actions/checkout@v2 - - name: Setup ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - name: Run tests - run: bundle exec rake beaker - env: - BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} - BEAKER_setfile: ${{ matrix.setfile.value }} - - tests: - needs: - - unit - - acceptance - runs-on: ubuntu-latest - name: Test suite - steps: - - run: echo Test suite completed + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + with: + pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 664ba694..15f17213 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,26 +9,14 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: - deploy: - name: 'deploy to forge' - runs-on: ubuntu-latest - if: github.repository_owner == 'voxpupuli' - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '2.7' - bundler-cache: true - - name: Build and Deploy - env: - # Configure secrets here: - # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' - BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' - run: bundle exec rake module:push + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.msync.yml b/.msync.yml index a83abd9b..02353859 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '5.3.0' diff --git a/Dockerfile b/Dockerfile index e3cf307f..8dd82d63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv -ARG PUPPET_VERSION="~> 6.0" +ARG PUPPET_GEM_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems diff --git a/Gemfile b/Gemfile index b6dcf456..07209b79 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,10 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.0', :require => false + gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 1.0', :require => false @@ -28,7 +28,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From ef2df5b4d72c0159e19b66555018865b816725e4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 18 Jul 2022 14:31:20 +0200 Subject: [PATCH 273/380] [blacksmith] Bump version to 6.3.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a2eb404a..f28c5e31 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.3.0", + "version": "6.3.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 42be1f3e67186420ecd3e65309735725efbedbb9 Mon Sep 17 00:00:00 2001 From: David Byers Date: Tue, 30 Aug 2022 17:15:23 +0200 Subject: [PATCH 274/380] Add extra_index parameter to python::pip Add extra_index parameter to python::pip, corresponding to the pip command line option --extra-index-url, allowing packages to be installed from a local repository while dependencies are pulled from pypi. --- REFERENCE.md | 9 +++++++++ manifests/pip.pp | 12 ++++++++++-- spec/acceptance/pip_spec.rb | 36 ++++++++++++++++++++++++++++++++++++ spec/defines/pip_spec.rb | 24 +++++++++++++++++++----- 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 3a5caa87..c61f0b44 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -685,6 +685,7 @@ The following parameters are available in the `python::pip` defined type: * [`owner`](#owner) * [`group`](#group) * [`index`](#index) +* [`extra_index`](#extra_index) * [`proxy`](#proxy) * [`editable`](#editable) * [`environment`](#environment) @@ -766,6 +767,14 @@ Base URL of Python package index. Default value: ``false`` +##### `extra_index` + +Data type: `Variant[Boolean,String[1]]` + +Base URL of extra Python package index. + +Default value: ``false`` + ##### `proxy` Data type: `Optional[Stdlib::HTTPUrl]` diff --git a/manifests/pip.pp b/manifests/pip.pp index 33c7faa4..a6b92c66 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -9,6 +9,7 @@ # @param owner The owner of the virtualenv being manipulated. # @param group The group of the virtualenv being manipulated. # @param index Base URL of Python package index. +# @param extra_index Base URL of extra Python package index. # @param proxy Proxy server to use for outbound connections. # @param editable If true the package is installed as an editable resource. # @param environment Additional environment variables required to install the packages. @@ -57,6 +58,7 @@ Optional[String[1]] $group = getvar('python::params::group'), Optional[Python::Umask] $umask = undef, Variant[Boolean,String[1]] $index = false, + Variant[Boolean,String[1]] $extra_index = false, Optional[Stdlib::HTTPUrl] $proxy = undef, Any $egg = false, Boolean $editable = false, @@ -114,6 +116,11 @@ default => "--index-url=${index}", } + $pypi_extra_index = $extra_index ? { + false => '', + default => "--extra-index-url=${extra_index}", + } + $proxy_flag = $proxy ? { undef => '', default => "--proxy=${proxy}", @@ -173,7 +180,7 @@ } $pip_install = "${pip_env} --log ${log}/pip.log install" - $pip_common_args = "${pypi_index} ${proxy_flag} ${install_editable} ${source}" + $pip_common_args = "${pypi_index} ${pypi_extra_index} ${proxy_flag} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided if $source =~ /^'(git\+|hg\+|bzr\+|svn\+)(http|https|ssh|svn|sftp|ftp|lp|git)(:\/\/).+'$/ { @@ -204,7 +211,8 @@ # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. $latest_version = join( [ - "${pip_install} ${pypi_index} ${proxy_flag} ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", + "${pip_install} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", + " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', ' | tr -d "[:space:]"', ]) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index a67eeafa..5341d9cd 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -31,6 +31,7 @@ class { 'python': end # rubocop:disable RSpec/RepeatedExampleGroupDescription + # rubocop:disable RSpec/RepeatedExampleGroupBody describe command('/opt/test-venv/bin/pip list') do its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } @@ -74,5 +75,40 @@ class { 'python': its(:exit_status) { is_expected.to eq 0 } its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end + + context 'install package via extra_index' do + it 'works with no errors' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + + python::pip { 'agent package via extra_index': + virtualenv => '/opt/test-venv', + pkgname => 'agent', + index => 'invalid', + extra_index => 'https://pypi.org/simple', + ensure => '0.1.2', + } + PUPPET + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + end + + describe command('/opt/test-venv/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } + end + # rubocop:enable RSpec/RepeatedExampleGroupBody # rubocop:enable RSpec/RepeatedExampleGroupDescription end diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 5124c4ec..52d43e91 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -76,7 +76,7 @@ context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } end end @@ -90,7 +90,21 @@ context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } + end + end + + describe 'extra_index as' do + context 'defaults to empty' do + let(:params) { {} } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_command(%r{--extra-index-url}) } + end + + context 'adds extra_index to install command if extra_index set' do + let(:params) { { extra_index: 'http://www.example.com/extra/simple/' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --extra-index-url=http://www.example.com/extra/simple/ rpyc') } end end @@ -107,7 +121,7 @@ context 'adds install_args to install command if install_args set' do let(:params) { { install_args: '--pre' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') } end end @@ -171,13 +185,13 @@ context 'suceeds with no extras' do let(:params) { {} } - it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests') } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests') } end context 'succeeds with extras' do let(:params) { { extras: ['security'] } } - it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests[security]') } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests[security]') } end end end From bd3f2127d902786c3fd526285d95831cb9f2c290 Mon Sep 17 00:00:00 2001 From: David Byers Date: Thu, 1 Sep 2022 11:29:11 +0200 Subject: [PATCH 275/380] Add prompt parameter to python::pyvenv Add a prompt parameter to python::pyvenv that uses the --prompt command-line argument available in the venv module in Python 3.6 and later, to set the prompt shown when the virtualenv is active. --- REFERENCE.md | 9 +++++++ manifests/pyvenv.pp | 10 +++++++- spec/classes/python_spec.rb | 4 +-- spec/defines/pyvenv_spec.rb | 51 ++++++++++++++++++++++++++++++++++++- 4 files changed, 70 insertions(+), 4 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index c61f0b44..e91a9f41 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -903,6 +903,7 @@ The following parameters are available in the `python::pyvenv` defined type: * [`mode`](#mode) * [`path`](#path) * [`environment`](#environment) +* [`prompt`](#prompt) * [`pip_version`](#pip_version) ##### `ensure` @@ -977,6 +978,14 @@ Optionally specify environment variables for pyvenv Default value: `[]` +##### `prompt` + +Data type: `Variant[Boolean,String[1]]` + +Optionally specify the virtualenv prompt (python >= 3.6) + +Default value: ``false`` + ##### `pip_version` Data type: `Python::Venv::PipVersion` diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index bbc05277..14dcb9fb 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -10,6 +10,7 @@ # @param mode Optionally specify directory mode # @param path Specifies the PATH variable. # @param environment Optionally specify environment variables for pyvenv +# @param prompt Optionally specify the virtualenv prompt (python >= 3.6) # # @example # python::pyvenv { '/var/www/project1' : @@ -31,6 +32,7 @@ Stdlib::Filemode $mode = '0755', Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], Array $environment = [], + Optional[String[1]] $prompt = undef, Python::Venv::PipVersion $pip_version = 'latest', ) { include python @@ -62,6 +64,12 @@ $system_pkgs_flag = '' } + if versioncmp($normalized_python_version, '3.6') >=0 and $prompt { + $prompt_arg = "--prompt ${shell_escape($prompt)}" + } else { + $prompt_arg = '' + } + file { $venv_dir: ensure => directory, owner => $owner, @@ -78,7 +86,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_upgrade} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", + command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${prompt_arg} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_upgrade} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", user => $owner, creates => "${venv_dir}/bin/activate", path => $_path, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 279fffaa..04aef377 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -146,7 +146,7 @@ it { expect(subject).to contain_exec('python_virtualenv_/opt/env1'). with( - command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', + command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', user: 'root', creates: '/opt/env1/bin/activate', path: [ @@ -166,7 +166,7 @@ it { expect(subject).to contain_exec('python_virtualenv_/opt/env2'). with( - command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', + command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', user: 'root', creates: '/opt/env2/bin/activate', path: [ diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 7bc623b2..ba49fb37 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -19,7 +19,7 @@ context 'with default parameters' do it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } end describe 'when ensure' do @@ -36,5 +36,54 @@ end end end + + context "prompt on #{os} with python 3.6" do + let :facts do + # python 3.6 is required for venv and prompt + facts.merge( + python3_version: '3.6.1' + ) + end + let :title do + '/opt/env' + end + + context 'with prompt' do + let :params do + { + prompt: 'custom prompt', + } + end + + it { + is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('python3.6 -m venv --clear --prompt custom\\ prompt /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') + } + end + end + + context "prompt on #{os} with python 3.5" do + let :facts do + facts.merge( + python3_version: '3.5.1' + ) + end + let :title do + '/opt/env' + end + + context 'with prompt' do + let :params do + { + prompt: 'custom prompt', + } + end + + it { + is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') + } + end + end end end From d305819d572335644aa7ad265332301f7096b4ee Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Mon, 25 Jul 2022 14:43:16 +0200 Subject: [PATCH 276/380] use legacy pip resolver for pip versions < 21.1 > 20.2.4 --- manifests/pip.pp | 9 ++++++++- spec/defines/pip_spec.rb | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a6b92c66..488faf11 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -207,11 +207,18 @@ } 'latest': { + $pip_version = $facts['pip_version'] + if $pip_version and versioncmp($pip_version, '21.1') == -1 and versioncmp($pip_version, '20.2.4') == 1 { + $legacy_resolver = '--use-deprecated=legacy-resolver' + } else { + $legacy_resolver = '' + } + # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. $latest_version = join( [ - "${pip_install} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", + "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', ' | tr -d "[:space:]"', diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 52d43e91..d7115427 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -20,7 +20,8 @@ operatingsystem: 'Debian', operatingsystemrelease: '6', path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - concat_basedir: '/dne' + concat_basedir: '/dne', + pip_version: '18.1' } end @@ -126,6 +127,12 @@ end describe 'install latest' do + context 'does not use legacy resolver in unless' do + let(:params) { { ensure: 'latest' } } + + it { is_expected.not_to contain_exec('pip_install_rpyc').with_unless(%r{--use-deprecated=legacy-resolver}) } + end + context 'does not use pip search in unless' do let(:params) { { ensure: 'latest' } } @@ -158,6 +165,35 @@ end end end + + context 'on Debian OS with pip_version 20.3.4' do + let :facts do + { + id: 'root', + kernel: 'Linux', + lsbdistcodename: 'buster', + os: { + family: 'Debian', + release: { major: '10' }, + }, + osfamily: 'Debian', + operatingsystem: 'Debian', + operatingsystemrelease: '10.12', + path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + concat_basedir: '/dne', + pip_version: '20.3.4' + } + end + + describe 'install latest' do + context 'with legacy resolver in unless cmd' do + let(:params) { { ensure: 'latest' } } + + it { is_expected.to compile.with_all_deps } + it { is_expected.to contain_exec('pip_install_rpyc').with_unless(%r{--use-deprecated=legacy-resolver}) } + end + end + end end describe 'python::pip', type: :define do From 54ecdda13152f48d4d4006267c7059cd5ba1e537 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 2 Oct 2022 18:00:12 +0200 Subject: [PATCH 277/380] modulesync 5.3.0 --- Rakefile | 2 +- spec/spec_helper.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index f92f0516..b7f7fe73 100644 --- a/Rakefile +++ b/Rakefile @@ -52,7 +52,7 @@ begin config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'voxpupuli' - config.project = metadata.metadata['name'] + config.project = 'puppet-python' end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4d617f39..6515b7bf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,8 @@ require 'voxpupuli/test/spec_helper' +add_mocked_facts! + if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) facts&.each do |name, value| From a18248f6f0d10d78d40fe02104be450a30508a67 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Tue, 11 Oct 2022 13:07:48 +0200 Subject: [PATCH 278/380] Fix linting complaints --- manifests/pip.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 488faf11..199e7925 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -217,7 +217,7 @@ # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join( [ + $latest_version = join([ "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', @@ -227,7 +227,7 @@ # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') $grep_regex_pkgname_with_dashes = "^${pkgname_with_dashes}==" - $installed_version = join( ["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",]) + $installed_version = join(["${pip_env} freeze --all", " | grep -i -e ${grep_regex_pkgname_with_dashes} | cut -d= -f3", " | tr -d '[:space:]'",]) $command = "${pip_install} --upgrade ${install_args} ${pip_common_args}" $unless_command = "[ \$(${latest_version}) = \$(${installed_version}) ]" From c0829d54953a25c1afc4f566f0fe1d094cf2f708 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 5 Nov 2022 14:19:35 +0100 Subject: [PATCH 279/380] cleanup acceptance tests this module effectivly only supports python 3, which is also the default in the init.pp. we do not need to specify it in the tests. --- spec/acceptance/class_spec.rb | 1 - spec/acceptance/pip_spec.rb | 9 +++------ spec/acceptance/pyvenv_spec.rb | 25 ++++++++++--------------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index d573a055..70c573b0 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -20,7 +20,6 @@ pp = <<-EOS class { 'python': ensure => 'present', - version => '3', pip => 'present', dev => 'present', venv => 'present', diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index 5341d9cd..9da96bef 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -7,8 +7,7 @@ it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', + dev => 'present', } python::pyvenv { '/opt/test-venv': @@ -41,8 +40,7 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', + dev => 'present', } python::pyvenv { '/opt/test-venv': @@ -80,8 +78,7 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', + dev => 'present', } python::pyvenv { '/opt/test-venv': diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index ac778f21..318c2f73 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -8,9 +8,8 @@ it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', - venv => 'present', + dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -41,9 +40,8 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', - venv => 'present', + dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -82,9 +80,8 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', - venv => 'present', + dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -120,9 +117,8 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', - venv => 'present', + dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', @@ -158,9 +154,8 @@ class { 'python': it 'works with no errors' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', - venv => 'present', + dev => 'present', + venv => 'present', } user { 'agent': ensure => 'present', From b78b4c97fb89db765ca54fad2a084645f597b11e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 27 Sep 2022 13:06:06 +0200 Subject: [PATCH 280/380] Implement Arch Linux support --- manifests/init.pp | 2 +- manifests/install.pp | 13 +++++++------ manifests/params.pp | 13 ++++++++++--- metadata.json | 3 +++ spec/classes/python_spec.rb | 13 +++++++++++-- spec/defines/requirements_spec.rb | 9 +++++++-- 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3c5ed97a..7326fd27 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -38,7 +38,7 @@ # class python ( Python::Package::Ensure $ensure = $python::params::ensure, - Python::Version $version = '3', + Python::Version $version = $facts['os']['family'] ? { 'Archlinux' => 'system', default => '3' }, Python::Package::Ensure $pip = $python::params::pip, Python::Package::Ensure $dev = $python::params::dev, Python::Package::Ensure $venv = $python::params::venv, diff --git a/manifests/install.pp b/manifests/install.pp index 775edb7e..08227b32 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,12 +15,13 @@ } $pythondev = $facts['os']['family'] ? { - 'AIX' => "${python}-devel", - 'Debian' => "${python}-dev", - 'FreeBSD' => undef, - 'Gentoo' => undef, - 'RedHat' => "${python}-devel", - 'Suse' => "${python}-devel", + 'AIX' => "${python}-devel", + 'Debian' => "${python}-dev", + 'FreeBSD' => undef, + 'Gentoo' => undef, + 'Archlinux' => undef, + 'RedHat' => "${python}-devel", + 'Suse' => "${python}-devel", } if $python::manage_python_package { diff --git a/manifests/params.pp b/manifests/params.pp index e69d4c43..b8a78d62 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -5,7 +5,7 @@ # class python::params { # Module compatibility check - unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse'] { + unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse', 'Archlinux'] { fail("Module is not compatible with ${facts['os']['name']}") } @@ -16,8 +16,6 @@ $gunicorn = 'absent' $manage_gunicorn = true $manage_python_package = true - $manage_venv_package = true - $manage_pip_package = true $provider = undef $valid_versions = undef $manage_scl = true @@ -48,4 +46,13 @@ }, default => 'gunicorn', } + + $manage_pip_package = $facts['os']['family'] ? { + 'Archlinux' => false, + default => true, + } + $manage_venv_package = $facts['os']['family'] ? { + 'Archlinux' => false, + default => true, + } } diff --git a/metadata.json b/metadata.json index f28c5e31..2976f1b4 100644 --- a/metadata.json +++ b/metadata.json @@ -59,6 +59,9 @@ "operatingsystemrelease": [ "11.3" ] + }, + { + "operatingsystem": "Archlinux" } ], "requirements": [ diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 04aef377..9c6569ba 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -16,9 +16,18 @@ it { is_expected.to contain_class('python::params') } it { is_expected.to contain_class('python::config') } it { is_expected.to contain_package('python') } - it { is_expected.to contain_package('pip') } - it { is_expected.to contain_package('python-venv') } unless facts[:os]['name'] == 'CentOS' + if facts[:os]['family'] == 'Archlinux' + it { is_expected.not_to contain_package('pip') } + else + it { is_expected.to contain_package('pip') } + end + + if %w[Archlinux CentOS].include?(facts[:os]['name']) + it { is_expected.not_to contain_package('python-venv') } + else + it { is_expected.to contain_package('python-venv') } + end end context 'without managing things' do diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 19f6832e..1b9a75fb 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -50,12 +50,17 @@ 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') } + + if facts[:os]['family'] == 'Archlinux' + it { is_expected.not_to contain_package('pip') } + else + it { is_expected.to contain_package('pip') } + end it { is_expected.to contain_package('python') } it { is_expected.to contain_package('gunicorn') } it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } - if %w[FreeBSD Gentoo].include?(facts[:os]['name']) + if %w[Archlinux FreeBSD Gentoo].include?(facts[:os]['name']) it { is_expected.not_to contain_package('python-dev') } else it { is_expected.to contain_package('python-dev') } From 80adc6303fbef15e624eb9b4e2698435f9761b21 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 5 Nov 2022 14:47:35 +0100 Subject: [PATCH 281/380] move static data from params.pp to init.pp --- manifests/init.pp | 24 ++++++++++++------------ manifests/params.pp | 14 -------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7326fd27..5b3c9fdf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -37,27 +37,27 @@ # } # class python ( - Python::Package::Ensure $ensure = $python::params::ensure, + Python::Package::Ensure $ensure = 'present', Python::Version $version = $facts['os']['family'] ? { 'Archlinux' => 'system', default => '3' }, - Python::Package::Ensure $pip = $python::params::pip, - Python::Package::Ensure $dev = $python::params::dev, - Python::Package::Ensure $venv = $python::params::venv, - Python::Package::Ensure $gunicorn = $python::params::gunicorn, - Boolean $manage_gunicorn = $python::params::manage_gunicorn, - Boolean $manage_python_package = $python::params::manage_python_package, + Python::Package::Ensure $pip = 'present', + Python::Package::Ensure $dev = 'absent', + Python::Package::Ensure $venv = 'absent', + Python::Package::Ensure $gunicorn = 'absent', + Boolean $manage_gunicorn = true, + Boolean $manage_python_package = true, Boolean $manage_venv_package = $python::params::manage_venv_package, Boolean $manage_pip_package = $python::params::manage_pip_package, String[1] $gunicorn_package_name = $python::params::gunicorn_package_name, - Optional[Python::Provider] $provider = $python::params::provider, + Optional[Python::Provider] $provider = undef, Hash $python_pips = {}, Hash $python_pyvenvs = {}, Hash $python_requirements = {}, Hash $python_dotfiles = {}, Boolean $use_epel = $python::params::use_epel, - Boolean $rhscl_use_public_repository = $python::params::rhscl_use_public_repository, - 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, + Boolean $rhscl_use_public_repository = true, + Stdlib::Httpurl $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh', + Stdlib::Absolutepath $anaconda_install_path = '/opt/python', + Boolean $manage_scl = true, Optional[Python::Umask] $umask = undef, ) inherits python::params { $exec_prefix = $provider ? { diff --git a/manifests/params.pp b/manifests/params.pp index b8a78d62..e498ddaf 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -9,20 +9,6 @@ fail("Module is not compatible with ${facts['os']['name']}") } - $ensure = 'present' - $pip = 'present' - $dev = 'absent' - $venv = 'absent' - $gunicorn = 'absent' - $manage_gunicorn = true - $manage_python_package = true - $provider = undef - $valid_versions = undef - $manage_scl = true - $rhscl_use_public_repository = true - $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh' - $anaconda_install_path = '/opt/python' - if $facts['os']['family'] == 'RedHat' and $facts['os']['name'] != 'Fedora' { $use_epel = true } else { From dad309c343a9b7ff1d8108a1ef5524fd3c1fbb57 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Tue, 11 Oct 2022 12:58:47 +0200 Subject: [PATCH 282/380] Release 6.4.0 --- CHANGELOG.md | 18 +- REFERENCE.md | 586 ++++++++++++++++++++++++-------------------------- metadata.json | 2 +- 3 files changed, 299 insertions(+), 307 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e71ae10..32782619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v6.4.0](https://github.com/voxpupuli/puppet-python/tree/v6.4.0) (2022-11-06) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.3.0...v6.4.0) + +**Implemented enhancements:** + +- move static data from params.pp to init.pp [\#648](https://github.com/voxpupuli/puppet-python/pull/648) ([bastelfreak](https://github.com/bastelfreak)) +- cleanup acceptance tests [\#647](https://github.com/voxpupuli/puppet-python/pull/647) ([bastelfreak](https://github.com/bastelfreak)) +- Implement Arch Linux support [\#642](https://github.com/voxpupuli/puppet-python/pull/642) ([bastelfreak](https://github.com/bastelfreak)) +- Add prompt parameter to python::pyvenv [\#641](https://github.com/voxpupuli/puppet-python/pull/641) ([ookisan](https://github.com/ookisan)) +- Add extra\_index parameter to python::pip [\#640](https://github.com/voxpupuli/puppet-python/pull/640) ([ookisan](https://github.com/ookisan)) + +**Fixed bugs:** + +- use legacy pip resolver for pip versions \< 21.1 \> 20.2.4 [\#639](https://github.com/voxpupuli/puppet-python/pull/639) ([saz](https://github.com/saz)) + ## [v6.3.0](https://github.com/voxpupuli/puppet-python/tree/v6.3.0) (2022-07-18) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.2.1...v6.3.0) @@ -362,7 +378,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge - Fix Python version regex in install.pp [\#410](https://github.com/voxpupuli/puppet-python/pull/410) ([fklajn](https://github.com/fklajn)) - Remove docker nodesets [\#408](https://github.com/voxpupuli/puppet-python/pull/408) ([bastelfreak](https://github.com/bastelfreak)) -- Update README compatibility section [\#405](https://github.com/voxpupuli/puppet-python/pull/405) ([rkcpi](https://github.com/rkcpi)) +- Update README compatibility section [\#405](https://github.com/voxpupuli/puppet-python/pull/405) ([sandra-thieme](https://github.com/sandra-thieme)) - add secret for forge deployment via travis [\#404](https://github.com/voxpupuli/puppet-python/pull/404) ([bastelfreak](https://github.com/bastelfreak)) - Add deprecation notice for the old repository [\#403](https://github.com/voxpupuli/puppet-python/pull/403) ([stankevich](https://github.com/stankevich)) - virtualenv.pp: make creation of $venv\_dir optional [\#391](https://github.com/voxpupuli/puppet-python/pull/391) ([daylicron](https://github.com/daylicron)) diff --git a/REFERENCE.md b/REFERENCE.md index e91a9f41..2aac08b3 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -9,7 +9,7 @@ #### Public Classes * [`python`](#python): Installs and manages python, python-dev and gunicorn. -* [`python::pip::bootstrap`](#pythonpipbootstrap): allow to bootstrap pip when python is managed from other module +* [`python::pip::bootstrap`](#python--pip--bootstrap): allow to bootstrap pip when python is managed from other module #### Private Classes @@ -19,20 +19,20 @@ ### Defined types -* [`python::dotfile`](#pythondotfile): Manages any python dotfiles with a simple config hash. -* [`python::gunicorn`](#pythongunicorn): Manages Gunicorn virtual hosts. -* [`python::pip`](#pythonpip): Installs and manages packages from pip. -* [`python::pyvenv`](#pythonpyvenv): Create a Python3 virtualenv using pyvenv. -* [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file. +* [`python::dotfile`](#python--dotfile): Manages any python dotfiles with a simple config hash. +* [`python::gunicorn`](#python--gunicorn): Manages Gunicorn virtual hosts. +* [`python::pip`](#python--pip): Installs and manages packages from pip. +* [`python::pyvenv`](#python--pyvenv): Create a Python3 virtualenv using pyvenv. +* [`python::requirements`](#python--requirements): Installs and manages Python packages from requirements file. ### Data types -* [`Python::Loglevel`](#pythonloglevel): Match all valid loglevels for python -* [`Python::Package::Ensure`](#pythonpackageensure): Match all valid package ensures for python -* [`Python::Provider`](#pythonprovider): Match all valid provider for python -* [`Python::Umask`](#pythonumask): Match valid umask for python -* [`Python::Venv::PipVersion`](#pythonvenvpipversion): A version type to ensure a specific Pip version in a virtual env. -* [`Python::Version`](#pythonversion): Match all valid versions for python +* [`Python::Loglevel`](#Python--Loglevel): Match all valid loglevels for python +* [`Python::Package::Ensure`](#Python--Package--Ensure): Match all valid package ensures for python +* [`Python::Provider`](#Python--Provider): Match all valid provider for python +* [`Python::Umask`](#Python--Umask): Match valid umask for python +* [`Python::Venv::PipVersion`](#Python--Venv--PipVersion): A version type to ensure a specific Pip version in a virtual env. +* [`Python::Version`](#Python--Version): Match all valid versions for python ## Classes @@ -67,39 +67,39 @@ class { 'python' : The following parameters are available in the `python` class: -* [`ensure`](#ensure) -* [`version`](#version) -* [`pip`](#pip) -* [`dev`](#dev) -* [`gunicorn`](#gunicorn) -* [`manage_gunicorn`](#manage_gunicorn) -* [`provider`](#provider) -* [`use_epel`](#use_epel) -* [`manage_scl`](#manage_scl) -* [`umask`](#umask) -* [`manage_gunicorn`](#manage_gunicorn) -* [`manage_python_package`](#manage_python_package) -* [`manage_venv_package`](#manage_venv_package) -* [`manage_pip_package`](#manage_pip_package) -* [`venv`](#venv) -* [`gunicorn_package_name`](#gunicorn_package_name) -* [`python_pips`](#python_pips) -* [`python_pyvenvs`](#python_pyvenvs) -* [`python_requirements`](#python_requirements) -* [`python_dotfiles`](#python_dotfiles) -* [`rhscl_use_public_repository`](#rhscl_use_public_repository) -* [`anaconda_installer_url`](#anaconda_installer_url) -* [`anaconda_install_path`](#anaconda_install_path) - -##### `ensure` +* [`ensure`](#-python--ensure) +* [`version`](#-python--version) +* [`pip`](#-python--pip) +* [`dev`](#-python--dev) +* [`gunicorn`](#-python--gunicorn) +* [`manage_gunicorn`](#-python--manage_gunicorn) +* [`provider`](#-python--provider) +* [`use_epel`](#-python--use_epel) +* [`manage_scl`](#-python--manage_scl) +* [`umask`](#-python--umask) +* [`manage_gunicorn`](#-python--manage_gunicorn) +* [`manage_python_package`](#-python--manage_python_package) +* [`manage_venv_package`](#-python--manage_venv_package) +* [`manage_pip_package`](#-python--manage_pip_package) +* [`venv`](#-python--venv) +* [`gunicorn_package_name`](#-python--gunicorn_package_name) +* [`python_pips`](#-python--python_pips) +* [`python_pyvenvs`](#-python--python_pyvenvs) +* [`python_requirements`](#-python--python_requirements) +* [`python_dotfiles`](#-python--python_dotfiles) +* [`rhscl_use_public_repository`](#-python--rhscl_use_public_repository) +* [`anaconda_installer_url`](#-python--anaconda_installer_url) +* [`anaconda_install_path`](#-python--anaconda_install_path) + +##### `ensure` Data type: `Python::Package::Ensure` Desired installation state for the Python package. -Default value: `$python::params::ensure` +Default value: `'present'` -##### `version` +##### `version` Data type: `Python::Version` @@ -112,49 +112,49 @@ Allowed values: - 3/3.3/... means you are going to install the python3/python3.3/... package, if available on your osfamily. -Default value: `'3'` +Default value: `$facts['os']['family'] ? { 'Archlinux' => 'system', default => '3'` -##### `pip` +##### `pip` Data type: `Python::Package::Ensure` Desired installation state for the python-pip package. -Default value: `$python::params::pip` +Default value: `'present'` -##### `dev` +##### `dev` Data type: `Python::Package::Ensure` Desired installation state for the python-dev package. -Default value: `$python::params::dev` +Default value: `'absent'` -##### `gunicorn` +##### `gunicorn` Data type: `Python::Package::Ensure` Desired installation state for Gunicorn. -Default value: `$python::params::gunicorn` +Default value: `'absent'` -##### `manage_gunicorn` +##### `manage_gunicorn` Data type: `Boolean` Allow Installation / Removal of Gunicorn. -Default value: `$python::params::manage_gunicorn` +Default value: `true` -##### `provider` +##### `provider` Data type: `Optional[Python::Provider]` What provider to use for installation of the packages, except gunicorn and Python itself. -Default value: `$python::params::provider` +Default value: `undef` -##### `use_epel` +##### `use_epel` Data type: `Boolean` @@ -162,37 +162,37 @@ to determine if the epel class is used. Default value: `$python::params::use_epel` -##### `manage_scl` +##### `manage_scl` Data type: `Boolean` Whether to manage core SCL packages or not. -Default value: `$python::params::manage_scl` +Default value: `true` -##### `umask` +##### `umask` Data type: `Optional[Python::Umask]` The default umask for invoked exec calls. -Default value: ``undef`` +Default value: `undef` -##### `manage_gunicorn` +##### `manage_gunicorn` manage the state for package gunicorn -Default value: `$python::params::manage_gunicorn` +Default value: `true` -##### `manage_python_package` +##### `manage_python_package` Data type: `Boolean` manage the state for package python -Default value: `$python::params::manage_python_package` +Default value: `true` -##### `manage_venv_package` +##### `manage_venv_package` Data type: `Boolean` @@ -200,7 +200,7 @@ manage the state for package venv Default value: `$python::params::manage_venv_package` -##### `manage_pip_package` +##### `manage_pip_package` Data type: `Boolean` @@ -208,15 +208,15 @@ manage the state for package pip Default value: `$python::params::manage_pip_package` -##### `venv` +##### `venv` Data type: `Python::Package::Ensure` -Default value: `$python::params::venv` +Default value: `'absent'` -##### `gunicorn_package_name` +##### `gunicorn_package_name` Data type: `String[1]` @@ -224,7 +224,7 @@ Data type: `String[1]` Default value: `$python::params::gunicorn_package_name` -##### `python_pips` +##### `python_pips` Data type: `Hash` @@ -232,7 +232,7 @@ Data type: `Hash` Default value: `{}` -##### `python_pyvenvs` +##### `python_pyvenvs` Data type: `Hash` @@ -240,7 +240,7 @@ Data type: `Hash` Default value: `{}` -##### `python_requirements` +##### `python_requirements` Data type: `Hash` @@ -248,7 +248,7 @@ Data type: `Hash` Default value: `{}` -##### `python_dotfiles` +##### `python_dotfiles` Data type: `Hash` @@ -256,31 +256,31 @@ Data type: `Hash` Default value: `{}` -##### `rhscl_use_public_repository` +##### `rhscl_use_public_repository` Data type: `Boolean` -Default value: `$python::params::rhscl_use_public_repository` +Default value: `true` -##### `anaconda_installer_url` +##### `anaconda_installer_url` Data type: `Stdlib::Httpurl` -Default value: `$python::params::anaconda_installer_url` +Default value: `'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh'` -##### `anaconda_install_path` +##### `anaconda_install_path` Data type: `Stdlib::Absolutepath` -Default value: `$python::params::anaconda_install_path` +Default value: `'/opt/python'` -### `python::pip::bootstrap` +### `python::pip::bootstrap` allow to bootstrap pip when python is managed from other module @@ -298,12 +298,12 @@ class { 'python::pip::bootstrap': The following parameters are available in the `python::pip::bootstrap` class: -* [`version`](#version) -* [`manage_python`](#manage_python) -* [`http_proxy`](#http_proxy) -* [`exec_provider`](#exec_provider) +* [`version`](#-python--pip--bootstrap--version) +* [`manage_python`](#-python--pip--bootstrap--manage_python) +* [`http_proxy`](#-python--pip--bootstrap--http_proxy) +* [`exec_provider`](#-python--pip--bootstrap--exec_provider) -##### `version` +##### `version` Data type: `Enum['pip', 'pip3']` @@ -311,23 +311,23 @@ should be pip or pip3 Default value: `'pip'` -##### `manage_python` +##### `manage_python` Data type: `Variant[Boolean, String]` if python module will manage deps -Default value: ``false`` +Default value: `false` -##### `http_proxy` +##### `http_proxy` Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: ``undef`` +Default value: `undef` -##### `exec_provider` +##### `exec_provider` Data type: `String[1]` @@ -337,7 +337,7 @@ Default value: `'shell'` ## Defined types -### `python::dotfile` +### `python::dotfile` Manages any python dotfiles with a simple config hash. @@ -363,14 +363,14 @@ python::dotfile { '/var/lib/jenkins/.pip/pip.conf': The following parameters are available in the `python::dotfile` defined type: -* [`ensure`](#ensure) -* [`filename`](#filename) -* [`mode`](#mode) -* [`owner`](#owner) -* [`group`](#group) -* [`config`](#config) +* [`ensure`](#-python--dotfile--ensure) +* [`filename`](#-python--dotfile--filename) +* [`mode`](#-python--dotfile--mode) +* [`owner`](#-python--dotfile--owner) +* [`group`](#-python--dotfile--group) +* [`config`](#-python--dotfile--config) -##### `ensure` +##### `ensure` Data type: `Enum['absent', 'present']` @@ -378,7 +378,7 @@ Data type: `Enum['absent', 'present']` Default value: `'present'` -##### `filename` +##### `filename` Data type: `Stdlib::Absolutepath` @@ -386,7 +386,7 @@ Filename. Default value: `$title` -##### `mode` +##### `mode` Data type: `Stdlib::Filemode` @@ -394,7 +394,7 @@ File mode. Default value: `'0644'` -##### `owner` +##### `owner` Data type: `String[1]` @@ -402,7 +402,7 @@ user owner of dotfile Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -410,7 +410,7 @@ group owner of dotfile Default value: `'root'` -##### `config` +##### `config` Data type: `Hash` @@ -418,7 +418,7 @@ Config hash. This will be expanded to an ini-file. Default value: `{}` -### `python::gunicorn` +### `python::gunicorn` Manages Gunicorn virtual hosts. @@ -447,28 +447,28 @@ python::gunicorn { 'vhost': The following parameters are available in the `python::gunicorn` defined type: -* [`ensure`](#ensure) -* [`config_dir`](#config_dir) -* [`manage_config_dir`](#manage_config_dir) -* [`virtualenv`](#virtualenv) -* [`mode`](#mode) -* [`dir`](#dir) -* [`bind`](#bind) -* [`environment`](#environment) -* [`appmodule`](#appmodule) -* [`osenv`](#osenv) -* [`timeout`](#timeout) -* [`template`](#template) -* [`args`](#args) -* [`owner`](#owner) -* [`group`](#group) -* [`workers`](#workers) -* [`access_log_format`](#access_log_format) -* [`accesslog`](#accesslog) -* [`errorlog`](#errorlog) -* [`log_level`](#log_level) - -##### `ensure` +* [`ensure`](#-python--gunicorn--ensure) +* [`config_dir`](#-python--gunicorn--config_dir) +* [`manage_config_dir`](#-python--gunicorn--manage_config_dir) +* [`virtualenv`](#-python--gunicorn--virtualenv) +* [`mode`](#-python--gunicorn--mode) +* [`dir`](#-python--gunicorn--dir) +* [`bind`](#-python--gunicorn--bind) +* [`environment`](#-python--gunicorn--environment) +* [`appmodule`](#-python--gunicorn--appmodule) +* [`osenv`](#-python--gunicorn--osenv) +* [`timeout`](#-python--gunicorn--timeout) +* [`template`](#-python--gunicorn--template) +* [`args`](#-python--gunicorn--args) +* [`owner`](#-python--gunicorn--owner) +* [`group`](#-python--gunicorn--group) +* [`workers`](#-python--gunicorn--workers) +* [`access_log_format`](#-python--gunicorn--access_log_format) +* [`accesslog`](#-python--gunicorn--accesslog) +* [`errorlog`](#-python--gunicorn--errorlog) +* [`log_level`](#-python--gunicorn--log_level) + +##### `ensure` Data type: `Enum['present', 'absent']` @@ -476,7 +476,7 @@ Data type: `Enum['present', 'absent']` Default value: `present` -##### `config_dir` +##### `config_dir` Data type: `Stdlib::Absolutepath` @@ -484,23 +484,23 @@ Configure the gunicorn config directory path. Default value: `'/etc/gunicorn.d'` -##### `manage_config_dir` +##### `manage_config_dir` Data type: `Boolean` Set if the gunicorn config directory should be created. -Default value: ``false`` +Default value: `false` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Boolean,Stdlib::Absolutepath]` Run in virtualenv, specify directory. -Default value: ``false`` +Default value: `false` -##### `mode` +##### `mode` Data type: `Enum['wsgi', 'django']` @@ -508,13 +508,13 @@ Gunicorn mode. Default value: `'wsgi'` -##### `dir` +##### `dir` Data type: `Stdlib::Absolutepath` Application directory. -##### `bind` +##### `bind` Data type: `Variant[String[1],Boolean]` @@ -522,17 +522,17 @@ Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: system-wide: unix:/tmp/gunicorn-$name.socket virtualenv: unix:${virtualenv}/${name}.socket -Default value: ``false`` +Default value: `false` -##### `environment` +##### `environment` Data type: `Variant[String[1],Boolean]` Set ENVIRONMENT variable. -Default value: ``false`` +Default value: `false` -##### `appmodule` +##### `appmodule` Data type: `String[1]` @@ -540,15 +540,15 @@ Set the application module name for gunicorn to load when not using Django. Default value: `'app:app'` -##### `osenv` +##### `osenv` Data type: `Variant[Boolean,Hash]` Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. -Default value: ``false`` +Default value: `false` -##### `timeout` +##### `timeout` Data type: `Integer` @@ -556,7 +556,7 @@ Allows setting the gunicorn idle worker process time before being killed. The un Default value: `30` -##### `template` +##### `template` Data type: `String[1]` @@ -564,7 +564,7 @@ Which ERB template to use. Default value: `'python/gunicorn.erb'` -##### `args` +##### `args` Data type: `Array` @@ -572,7 +572,7 @@ Custom arguments to add in gunicorn config file. Default value: `[]` -##### `owner` +##### `owner` Data type: `String[1]` @@ -580,7 +580,7 @@ Data type: `String[1]` Default value: `'www-data'` -##### `group` +##### `group` Data type: `String[1]` @@ -588,39 +588,39 @@ Data type: `String[1]` Default value: `'www-data'` -##### `workers` +##### `workers` Data type: `Variant[Boolean,Integer]` -Default value: ``false`` +Default value: `false` -##### `access_log_format` +##### `access_log_format` Data type: `Variant[Boolean,String[1]]` -Default value: ``false`` +Default value: `false` -##### `accesslog` +##### `accesslog` Data type: `Variant[Boolean,Stdlib::Absolutepath]` -Default value: ``false`` +Default value: `false` -##### `errorlog` +##### `errorlog` Data type: `Variant[Boolean,Stdlib::Absolutepath]` -Default value: ``false`` +Default value: `false` -##### `log_level` +##### `log_level` Data type: `Python::Loglevel` @@ -628,7 +628,7 @@ Data type: `Python::Loglevel` Default value: `'error'` -### `python::pip` +### `python::pip` Installs and manages packages from pip. @@ -676,34 +676,34 @@ python::pip { 'requests' : The following parameters are available in the `python::pip` defined type: -* [`name`](#name) -* [`pkgname`](#pkgname) -* [`ensure`](#ensure) -* [`virtualenv`](#virtualenv) -* [`pip_provider`](#pip_provider) -* [`url`](#url) -* [`owner`](#owner) -* [`group`](#group) -* [`index`](#index) -* [`extra_index`](#extra_index) -* [`proxy`](#proxy) -* [`editable`](#editable) -* [`environment`](#environment) -* [`extras`](#extras) -* [`timeout`](#timeout) -* [`install_args`](#install_args) -* [`uninstall_args`](#uninstall_args) -* [`log_dir`](#log_dir) -* [`egg`](#egg) -* [`umask`](#umask) -* [`path`](#path) -* [`exec_provider`](#exec_provider) - -##### `name` +* [`name`](#-python--pip--name) +* [`pkgname`](#-python--pip--pkgname) +* [`ensure`](#-python--pip--ensure) +* [`virtualenv`](#-python--pip--virtualenv) +* [`pip_provider`](#-python--pip--pip_provider) +* [`url`](#-python--pip--url) +* [`owner`](#-python--pip--owner) +* [`group`](#-python--pip--group) +* [`index`](#-python--pip--index) +* [`extra_index`](#-python--pip--extra_index) +* [`proxy`](#-python--pip--proxy) +* [`editable`](#-python--pip--editable) +* [`environment`](#-python--pip--environment) +* [`extras`](#-python--pip--extras) +* [`timeout`](#-python--pip--timeout) +* [`install_args`](#-python--pip--install_args) +* [`uninstall_args`](#-python--pip--uninstall_args) +* [`log_dir`](#-python--pip--log_dir) +* [`egg`](#-python--pip--egg) +* [`umask`](#-python--pip--umask) +* [`path`](#-python--pip--path) +* [`exec_provider`](#-python--pip--exec_provider) + +##### `name` must be unique -##### `pkgname` +##### `pkgname` Data type: `String[1]` @@ -711,7 +711,7 @@ the name of the package. Default value: `$name` -##### `ensure` +##### `ensure` Data type: `Variant[Enum[present, absent, latest], String[1]]` @@ -719,7 +719,7 @@ Require pip to be available. Default value: `present` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Enum['system'], Stdlib::Absolutepath]` @@ -727,7 +727,7 @@ virtualenv to run pip in. Default value: `'system'` -##### `pip_provider` +##### `pip_provider` Data type: `String[1]` @@ -735,15 +735,15 @@ version of pip you wish to use. Default value: `'pip'` -##### `url` +##### `url` Data type: `Variant[Boolean, String]` URL to install from. -Default value: ``false`` +Default value: `false` -##### `owner` +##### `owner` Data type: `String[1]` @@ -751,7 +751,7 @@ The owner of the virtualenv being manipulated. Default value: `'root'` -##### `group` +##### `group` Data type: `Optional[String[1]]` @@ -759,39 +759,39 @@ The group of the virtualenv being manipulated. Default value: `getvar('python::params::group')` -##### `index` +##### `index` Data type: `Variant[Boolean,String[1]]` Base URL of Python package index. -Default value: ``false`` +Default value: `false` -##### `extra_index` +##### `extra_index` Data type: `Variant[Boolean,String[1]]` Base URL of extra Python package index. -Default value: ``false`` +Default value: `false` -##### `proxy` +##### `proxy` Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: ``undef`` +Default value: `undef` -##### `editable` +##### `editable` Data type: `Boolean` If true the package is installed as an editable resource. -Default value: ``false`` +Default value: `false` -##### `environment` +##### `environment` Data type: `Array` @@ -799,7 +799,7 @@ Additional environment variables required to install the packages. Default value: `[]` -##### `extras` +##### `extras` Data type: `Array` @@ -807,7 +807,7 @@ Extra features provided by the package which should be installed. Default value: `[]` -##### `timeout` +##### `timeout` Data type: `Numeric` @@ -815,23 +815,23 @@ The maximum time in seconds the "pip install" command should take. Default value: `1800` -##### `install_args` +##### `install_args` Data type: `Optional[String[1]]` Any additional installation arguments that will be supplied when running pip install. -Default value: ``undef`` +Default value: `undef` -##### `uninstall_args` +##### `uninstall_args` Data type: `Optional[String[1]]` Any additional arguments that will be supplied when running pip uninstall. -Default value: ``undef`` +Default value: `undef` -##### `log_dir` +##### `log_dir` Data type: `String[1]` @@ -839,23 +839,23 @@ Log directory Default value: `'/tmp'` -##### `egg` +##### `egg` Data type: `Any` The egg name to use -Default value: ``false`` +Default value: `false` -##### `umask` +##### `umask` Data type: `Optional[Python::Umask]` -Default value: ``undef`` +Default value: `undef` -##### `path` +##### `path` Data type: `Array[String]` @@ -863,7 +863,7 @@ Data type: `Array[String]` Default value: `['/usr/local/bin','/usr/bin','/bin', '/usr/sbin']` -##### `exec_provider` +##### `exec_provider` Data type: `String[1]` @@ -871,7 +871,7 @@ Data type: `String[1]` Default value: `'shell'` -### `python::pyvenv` +### `python::pyvenv` Create a Python3 virtualenv using pyvenv. @@ -894,19 +894,19 @@ python::pyvenv { '/var/www/project1' : The following parameters are available in the `python::pyvenv` defined type: -* [`ensure`](#ensure) -* [`version`](#version) -* [`systempkgs`](#systempkgs) -* [`venv_dir`](#venv_dir) -* [`owner`](#owner) -* [`group`](#group) -* [`mode`](#mode) -* [`path`](#path) -* [`environment`](#environment) -* [`prompt`](#prompt) -* [`pip_version`](#pip_version) +* [`ensure`](#-python--pyvenv--ensure) +* [`version`](#-python--pyvenv--version) +* [`systempkgs`](#-python--pyvenv--systempkgs) +* [`venv_dir`](#-python--pyvenv--venv_dir) +* [`owner`](#-python--pyvenv--owner) +* [`group`](#-python--pyvenv--group) +* [`mode`](#-python--pyvenv--mode) +* [`path`](#-python--pyvenv--path) +* [`environment`](#-python--pyvenv--environment) +* [`prompt`](#-python--pyvenv--prompt) +* [`pip_version`](#-python--pyvenv--pip_version) -##### `ensure` +##### `ensure` Data type: `Python::Package::Ensure` @@ -914,7 +914,7 @@ Data type: `Python::Package::Ensure` Default value: `present` -##### `version` +##### `version` Data type: `Python::Version` @@ -922,15 +922,15 @@ Python version to use. Default value: `'system'` -##### `systempkgs` +##### `systempkgs` Data type: `Boolean` Copy system site-packages into virtualenv -Default value: ``false`` +Default value: `false` -##### `venv_dir` +##### `venv_dir` Data type: `Stdlib::Absolutepath` @@ -938,7 +938,7 @@ Directory to install virtualenv to Default value: `$name` -##### `owner` +##### `owner` Data type: `String[1]` @@ -946,7 +946,7 @@ The owner of the virtualenv being manipulated Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -954,7 +954,7 @@ The group relating to the virtualenv being manipulated Default value: `'root'` -##### `mode` +##### `mode` Data type: `Stdlib::Filemode` @@ -962,7 +962,7 @@ Optionally specify directory mode Default value: `'0755'` -##### `path` +##### `path` Data type: `Array[Stdlib::Absolutepath]` @@ -970,7 +970,7 @@ Specifies the PATH variable. Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` -##### `environment` +##### `environment` Data type: `Array` @@ -978,15 +978,15 @@ Optionally specify environment variables for pyvenv Default value: `[]` -##### `prompt` +##### `prompt` -Data type: `Variant[Boolean,String[1]]` +Data type: `Optional[String[1]]` Optionally specify the virtualenv prompt (python >= 3.6) -Default value: ``false`` +Default value: `undef` -##### `pip_version` +##### `pip_version` Data type: `Python::Venv::PipVersion` @@ -994,7 +994,7 @@ Data type: `Python::Venv::PipVersion` Default value: `'latest'` -### `python::requirements` +### `python::requirements` Installs and manages Python packages from requirements file. @@ -1015,23 +1015,23 @@ python::requirements { '/var/www/project1/requirements.txt' : The following parameters are available in the `python::requirements` defined type: -* [`requirements`](#requirements) -* [`virtualenv`](#virtualenv) -* [`pip_provider`](#pip_provider) -* [`owner`](#owner) -* [`group`](#group) -* [`proxy`](#proxy) -* [`src`](#src) -* [`environment`](#environment) -* [`forceupdate`](#forceupdate) -* [`cwd`](#cwd) -* [`extra_pip_args`](#extra_pip_args) -* [`manage_requirements`](#manage_requirements) -* [`fix_requirements_owner`](#fix_requirements_owner) -* [`log_dir`](#log_dir) -* [`timeout`](#timeout) - -##### `requirements` +* [`requirements`](#-python--requirements--requirements) +* [`virtualenv`](#-python--requirements--virtualenv) +* [`pip_provider`](#-python--requirements--pip_provider) +* [`owner`](#-python--requirements--owner) +* [`group`](#-python--requirements--group) +* [`proxy`](#-python--requirements--proxy) +* [`src`](#-python--requirements--src) +* [`environment`](#-python--requirements--environment) +* [`forceupdate`](#-python--requirements--forceupdate) +* [`cwd`](#-python--requirements--cwd) +* [`extra_pip_args`](#-python--requirements--extra_pip_args) +* [`manage_requirements`](#-python--requirements--manage_requirements) +* [`fix_requirements_owner`](#-python--requirements--fix_requirements_owner) +* [`log_dir`](#-python--requirements--log_dir) +* [`timeout`](#-python--requirements--timeout) + +##### `requirements` Data type: `Stdlib::Absolutepath` @@ -1039,7 +1039,7 @@ Path to the requirements file. Default value: `$name` -##### `virtualenv` +##### `virtualenv` Data type: `Variant[Enum['system'],Stdlib::Absolutepath]` @@ -1047,7 +1047,7 @@ virtualenv to run pip in. Default value: `'system'` -##### `pip_provider` +##### `pip_provider` Data type: `Enum['pip', 'pip3']` @@ -1055,7 +1055,7 @@ version of pip you wish to use. Default value: `'pip'` -##### `owner` +##### `owner` Data type: `String[1]` @@ -1063,7 +1063,7 @@ The owner of the virtualenv being manipulated. Default value: `'root'` -##### `group` +##### `group` Data type: `String[1]` @@ -1071,23 +1071,23 @@ The group relating to the virtualenv being manipulated. Default value: `'root'` -##### `proxy` +##### `proxy` Data type: `Optional[Stdlib::HTTPUrl]` Proxy server to use for outbound connections. -Default value: ``undef`` +Default value: `undef` -##### `src` +##### `src` Data type: `Any` 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. -Default value: ``false`` +Default value: `false` -##### `environment` +##### `environment` Data type: `Array` @@ -1095,47 +1095,47 @@ Additional environment variables required to install the packages. Default value: `[]` -##### `forceupdate` +##### `forceupdate` Data type: `Boolean` 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) -Default value: ``false`` +Default value: `false` -##### `cwd` +##### `cwd` Data type: `Optional[Stdlib::Absolutepath]` The directory from which to run the "pip install" command. -Default value: ``undef`` +Default value: `undef` -##### `extra_pip_args` +##### `extra_pip_args` Data type: `Optional[String[1]]` Extra arguments to pass to pip after the requirements file -Default value: ``undef`` +Default value: `undef` -##### `manage_requirements` +##### `manage_requirements` Data type: `Boolean` Create the requirements file if it doesn't exist. -Default value: ``true`` +Default value: `true` -##### `fix_requirements_owner` +##### `fix_requirements_owner` Data type: `Boolean` Change owner and group of requirements file. -Default value: ``true`` +Default value: `true` -##### `log_dir` +##### `log_dir` Data type: `Stdlib::Absolutepath` @@ -1143,7 +1143,7 @@ Log directory. Default value: `'/tmp'` -##### `timeout` +##### `timeout` Data type: `Integer` @@ -1153,63 +1153,39 @@ Default value: `1800` ## Data types -### `Python::Loglevel` +### `Python::Loglevel` Match all valid loglevels for python -Alias of +Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']` -```puppet -Enum['debug', 'info', 'warning', 'error', 'critical'] -``` - -### `Python::Package::Ensure` +### `Python::Package::Ensure` Match all valid package ensures for python -Alias of +Alias of `Enum['absent', 'present', 'latest']` -```puppet -Enum['absent', 'present', 'latest'] -``` - -### `Python::Provider` +### `Python::Provider` Match all valid provider for python -Alias of - -```puppet -Enum['pip', 'scl', 'rhscl', 'anaconda', ''] -``` +Alias of `Enum['pip', 'scl', 'rhscl', 'anaconda', '']` -### `Python::Umask` +### `Python::Umask` Match valid umask for python -Alias of - -```puppet -Pattern[/[0-7]{1,4}/] -``` +Alias of `Pattern[/[0-7]{1,4}/]` -### `Python::Venv::PipVersion` +### `Python::Venv::PipVersion` A version type to ensure a specific Pip version in a virtual env. -Alias of +Alias of `Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/]` -```puppet -Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/] -``` - -### `Python::Version` +### `Python::Version` Match all valid versions for python -Alias of - -```puppet -Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/] -``` +Alias of `Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]` diff --git a/metadata.json b/metadata.json index 2976f1b4..4dd1e2f1 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.3.1-rc0", + "version": "6.4.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 8a8f98e9821f72e778054b26ed5107b1b7e70dde Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sun, 6 Nov 2022 15:04:14 +0100 Subject: [PATCH 283/380] [blacksmith] Bump version to 6.4.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 4dd1e2f1..c64301dc 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.4.0", + "version": "6.4.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 6c20de311a599fac9244c8d9a0e823efd0ab7ee8 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 20 Dec 2022 16:59:54 +0100 Subject: [PATCH 284/380] modulesync 5.4.0 --- .msync.yml | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.msync.yml b/.msync.yml index 02353859..f3156d15 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.3.0' +modulesync_config_version: '5.4.0' diff --git a/Gemfile b/Gemfile index 07209b79..b3827ba7 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 5.4', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 1.0', :require => false + gem 'puppet_metadata', '~> 2.0', :require => false end group :development do From a3dafc71f800c5ac3970f65a52fef1fe1293b49a Mon Sep 17 00:00:00 2001 From: James Lee Date: Fri, 3 Mar 2023 14:27:26 -0500 Subject: [PATCH 285/380] Fix pip installation on Gentoo The 'pip' package name is ambiguous on Gentoo, with options 'app-misc/pip' and 'dev-python/pip', resulting in the following error during installation: > Error: /Stage[main]/Python::Install/Package[pip]: Could not evaluate: > More than one package with the specified name [pip], please use the > category parameter to disambiguate The error message directs us to use the `category` parameter, which this module already did; however, `category` is a "read-only parameter set by the package" [1]. The correct way to disambiguate this package is to use the full package name, 'dev-python/pip'. [1] https://www.puppet.com/docs/puppet/7/types/package.html#package-attribute-category --- manifests/install.pp | 13 ++----------- spec/classes/python_spec.rb | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 08227b32..6a738435 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -213,42 +213,33 @@ } if String($python::version) =~ /^python3/ { - $pip_category = undef $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { - $pip_category = undef $pip_package = 'python3-pip' $pip_provider = pip3 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { - $pip_category = undef $pip_package = 'python2-pip' $pip_provider = pip2 } elsif $facts['os']['family'] == 'FreeBSD' { - $pip_category = undef $pip_package = "py${python::version}-pip" $pip_provider = 'pip' } elsif $facts['os']['family'] == 'Gentoo' { - $pip_category = 'dev-python' - $pip_package = 'pip' + $pip_package = 'dev-python/pip' $pip_provider = 'pip' } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) { - $pip_category = undef $pip_package = 'python3-pip' $pip_provider = 'pip3' } elsif ($facts['os']['name'] == 'Debian') and (versioncmp($facts['os']['release']['major'], '11') >= 0) { - $pip_category = undef $pip_package = 'python3-pip' $pip_provider = 'pip3' } else { - $pip_category = undef $pip_package = 'python-pip' $pip_provider = 'pip' } Package <| title == 'pip' |> { - name => $pip_package, - category => $pip_category, + name => $pip_package, } } } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 9c6569ba..cca3ef65 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -489,7 +489,7 @@ it { is_expected.to contain_class('python::install') } # Base debian packages. it { is_expected.to contain_package('python') } - it { is_expected.to contain_package('pip').with('category' => 'dev-python') } + it { is_expected.to contain_package('pip').with('name' => 'dev-python/pip') } # Python::Dev it { is_expected.not_to contain_package('python-dev') } From 4895041fc616750e0c3eea51460aee0e2c3d3fb4 Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 10:32:53 +0200 Subject: [PATCH 286/380] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf22..00000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224c..84fd904c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile diff --git a/.msync.yml b/.msync.yml index f3156d15..a4b00691 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f50514..58a04088 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile diff --git a/Gemfile b/Gemfile index b3827ba7..15313c38 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index b7f7fe73..58250c39 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-python' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = 'voxpupuli' - config.project = 'puppet-python' - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby From db3c500f8916acccea58c115e7c0fb92dabfbe40 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 28 Apr 2023 14:04:11 +0200 Subject: [PATCH 287/380] Drop Puppet 6 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index c64301dc..7fa6a764 100644 --- a/metadata.json +++ b/metadata.json @@ -67,7 +67,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.1.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 8.0.0" } ], "dependencies": [ From 9c1a9228a4092b4c714acc22c34f9c59e090ca24 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 13:25:00 +0200 Subject: [PATCH 288/380] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b00691..b929160c 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 15313c38..98a04cfb 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false end group :development do @@ -16,18 +16,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From 71fa2edbf24cc4169543d77d985a7f9323f92175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 12 May 2023 09:51:45 -1000 Subject: [PATCH 289/380] Drop Debian 9 (EOL) --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 7fa6a764..aaffa8f4 100644 --- a/metadata.json +++ b/metadata.json @@ -30,7 +30,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "9", "10", "11" ] From 26b034820c61273e19bcaaf1a0d6f3f88aa619af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 12 May 2023 09:53:28 -1000 Subject: [PATCH 290/380] Drop Ubuntu 16.04 (EOL) --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index aaffa8f4..e35e05fa 100644 --- a/metadata.json +++ b/metadata.json @@ -48,7 +48,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "16.04", "18.04", "20.04" ] From f0316cf16643efc6bc9246a9d24d060ece9f5c60 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Sat, 1 Jul 2023 15:50:18 +0200 Subject: [PATCH 291/380] puppetlabs/stdlib: Allow 9.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e35e05fa..fd4aac5a 100644 --- a/metadata.json +++ b/metadata.json @@ -71,7 +71,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.19.0 < 9.0.0" + "version_requirement": ">= 4.19.0 < 10.0.0" }, { "name": "puppet/epel", From ca03734cd80738f7f39f05fb2271eb301dedb2a5 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jul 2023 09:27:06 +0200 Subject: [PATCH 292/380] Add Puppet 8 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index e35e05fa..48626963 100644 --- a/metadata.json +++ b/metadata.json @@ -65,7 +65,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "dependencies": [ From a3696d528d89e8d2a82b663666799b7f64f9662d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 12 Jul 2023 13:48:12 -1000 Subject: [PATCH 293/380] Release 7.0.0 --- CHANGELOG.md | 21 ++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32782619..e273bebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v7.0.0](https://github.com/voxpupuli/puppet-python/tree/v7.0.0) (2023-07-12) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.4.0...v7.0.0) + +**Breaking changes:** + +- Drop Ubuntu 16.04 \(EOL\) [\#659](https://github.com/voxpupuli/puppet-python/pull/659) ([smortex](https://github.com/smortex)) +- Drop Debian 9 \(EOL\) [\#658](https://github.com/voxpupuli/puppet-python/pull/658) ([smortex](https://github.com/smortex)) +- Drop Puppet 6 support [\#656](https://github.com/voxpupuli/puppet-python/pull/656) ([bastelfreak](https://github.com/bastelfreak)) + +**Implemented enhancements:** + +- Add Puppet 8 support [\#664](https://github.com/voxpupuli/puppet-python/pull/664) ([bastelfreak](https://github.com/bastelfreak)) +- puppetlabs/stdlib: Allow 9.x [\#663](https://github.com/voxpupuli/puppet-python/pull/663) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- Fix pip installation on Gentoo [\#651](https://github.com/voxpupuli/puppet-python/pull/651) ([jameslikeslinux](https://github.com/jameslikeslinux)) + ## [v6.4.0](https://github.com/voxpupuli/puppet-python/tree/v6.4.0) (2022-11-06) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.3.0...v6.4.0) @@ -612,7 +631,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge - Bootstrap pip installation [\#244](https://github.com/voxpupuli/puppet-python/pull/244) ([joshuaspence](https://github.com/joshuaspence)) - Various tidying up [\#242](https://github.com/voxpupuli/puppet-python/pull/242) ([joshuaspence](https://github.com/joshuaspence)) - Allow custom versions to be installed [\#241](https://github.com/voxpupuli/puppet-python/pull/241) ([joshuaspence](https://github.com/joshuaspence)) -- Check that we have results before returning a value [\#238](https://github.com/voxpupuli/puppet-python/pull/238) ([xaque208](https://github.com/xaque208)) +- Check that we have results before returning a value [\#238](https://github.com/voxpupuli/puppet-python/pull/238) ([zachfi](https://github.com/zachfi)) - Adjust test code to pass syntax checker [\#237](https://github.com/voxpupuli/puppet-python/pull/237) ([fluential](https://github.com/fluential)) ## [1.9.7](https://github.com/voxpupuli/puppet-python/tree/1.9.7) (2015-08-21) diff --git a/metadata.json b/metadata.json index cb3169b1..b4062606 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "6.4.1-rc0", + "version": "7.0.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From f1d0bf97fa95b27c6812664bc3bf65eb77293649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 27 Jul 2023 09:26:24 -1000 Subject: [PATCH 294/380] [blacksmith] Bump version to 7.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index b4062606..93c4eb8f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.0.0", + "version": "7.0.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 12e2bf12c6bbca3bc9f670541cd1b5769f8cb65c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 17:10:44 +0200 Subject: [PATCH 295/380] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + spec/spec_helper_acceptance.rb | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb..6aaa603f 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160c..dd3e9572 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 98a04cfb..db21d3b5 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6515b7bf..9efb4ae6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,3 +17,4 @@ add_custom_fact name.to_sym, value end end +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index d3a6e23c..2681792e 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -5,6 +5,6 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker +configure_beaker(modules: :metadata) Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } From 3e64f8654b4b096ed9d7cdfb0989f83b0b8bea9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 17 Aug 2023 15:45:04 -1000 Subject: [PATCH 296/380] Auto-correct rubocop offenses --- spec/unit/facter/pip_version_spec.rb | 6 +++--- spec/unit/facter/python_release_spec.rb | 8 ++++---- spec/unit/facter/python_version_spec.rb | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 4d7df96a..3e6cd29f 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -37,7 +37,7 @@ context 'returns nil when pip not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('pip').and_return(false) - expect(Facter.value(:pip_version)).to eq(nil) + expect(Facter.value(:pip_version)).to be_nil end end end @@ -54,7 +54,7 @@ context 'returns nil when pip2 not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(false) - expect(Facter.value(:pip2_version)).to eq(nil) + expect(Facter.value(:pip2_version)).to be_nil end end end @@ -71,7 +71,7 @@ context 'returns nil when pip3 not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(false) - expect(Facter.value(:pip3_version)).to eq(nil) + expect(Facter.value(:pip3_version)).to be_nil end end end diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index d8ec3e5d..6026c1e3 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -31,7 +31,7 @@ it do allow(Facter::Util::Resolution).to receive(:exec).and_return(false) allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) - expect(Facter.value(:python_release)).to eq(nil) + expect(Facter.value(:python_release)).to be_nil end end end @@ -60,7 +60,7 @@ allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) - expect(Facter.value(:python2_release)).to eq(nil) + expect(Facter.value(:python2_release)).to be_nil end end @@ -68,7 +68,7 @@ it do allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) - expect(Facter.value(:python2_release)).to eq(nil) + expect(Facter.value(:python2_release)).to be_nil end end end @@ -85,7 +85,7 @@ context 'returns nil when `python3` not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(false) - expect(Facter.value(:python3_release)).to eq(nil) + expect(Facter.value(:python3_release)).to be_nil end end end diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index 922cb3d6..d66d280b 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -30,7 +30,7 @@ context 'returns nil when `python` not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) - expect(Facter.value(:python_version)).to eq(nil) + expect(Facter.value(:python_version)).to be_nil end end end @@ -59,7 +59,7 @@ allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(true) allow(Facter::Util::Resolution).to receive(:exec).with('python -V 2>&1').and_return(python3_version_output) allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) - expect(Facter.value(:python2_version)).to eq(nil) + expect(Facter.value(:python2_version)).to be_nil end end @@ -67,7 +67,7 @@ it do allow(Facter::Util::Resolution).to receive(:which).with('python2').and_return(false) allow(Facter::Util::Resolution).to receive(:which).with('python').and_return(false) - expect(Facter.value(:python2_version)).to eq(nil) + expect(Facter.value(:python2_version)).to be_nil end end end @@ -84,7 +84,7 @@ context 'returns nil when `python3` not present' do it do allow(Facter::Util::Resolution).to receive(:which).with('python3').and_return(false) - expect(Facter.value(:python3_version)).to eq(nil) + expect(Facter.value(:python3_version)).to be_nil end end end From 5057117bb7aaab6e11f318914e21cc14e86b6cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 17 Aug 2023 15:47:00 -1000 Subject: [PATCH 297/380] Ignore remaining rebocop offenses --- spec/unit/facter/pip_version_spec.rb | 2 ++ spec/unit/facter/python_release_spec.rb | 2 ++ spec/unit/facter/python_version_spec.rb | 2 ++ 3 files changed, 6 insertions(+) diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 3e6cd29f..06bcf3de 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -7,6 +7,7 @@ Facter.clear end + # rubocop:disable RSpec/IndexedLet let(:pip_version_output) do <<~EOS pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7) @@ -24,6 +25,7 @@ pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) EOS end + # rubocop:enable RSpec/IndexedLet describe 'pip_version' do context 'returns pip version when pip present' do diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index 6026c1e3..d87b10b2 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -7,6 +7,7 @@ Facter.clear end + # rubocop:disable RSpec/IndexedLet let(:python2_version_output) do <<~EOS Python 2.7.9 @@ -17,6 +18,7 @@ Python 3.3.0 EOS end + # rubocop:enable RSpec/IndexedLet describe 'python_release' do context 'returns Python release when `python` present' do diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index d66d280b..386fcffb 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -7,6 +7,7 @@ Facter.clear end + # rubocop:disable RSpec/IndexedLet let(:python2_version_output) do <<~EOS Python 2.7.9 @@ -17,6 +18,7 @@ Python 3.3.0 EOS end + # rubocop:enable RSpec/IndexedLet describe 'python_version' do context 'returns Python version when `python` present' do From 6ca453bddf6dba5c9ea111d2c58295b619e60114 Mon Sep 17 00:00:00 2001 From: Stefan Goethals Date: Fri, 8 Sep 2023 10:23:00 +0200 Subject: [PATCH 298/380] Update declared_requirements_install_spec.rb Add # frozen_string_literal: true required by rubocop check --- spec/acceptance/declared_requirements_install_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/acceptance/declared_requirements_install_spec.rb b/spec/acceptance/declared_requirements_install_spec.rb index 185e6db2..bc9c07d4 100644 --- a/spec/acceptance/declared_requirements_install_spec.rb +++ b/spec/acceptance/declared_requirements_install_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'requirements' do From 8564e713b1944fad8768199d42793357d4ef3ce6 Mon Sep 17 00:00:00 2001 From: Stefan - Zipkid - Goethals Date: Mon, 11 Sep 2023 13:36:09 +0200 Subject: [PATCH 299/380] Use 'installed' because ensure_packages() forces it https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/lib/puppet/functions/stdlib/ensure_packages.rb#L36-L37 --- spec/classes/python_spec.rb | 24 ++++++++++++------------ types/package/ensure.pp | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index cca3ef65..3ef04fb1 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -50,15 +50,15 @@ { manage_pip_package: true, manage_venv_package: true, - pip: 'present', - venv: 'present' + pip: 'installed', + venv: 'installed' } end it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_package('pip').with(ensure: 'present') } + it { is_expected.to contain_package('pip').with(ensure: 'installed') } - it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['name'] == 'CentOS' + it { is_expected.to contain_package('python-venv').with(ensure: 'installed') } unless facts[:os]['name'] == 'CentOS' end case facts[:os]['family'] @@ -86,10 +86,10 @@ # rubocop:disable RSpec/RepeatedExampleGroupDescription describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'present' } } + let(:params) { { dev: 'installed' } } it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_package('python-dev').with_ensure('present') } + it { is_expected.to contain_package('python-dev').with_ensure('installed') } end context 'empty/default' do @@ -233,9 +233,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'present' } } + let(:params) { { dev: 'installed' } } - it { is_expected.to contain_package('python-dev').with_ensure('present') } + it { is_expected.to contain_package('python-dev').with_ensure('installed') } end context 'default/empty' do @@ -417,9 +417,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'present' } } + let(:params) { { dev: 'installed' } } - it { is_expected.to contain_package('python-dev').with_ensure('present') } + it { is_expected.to contain_package('python-dev').with_ensure('installed') } end context 'empty/default' do @@ -467,9 +467,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'present' } } + let(:params) { { dev: 'installed' } } - it { is_expected.to contain_package('python-dev').with_ensure('present') } + it { is_expected.to contain_package('python-dev').with_ensure('installed') } end context 'default/empty' do diff --git a/types/package/ensure.pp b/types/package/ensure.pp index 34189e4b..9fa54968 100644 --- a/types/package/ensure.pp +++ b/types/package/ensure.pp @@ -1,3 +1,3 @@ # @summary Match all valid package ensures for python # -type Python::Package::Ensure = Enum['absent', 'present', 'latest'] +type Python::Package::Ensure = Enum['absent', 'present', 'installed', 'latest'] From 5c0646b73111d97382731289260249e8a1c891b7 Mon Sep 17 00:00:00 2001 From: Stefan - Zipkid - Goethals Date: Mon, 11 Sep 2023 13:43:13 +0200 Subject: [PATCH 300/380] Add 'installed' to package ensure See https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/lib/puppet/functions/stdlib/ensure_packages.rb#L36-L37 --- REFERENCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REFERENCE.md b/REFERENCE.md index 2aac08b3..7cc88c03 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1163,7 +1163,7 @@ Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']` Match all valid package ensures for python -Alias of `Enum['absent', 'present', 'latest']` +Alias of `Enum['absent', 'present', 'installed', 'latest']` ### `Python::Provider` From 8881c431aa9403eaaa68c4dfd456a3b03c7223f0 Mon Sep 17 00:00:00 2001 From: Stefan - Zipkid - Goethals Date: Tue, 12 Sep 2023 09:52:54 +0200 Subject: [PATCH 301/380] Only set subscribe to a requirements.txt file if manage_requirements is true --- manifests/requirements.pp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 2f000bde..f2743509 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -88,8 +88,13 @@ replace => false, content => '# Puppet will install and/or update pip packages listed here', } + + $local_subscribe = File[$requirements] + } elsif File[$requirements] and $manage_requirements == true { + $local_subscribe = File[$requirements] + } else { + $local_subscribe = undef } - $local_subscribe = File[$requirements] exec { "python_requirements${name}": provider => shell, From fa9cbc41ca0764c9c7d923b3340a24eadea110ea Mon Sep 17 00:00:00 2001 From: Stefan - Zipkid - Goethals Date: Wed, 13 Sep 2023 14:31:51 +0200 Subject: [PATCH 302/380] Remove ensure-packages --- manifests/install.pp | 30 +++++++++++++++--------------- spec/classes/python_spec.rb | 24 ++++++++++++------------ 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 33067e8e..6a738435 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -25,10 +25,10 @@ } if $python::manage_python_package { - ensure_packages (['python'], + package { 'python': ensure => $python::ensure, name => $python, - ) + } } if $python::manage_venv_package { @@ -47,17 +47,17 @@ case $python::provider { 'pip': { if $python::manage_pip_package { - ensure_packages (['pip'], + package { 'pip': ensure => $python::pip, require => Package['python'], - ) + } } if $pythondev { - ensure_packages (['python-dev'], + package { 'python-dev': ensure => $python::dev, name => $pythondev, - ) + } } # Respect the $python::pip setting @@ -180,28 +180,28 @@ } if $pythondev { - ensure_packages (['python-dev'], - ensure => $python::dev, - name => $pythondev, - alias => $pythondev, + package { 'python-dev': + ensure => $python::dev, + name => $pythondev, + alias => $pythondev, provider => 'yum', - ) + } } } default: { if $python::manage_pip_package { - ensure_packages (['pip'], + package { 'pip': ensure => $python::pip, require => Package['python'], - ) + } } if $pythondev { - ensure_packages (['python-dev'], + package { 'python-dev': ensure => $python::dev, name => $pythondev, alias => $pythondev, - ) + } } } } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 3ef04fb1..cca3ef65 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -50,15 +50,15 @@ { manage_pip_package: true, manage_venv_package: true, - pip: 'installed', - venv: 'installed' + pip: 'present', + venv: 'present' } end it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_package('pip').with(ensure: 'installed') } + it { is_expected.to contain_package('pip').with(ensure: 'present') } - it { is_expected.to contain_package('python-venv').with(ensure: 'installed') } unless facts[:os]['name'] == 'CentOS' + it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['name'] == 'CentOS' end case facts[:os]['family'] @@ -86,10 +86,10 @@ # rubocop:disable RSpec/RepeatedExampleGroupDescription describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'installed' } } + let(:params) { { dev: 'present' } } it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_package('python-dev').with_ensure('installed') } + it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'empty/default' do @@ -233,9 +233,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'installed' } } + let(:params) { { dev: 'present' } } - it { is_expected.to contain_package('python-dev').with_ensure('installed') } + it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'default/empty' do @@ -417,9 +417,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'installed' } } + let(:params) { { dev: 'present' } } - it { is_expected.to contain_package('python-dev').with_ensure('installed') } + it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'empty/default' do @@ -467,9 +467,9 @@ describe 'with python::dev' do context 'true' do - let(:params) { { dev: 'installed' } } + let(:params) { { dev: 'present' } } - it { is_expected.to contain_package('python-dev').with_ensure('installed') } + it { is_expected.to contain_package('python-dev').with_ensure('present') } end context 'default/empty' do From 5bd8f1be290ee9eb2fa2f1b094dfabce28edf3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 15 Sep 2023 08:53:16 -1000 Subject: [PATCH 303/380] Allow to skip management of python dev package Just like we can skip managing the pip and venv packages, allow to opt-out of managing the dev package. Enforcing a state of these packages sometimes cause trouble if the user of the module does not care about them but they get installed as another package dependency (e.g. syslog-ng-mod-python depends on python-venv, by default python-venv is ensured absent, so on each run Puppet wants to install syslog-ng-mod-python (which install python-venv as a dependency) or remove python-venv (which remove syslog-ng-mod-python as a dependency)). This can be avoided using the corresponding `manage_XXX_package` paramater, but `manage_dev_package` was missing. --- REFERENCE.md | 9 +++++++++ manifests/init.pp | 2 ++ manifests/install.pp | 6 +++--- spec/classes/python_spec.rb | 2 ++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 2aac08b3..424472ea 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -79,6 +79,7 @@ The following parameters are available in the `python` class: * [`umask`](#-python--umask) * [`manage_gunicorn`](#-python--manage_gunicorn) * [`manage_python_package`](#-python--manage_python_package) +* [`manage_dev_package`](#-python--manage_dev_package) * [`manage_venv_package`](#-python--manage_venv_package) * [`manage_pip_package`](#-python--manage_pip_package) * [`venv`](#-python--venv) @@ -192,6 +193,14 @@ manage the state for package python Default value: `true` +##### `manage_dev_package` + +Data type: `Boolean` + +manage the state of the python development package + +Default value: `true` + ##### `manage_venv_package` Data type: `Boolean` diff --git a/manifests/init.pp b/manifests/init.pp index 5b3c9fdf..b457edbd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,6 +19,7 @@ # @param umask The default umask for invoked exec calls. # @param manage_gunicorn manage the state for package gunicorn # @param manage_python_package manage the state for package python +# @param manage_dev_package manage the state of the python development package # @param manage_venv_package manage the state for package venv # @param manage_pip_package manage the state for package pip # @@ -45,6 +46,7 @@ Python::Package::Ensure $gunicorn = 'absent', Boolean $manage_gunicorn = true, Boolean $manage_python_package = true, + Boolean $manage_dev_package = true, Boolean $manage_venv_package = $python::params::manage_venv_package, Boolean $manage_pip_package = $python::params::manage_pip_package, String[1] $gunicorn_package_name = $python::params::gunicorn_package_name, diff --git a/manifests/install.pp b/manifests/install.pp index 6a738435..5d25efda 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -53,7 +53,7 @@ } } - if $pythondev { + if $python::manage_dev_package and $pythondev { package { 'python-dev': ensure => $python::dev, name => $pythondev, @@ -179,7 +179,7 @@ } } - if $pythondev { + if $python::manage_dev_package and $pythondev { package { 'python-dev': ensure => $python::dev, name => $pythondev, @@ -196,7 +196,7 @@ } } - if $pythondev { + if $python::manage_dev_package and $pythondev { package { 'python-dev': ensure => $python::dev, name => $pythondev, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index cca3ef65..d3bde4a4 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -34,6 +34,7 @@ let :params do { manage_python_package: false, + manage_dev_package: false, manage_pip_package: false, manage_venv_package: false } @@ -41,6 +42,7 @@ it { is_expected.to compile.with_all_deps } it { is_expected.not_to contain_package('python') } + it { is_expected.not_to contain_package('python-dev') } it { is_expected.not_to contain_package('pip') } it { is_expected.not_to contain_package('python-venv') } end From 8172b275b40edbb5867082be35d0c863779ef695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 6 Oct 2023 17:23:54 -1000 Subject: [PATCH 304/380] Use the wheel group by default on FreeBSD FreeBSD does not have a 'root' group. System files owned by the 'root' user belong to the 'wheel' group, so use that group by default. This allow to use python::pip without the need to explicitly set the `group` parameter to avoid the error: > Error: Could not execute posix command: Invalid group: root --- manifests/params.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index e498ddaf..4713c7df 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -16,8 +16,9 @@ } $group = $facts['os']['family'] ? { - 'AIX' => 'system', - default => 'root' + 'AIX' => 'system', + 'FreeBSD' => 'wheel', + default => 'root' } $pip_lookup_path = $facts['os']['family'] ? { From 32e23b57b6b01d62b5bbdfb9033e7b9f3c0d7804 Mon Sep 17 00:00:00 2001 From: Dan Dunckel <1153702+dandunckelman@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:03:19 -0600 Subject: [PATCH 305/380] Bump puppet-epel to allow 5.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 93c4eb8f..9e4dd1fc 100644 --- a/metadata.json +++ b/metadata.json @@ -75,7 +75,7 @@ }, { "name": "puppet/epel", - "version_requirement": ">= 3.0.0 < 5.0.0" + "version_requirement": ">= 3.0.0 < 6.0.0" } ] } From 4523bd7dcc2c11a0f171d48c97c7a6bd2c93c4c0 Mon Sep 17 00:00:00 2001 From: "Lushaj, Valdrin" Date: Mon, 27 Nov 2023 17:50:27 +0100 Subject: [PATCH 306/380] Add Support for RedHat/CentOS 9 --- manifests/install.pp | 3 +++ manifests/params.pp | 1 + metadata.json | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 6a738435..e7c16964 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -215,6 +215,9 @@ if String($python::version) =~ /^python3/ { $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') + } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '9') >= 0) { + $pip_package = 'python3-pip' + $pip_provider = pip3 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { $pip_package = 'python3-pip' $pip_provider = pip3 diff --git a/manifests/params.pp b/manifests/params.pp index 4713c7df..50937bb9 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,6 +28,7 @@ $gunicorn_package_name = $facts['os']['family'] ? { 'RedHat' => $facts['os']['release']['major'] ? { + '9' => 'python3-gunicorn', '8' => 'python3-gunicorn', default => 'python-gunicorn', }, diff --git a/metadata.json b/metadata.json index 9e4dd1fc..75189ed8 100644 --- a/metadata.json +++ b/metadata.json @@ -24,7 +24,8 @@ "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { From 92b91a0683c52d6b43f8c4579764c99054a9af0e Mon Sep 17 00:00:00 2001 From: Jake Rogers Date: Mon, 27 Nov 2023 11:51:30 -0700 Subject: [PATCH 307/380] apply python-venv exclude to RedHat family instead of just CentOS --- manifests/install.pp | 2 +- spec/classes/python_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 5d25efda..c3db3d80 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -35,7 +35,7 @@ ## ## CentOS has no extra package for venv ## - unless $facts['os']['name'] == 'CentOS' { + unless $facts['os']['family'] == 'RedHat' { package { 'python-venv': ensure => $python::venv, name => "${python}-venv", diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d3bde4a4..54c47fc7 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -23,7 +23,7 @@ it { is_expected.to contain_package('pip') } end - if %w[Archlinux CentOS].include?(facts[:os]['name']) + if %w[Archlinux RedHat].include?(facts[:os]['family']) it { is_expected.not_to contain_package('python-venv') } else it { is_expected.to contain_package('python-venv') } @@ -60,7 +60,7 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_package('pip').with(ensure: 'present') } - it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['name'] == 'CentOS' + it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['family'] == 'RedHat' end case facts[:os]['family'] From 4e144a1464b2b18fc18f41dfe1c6357e87a992b5 Mon Sep 17 00:00:00 2001 From: Jake Rogers Date: Mon, 27 Nov 2023 15:50:23 -0700 Subject: [PATCH 308/380] added RedHat family OSes: Alma, Oracle, RedHat, & Rocky versions 8 & 9 to metadata.json operatingsystem_support array --- metadata.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/metadata.json b/metadata.json index 9e4dd1fc..26f48665 100644 --- a/metadata.json +++ b/metadata.json @@ -20,6 +20,13 @@ "7100-05-03-1837" ] }, + { + "operatingsystem": "AlmaLinux", + "operatingsystemrelease": [ + "8", + "9" + ] + }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ @@ -52,6 +59,27 @@ "20.04" ] }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "8", + "9" + ] + }, + { + "operatingsystem": "RedHat", + "operatingsystemrelease": [ + "8", + "9" + ] + }, + { + "operatingsystem": "Rocky", + "operatingsystemrelease": [ + "8", + "9" + ] + }, { "operatingsystem": "SLES", "operatingsystemrelease": [ From cdd8de29582dc710c54ca7b5f4c84a1dc5af70d6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 29 Nov 2023 08:30:59 +0100 Subject: [PATCH 309/380] Add Debian 12 support --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 26f48665..101007f3 100644 --- a/metadata.json +++ b/metadata.json @@ -38,7 +38,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "10", - "11" + "11", + "12" ] }, { From b5e76279ab07abcfc226b6c0d64a4047efc1a489 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 29 Nov 2023 08:31:23 +0100 Subject: [PATCH 310/380] Add Ubuntu 22.04 support --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 26f48665..b4edb108 100644 --- a/metadata.json +++ b/metadata.json @@ -56,7 +56,8 @@ "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "18.04", - "20.04" + "20.04", + "22.04" ] }, { From 88c6a1157e6662c9acf552e7f6136011a467e8d4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 29 Nov 2023 09:03:30 +0100 Subject: [PATCH 311/380] Release 7.1.0 --- CHANGELOG.md | 21 +++++++++++++++++++-- metadata.json | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e273bebf..ae0b3b52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,24 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. -## [v7.0.0](https://github.com/voxpupuli/puppet-python/tree/v7.0.0) (2023-07-12) +## [v7.1.0](https://github.com/voxpupuli/puppet-python/tree/v7.1.0) (2023-11-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.0.0...v7.1.0) + +**Implemented enhancements:** + +- Add Ubuntu 22.04 support [\#679](https://github.com/voxpupuli/puppet-python/pull/679) ([bastelfreak](https://github.com/bastelfreak)) +- Add Debian 12 support [\#678](https://github.com/voxpupuli/puppet-python/pull/678) ([bastelfreak](https://github.com/bastelfreak)) +- Add OracleLinux/AlmaLinux/Rocky support [\#677](https://github.com/voxpupuli/puppet-python/pull/677) ([JakeTRogers](https://github.com/JakeTRogers)) +- Bump puppet-epel to allow 5.x [\#674](https://github.com/voxpupuli/puppet-python/pull/674) ([dandunckelman](https://github.com/dandunckelman)) +- Allow to skip management of python dev package [\#669](https://github.com/voxpupuli/puppet-python/pull/669) ([smortex](https://github.com/smortex)) + +**Fixed bugs:** + +- Use the wheel group by default on FreeBSD [\#672](https://github.com/voxpupuli/puppet-python/pull/672) ([smortex](https://github.com/smortex)) +- If user declares their requirements.txt in Puppet, don't skip pip installation in python::requirements [\#619](https://github.com/voxpupuli/puppet-python/pull/619) ([acullenn](https://github.com/acullenn)) + +## [v7.0.0](https://github.com/voxpupuli/puppet-python/tree/v7.0.0) (2023-07-27) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.4.0...v7.0.0) @@ -796,7 +813,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge **Closed issues:** - 'system' or any other version of python doesn't work, doesn't get validated [\#129](https://github.com/voxpupuli/puppet-python/issues/129) -- Could not look up qualified variable '::python::install::valid\_versions' [\#126](https://github.com/voxpupuli/puppet-python/issues/126) +- Could not look up qualified variable `python::install::valid_versions` [\#126](https://github.com/voxpupuli/puppet-python/issues/126) ## [1.7.11](https://github.com/voxpupuli/puppet-python/tree/1.7.11) (2014-10-11) diff --git a/metadata.json b/metadata.json index 33eee66a..1c70bb08 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.0.1-rc0", + "version": "7.1.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 87ebe53f396560d4a687977ec3b17bdc4d98f372 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 29 Nov 2023 09:12:38 +0100 Subject: [PATCH 312/380] [blacksmith] Bump version to 7.1.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 1c70bb08..3ae64d1e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.1.0", + "version": "7.1.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From f7b0196c9038de79ee1e0d5f0123387baac60077 Mon Sep 17 00:00:00 2001 From: "Lushaj, Valdrin" Date: Wed, 29 Nov 2023 10:00:48 +0100 Subject: [PATCH 313/380] removed unnecessary code, since case >= 8 already does the same thing --- manifests/install.pp | 3 --- 1 file changed, 3 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e7c16964..6a738435 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -215,9 +215,6 @@ if String($python::version) =~ /^python3/ { $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') - } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '9') >= 0) { - $pip_package = 'python3-pip' - $pip_provider = pip3 } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { $pip_package = 'python3-pip' $pip_provider = pip3 From b61c32f6f7a1b563638b190c836cd10afe7c70a1 Mon Sep 17 00:00:00 2001 From: "Lushaj, Valdrin" Date: Thu, 30 Nov 2023 12:20:34 +0100 Subject: [PATCH 314/380] Standardize gunicorn package references across RHEL versions --- manifests/params.pp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 50937bb9..49bfdeac 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,9 +28,8 @@ $gunicorn_package_name = $facts['os']['family'] ? { 'RedHat' => $facts['os']['release']['major'] ? { - '9' => 'python3-gunicorn', - '8' => 'python3-gunicorn', - default => 'python-gunicorn', + '7' => 'python-gunicorn', + default => 'python3-gunicorn', }, default => 'gunicorn', } From 7c9afca27b7cbe73acda2f75dc7e5340f4d35157 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 15 Dec 2023 13:30:39 +0100 Subject: [PATCH 315/380] modulesync 7.2.0 --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 8 +++----- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a077911..b66d8ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,6 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f17213..55324aa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e9572..f8183449 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.2.0' diff --git a/.pmtignore b/.pmtignore index 58a04088..10b98306 100644 --- a/.pmtignore +++ b/.pmtignore @@ -35,3 +35,4 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md diff --git a/Gemfile b/Gemfile index db21d3b5..a4a3b204 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false From 0d580e0b195727d9efd5912f74d1de3c2b9169ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 1 Jan 2024 12:08:01 -1000 Subject: [PATCH 316/380] Make latest version detection portable This is currently broken on FreeBSD do to the usage of GNU-grep specific grep(1) flag: `-P`. We can use a single sed(1) command with an extended regular expression to achieve the same goal, so use this instead. --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 199e7925..a7ee7a2f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -220,7 +220,7 @@ $latest_version = join([ "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", - ' | grep -oP "\(from versions: .*\)" | sed -E "s/\(from versions: (.*?, )*(.*)\)/\2/g"', + " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", ' | tr -d "[:space:]"', ]) From 6a16969f5ef571542bd5f50c75e5e178d125df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 1 Jan 2024 13:10:42 -1000 Subject: [PATCH 317/380] Release 7.2.0 --- CHANGELOG.md | 12 ++++++++++++ metadata.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae0b3b52..45b23ed4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v7.2.0](https://github.com/voxpupuli/puppet-python/tree/v7.2.0) (2024-01-01) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.1.0...v7.2.0) + +**Implemented enhancements:** + +- Add Support for RedHat/CentOS 9 [\#676](https://github.com/voxpupuli/puppet-python/pull/676) ([ValdrinLushaj](https://github.com/ValdrinLushaj)) + +**Fixed bugs:** + +- Make latest version detection portable [\#682](https://github.com/voxpupuli/puppet-python/pull/682) ([smortex](https://github.com/smortex)) + ## [v7.1.0](https://github.com/voxpupuli/puppet-python/tree/v7.1.0) (2023-11-29) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.0.0...v7.1.0) diff --git a/metadata.json b/metadata.json index ea7054b7..ab599ea9 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.1.1-rc0", + "version": "7.2.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From ece8051906eda06468df17b53125b9e184abab8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 1 Jan 2024 13:19:45 -1000 Subject: [PATCH 318/380] [blacksmith] Bump version to 7.2.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index ab599ea9..91338c2d 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.2.0", + "version": "7.2.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 1b0bd78d3625be06acafcb1ba7c66a6cbd5cb685 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Tue, 6 Feb 2024 12:39:30 +0100 Subject: [PATCH 319/380] modulesync 7.3.0 --- .github/workflows/ci.yml | 7 ++++++- .msync.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b66d8ca7..7216724f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: + - main + - master concurrency: group: ${{ github.ref_name }} diff --git a/.msync.yml b/.msync.yml index f8183449..f46ee025 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.2.0' +modulesync_config_version: '7.3.0' From 05cbf65a03eb2c79a204bfd466933f6052026113 Mon Sep 17 00:00:00 2001 From: Wouter Mellema Date: Thu, 8 Feb 2024 16:50:59 +0100 Subject: [PATCH 320/380] Add python_path to pyvenv class (#686) * Add python_path to pyvenv class Issue #685 - Add: `python_path` variable to `python::pyvenv` * Fixed whitespace issue * Update manifests/pyvenv.pp Co-authored-by: Tim Meusel * Updated reference.md --------- Co-authored-by: Wouter Mellema Co-authored-by: Tim Meusel --- REFERENCE.md | 9 +++++++ manifests/pyvenv.pp | 14 +++++++--- spec/acceptance/pyvenv_spec.rb | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 3c51151b..f3a382e5 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -913,6 +913,7 @@ The following parameters are available in the `python::pyvenv` defined type: * [`path`](#-python--pyvenv--path) * [`environment`](#-python--pyvenv--environment) * [`prompt`](#-python--pyvenv--prompt) +* [`python_path`](#-python--pyvenv--python_path) * [`pip_version`](#-python--pyvenv--pip_version) ##### `ensure` @@ -995,6 +996,14 @@ Optionally specify the virtualenv prompt (python >= 3.6) Default value: `undef` +##### `python_path` + +Data type: `Optional[Stdlib::Absolutepath]` + +Optionally specify python path for creation of virtualenv + +Default value: `undef` + ##### `pip_version` Data type: `Python::Venv::PipVersion` diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 14dcb9fb..5bfc2103 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -11,6 +11,7 @@ # @param path Specifies the PATH variable. # @param environment Optionally specify environment variables for pyvenv # @param prompt Optionally specify the virtualenv prompt (python >= 3.6) +# @param python_path Optionally specify python path for creation of virtualenv # # @example # python::pyvenv { '/var/www/project1' : @@ -34,6 +35,7 @@ Array $environment = [], Optional[String[1]] $prompt = undef, Python::Venv::PipVersion $pip_version = 'latest', + Optional[Stdlib::Absolutepath] $python_path = undef, ) { include python @@ -46,11 +48,17 @@ $python_version_parts = split($python_version, '[.]') $normalized_python_version = sprintf('%s.%s', $python_version_parts[0], $python_version_parts[1]) + $local_exec_prefix = $python_path ? { + undef => $python::exec_prefix, + default => $python_path, + } # pyvenv is deprecated since 3.6 and will be removed in 3.8 - if versioncmp($normalized_python_version, '3.6') >=0 { - $virtualenv_cmd = "${python::exec_prefix}python${normalized_python_version} -m venv" + if $python_path != undef { + $virtualenv_cmd = "${python_path} -m venv" + } elsif versioncmp($normalized_python_version, '3.6') >=0 { + $virtualenv_cmd = "${local_exec_prefix}python${normalized_python_version} -m venv" } else { - $virtualenv_cmd = "${python::exec_prefix}pyvenv-${normalized_python_version}" + $virtualenv_cmd = "${local_exec_prefix}pyvenv-${normalized_python_version}" } $_path = $python::provider ? { diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index 318c2f73..0b20e27f 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -192,4 +192,53 @@ class { 'python': its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } end end + + context 'with versioned minimal python::pip and without systempkgs using custom python path' do + it 'works with no errors' do + pp = <<-PUPPET + + class { 'python': + dev => 'present', + venv => 'present', + } + file { '/usr/bin/mycustompython': + ensure => link, + target => '/usr/bin/python', + } + user { 'agent': + ensure => 'present', + managehome => true, + home => '/opt/agent', + } + group { 'agent': + ensure => 'present', + system => true, + } + python::pyvenv { '/opt/agent/venv': + ensure => 'present', + systempkgs => false, + owner => 'agent', + group => 'agent', + mode => '0755', + pip_version => '<= 20.3.4', + python_path => '/usr/bin/mycustompython', + } + python::pip { 'agent' : + ensure => '0.1.2', + virtualenv => '/opt/agent/venv', + owner => 'agent', + group => 'agent', + } + PUPPET + + # Run it twice and test for idempotency + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) + end + + describe command('/opt/agent/venv/bin/pip list') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match %r{agent.* 0\.1\.2} } + end + end end From 7b2e88a52d39f65f26df6ff8316ea056f8cf7d8c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 8 Feb 2024 16:54:33 +0100 Subject: [PATCH 321/380] Release 7.3.0 --- CHANGELOG.md | 8 ++++++++ metadata.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45b23ed4..51a8fac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v7.3.0](https://github.com/voxpupuli/puppet-python/tree/v7.3.0) (2024-02-08) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.2.0...v7.3.0) + +**Implemented enhancements:** + +- Add python\_path to pyvenv class [\#686](https://github.com/voxpupuli/puppet-python/pull/686) ([wmellema](https://github.com/wmellema)) + ## [v7.2.0](https://github.com/voxpupuli/puppet-python/tree/v7.2.0) (2024-01-01) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.1.0...v7.2.0) diff --git a/metadata.json b/metadata.json index 91338c2d..a83561e2 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.2.1-rc0", + "version": "7.3.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From 68cdefc85754b955a697b4e9a7e1c33f2c14fa95 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 8 Feb 2024 17:18:49 +0100 Subject: [PATCH 322/380] [blacksmith] Bump version to 7.3.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a83561e2..859cc2a4 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.3.0", + "version": "7.3.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From ea485b7c7132b5a5f59e7772f406ef1e59de073c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 Apr 2024 13:45:26 +0200 Subject: [PATCH 323/380] modulesync 7.4.0 --- .github/CONTRIBUTING.md | 16 +++++++++++++--- .gitignore | 2 ++ .msync.yml | 2 +- Dockerfile | 24 ------------------------ 4 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 Dockerfile diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6aaa603f..88093274 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -131,19 +131,29 @@ You can install all needed gems for spec tests into the modules directory by running: ```sh -bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development system_tests release' +bundle install --jobs "$(nproc)" ``` If you also want to run acceptance tests: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" ``` Our all in one solution if you don't know if you need to install or update gems: ```sh -bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +bundle config set --local path '.vendor/' +bundle config set --local without 'development release' +bundle config set --local with 'system_tests' +bundle install --jobs "$(nproc)" +bundle update +bundle clean ``` As an alternative to the `--jobs "$(nproc)` parameter, you can set an diff --git a/.gitignore b/.gitignore index 84fd904c..adea1b01 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,5 @@ .*.sw? /.yardoc/ /Guardfile +bolt-debug.log +.rerun.json diff --git a/.msync.yml b/.msync.yml index f46ee025..28b61dcf 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.3.0' +modulesync_config_version: '7.4.0' diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8dd82d63..00000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# MANAGED BY MODULESYNC -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - -FROM ruby:2.7 - -WORKDIR /opt/puppet - -# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 -RUN mkdir -p /etc/sv - -ARG PUPPET_GEM_VERSION="~> 6.0" -ARG PARALLEL_TEST_PROCESSORS=4 - -# Cache gems -COPY Gemfile . -RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} - -COPY . . - -RUN bundle install -RUN bundle exec rake release_checks - -# Container should not saved -RUN exit 1 From a62eb5225f5b8b46fa2118f1789443c2cd17c4a5 Mon Sep 17 00:00:00 2001 From: markuszilch Date: Thu, 25 Apr 2024 17:23:40 +0200 Subject: [PATCH 324/380] modulesync 7.5.0 --- .msync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.msync.yml b/.msync.yml index 28b61dcf..ade23f9e 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.4.0' +modulesync_config_version: '7.5.0' From 9b214a365449bc63aa822dadfb12ce9546d738a6 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 3 Jun 2024 18:55:41 +0200 Subject: [PATCH 325/380] modulesync 8.0.1 --- .github/workflows/ci.yml | 2 -- .msync.yml | 2 +- .overcommit.yml | 8 +++++--- .rspec | 5 ----- .rspec_parallel | 4 ---- Gemfile | 4 ++-- spec/spec.opts | 6 ------ 7 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 .rspec delete mode 100644 .rspec_parallel delete mode 100644 spec/spec.opts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7216724f..1f82c4c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,5 +19,3 @@ jobs: puppet: name: Puppet uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 - with: - pidfile_workaround: 'false' diff --git a/.msync.yml b/.msync.yml index ade23f9e..876cb3b0 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.5.0' +modulesync_config_version: '8.0.1' diff --git a/.overcommit.yml b/.overcommit.yml index d367adae..4ed994cc 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -43,10 +43,12 @@ PreCommit: enabled: true description: 'Runs rubocop on modified files only' command: ['bundle', 'exec', 'rubocop'] - PuppetLint: + RakeTarget: enabled: true - description: 'Runs puppet-lint on modified files only' - command: ['bundle', 'exec', 'puppet-lint'] + description: 'Runs lint on modified files only' + targets: + - 'lint' + command: ['bundle', 'exec', 'rake'] YamlSyntax: enabled: true JsonSyntax: diff --git a/.rspec b/.rspec deleted file mode 100644 index f634583d..00000000 --- a/.rspec +++ /dev/null @@ -1,5 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format documentation ---color diff --git a/.rspec_parallel b/.rspec_parallel deleted file mode 100644 index a9a84f85..00000000 --- a/.rspec_parallel +++ /dev/null @@ -1,4 +0,0 @@ -# Managed by modulesync - DO NOT EDIT -# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ - ---format progress diff --git a/Gemfile b/Gemfile index a4a3b204..ec7b4cd3 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.0', :require => false + gem 'voxpupuli-test', '~> 7.2', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.5', :require => false + gem 'puppet_metadata', '~> 4.0', :require => false end group :development do diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd6427..00000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace From 0ed8cb8883c7da33f73bc0a402df95589cdda36a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 12 Jun 2024 11:40:28 +0200 Subject: [PATCH 326/380] modulesync 9.0.0 --- .github/labeler.yml | 3 +++ .msync.yml | 2 +- Gemfile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..7899de84 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,3 @@ +--- +skip-changelog: + - head-branch: ['^release-*', 'release'] diff --git a/.msync.yml b/.msync.yml index 876cb3b0..36071685 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '8.0.1' +modulesync_config_version: '9.0.0' diff --git a/Gemfile b/Gemfile index ec7b4cd3..27cdc0de 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 7.2', :require => false + gem 'voxpupuli-test', '~> 8.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false From d20dc731f39af2875ecb91122469ff27d32da90a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 9 Jul 2024 16:19:47 +0200 Subject: [PATCH 327/380] modulesync 9.1.0 --- .github/CONTRIBUTING.md | 12 ++++++++-- .github/labeler.yml | 3 +++ .github/release.yml | 42 +++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 17 ++++++++++++++ .github/workflows/release.yml | 7 ++++++ .msync.yml | 2 +- .puppet-lint.rc | 3 +++ Gemfile | 2 +- spec/spec_helper.rb | 4 ++++ 9 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 .github/release.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 88093274..daceb642 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -245,15 +245,23 @@ with: BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` +or + +```sh +BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker +``` + +This latter example will use the distribution's own version of Puppet. + You can replace the string `debian11` with any common operating system. The following strings are known to work: * ubuntu2004 * ubuntu2204 * debian11 -* centos7 -* centos8 +* debian12 * centos9 +* archlinux * almalinux8 * almalinux9 * fedora36 diff --git a/.github/labeler.yml b/.github/labeler.yml index 7899de84..f2d08d6b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + skip-changelog: - head-branch: ['^release-*', 'release'] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..f5b5d7a9 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,42 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes + +changelog: + exclude: + labels: + - duplicate + - invalid + - modulesync + - question + - skip-changelog + - wont-fix + - wontfix + + categories: + - title: Breaking Changes 🛠 + labels: + - backwards-incompatible + + - title: New Features 🎉 + labels: + - enhancement + + - title: Bug Fixes 🐛 + labels: + - bug + + - title: Documentation Updates 📚 + labels: + - documentation + - docs + + - title: Dependency Updates ⬆️ + labels: + - dependencies + + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..66127cd0 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,17 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: "Pull Request Labeler" + +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55324aa6..93b33c2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,3 +20,10 @@ jobs: # https://docs.github.com/en/actions/security-guides/encrypted-secrets username: ${{ secrets.PUPPET_FORGE_USERNAME }} api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} + + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - name: Create GitHub release + uses: voxpupuli/gha-create-a-github-release@v1 diff --git a/.msync.yml b/.msync.yml index 36071685..95e8c977 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.0.0' +modulesync_config_version: '9.1.0' diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 558d766b..420e819f 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,2 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --fail-on-warnings --no-parameter_documentation-check diff --git a/Gemfile b/Gemfile index 27cdc0de..7123c663 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 8.0', :require => false + gem 'voxpupuli-test', '~> 9.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 4.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9efb4ae6..58c9b66a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,6 +9,10 @@ require 'voxpupuli/test/spec_helper' +RSpec.configure do |c| + c.facterdb_string_keys = false +end + add_mocked_facts! if File.exist?(File.join(__dir__, 'default_module_facts.yml')) From c5d0e96f1f14d344dcefb7345673c8280fa2c6ac Mon Sep 17 00:00:00 2001 From: acojocariu1-godaddy <157803439+acojocariu1-godaddy@users.noreply.github.com> Date: Mon, 19 Aug 2024 14:49:05 +0300 Subject: [PATCH 328/380] use valid, but highly unlikely package version --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a7ee7a2f..25856fc7 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -219,7 +219,7 @@ # more than one line with paretheses. $latest_version = join([ "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", - " ${install_args} ${install_editable} ${real_pkgname}==notreallyaversion 2>&1", + " ${install_args} ${install_editable} '${real_pkgname}==9!0dev0+x' 2>&1", " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", ' | tr -d "[:space:]"', ]) From 1808a344e78e4e04ca801e39aea79763360ba53f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Aug 2024 10:05:27 +0200 Subject: [PATCH 329/380] Drop EoL Ubuntu 18.04 --- metadata.json | 1 - 1 file changed, 1 deletion(-) diff --git a/metadata.json b/metadata.json index 859cc2a4..f3dce6c4 100644 --- a/metadata.json +++ b/metadata.json @@ -57,7 +57,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "18.04", "20.04", "22.04" ] From 5f3ee5fcf2e012730fc54b3b390511207e61a59a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 21 Jun 2024 17:39:57 -1000 Subject: [PATCH 330/380] Add support for FreeBSD 14 --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 859cc2a4..705e0fe3 100644 --- a/metadata.json +++ b/metadata.json @@ -48,7 +48,8 @@ "operatingsystemrelease": [ "11", "12", - "13" + "13", + "14" ] }, { From b51d643f4b0a3ff1c72a2600578b9a0f6ca3268d Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sun, 1 Aug 2021 15:39:20 +0200 Subject: [PATCH 331/380] simplify packages version detection --- manifests/pip.pp | 17 +++++++++-------- spec/acceptance/pip_spec.rb | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 25856fc7..eaada706 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -155,11 +155,13 @@ $_ensure = $ensure } - # Check if searching by explicit version. - if $_ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/ { - $grep_regex = "^${real_pkgname}[[:space:]]\\+(\\?${_ensure}\\()$\\|$\\|, \\|[[:space:]]\\)" - } else { - $grep_regex = "^${real_pkgname}[[:space:]].*$" + # We do not try to mimic a version scheme validation which is already implemented by the package manager. + # If it starts with a number it is probably a version. + # If it wasn't or if there is any error, the package manager will trigger a failure. + $grep_regex = $_ensure ? { + /^(present|absent|latest)$/ => "^${real_pkgname}[[:space:]].*$", + /^[0-9].*$/ => "^${real_pkgname}[[:space:]]\\+(\\?${_ensure}\\()$\\|$\\|, \\|[[:space:]]\\)", + default => fail('ensure can be a version number or one of: present, absent, latest') } $extras_string = empty($extras) ? { @@ -193,9 +195,8 @@ } } else { case $_ensure { - /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.\w+\+?\w*(\.\w+)*)$/: { - # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes - # Explicit version. + /^[0-9].*$/: { + # Specific version $command = "${pip_install} ${install_args} ${pip_common_args}==${_ensure}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" } diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index 9da96bef..5b64c6de 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -74,6 +74,37 @@ class { 'python': its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} } end + context 'fails to install package with wrong version' do + it 'throws an error' do + pp = <<-PUPPET + class { 'python': + version => '3', + dev => 'present', + } + + python::pyvenv { '/opt/test-venv': + ensure => 'present', + systempkgs => false, + mode => '0755', + pip_version => '<= 20.3.4', + } + + python::pip { 'agent package': + virtualenv => '/opt/test-venv', + pkgname => 'agent', + ensure => '0.1.33+2020-this_is_something-fun', + } + PUPPET + + result = apply_manifest(pp, expect_failures: true) + expect(result.stderr).to contain(%r{returned 1 instead of one of}) + end + end + + describe command('/opt/test-venv/bin/pip show agent') do + its(:exit_status) { is_expected.to eq 1 } + end + context 'install package via extra_index' do it 'works with no errors' do pp = <<-PUPPET From 4a2b2848bdc6a62d6b9be0d55f8ad0803a34464e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2024 15:37:32 +0100 Subject: [PATCH 332/380] pyvenv:: Harden datatype for $environment --- REFERENCE.md | 2 +- manifests/pyvenv.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index f3a382e5..d690f047 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -982,7 +982,7 @@ Default value: `['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',]` ##### `environment` -Data type: `Array` +Data type: `Array[String[1]]` Optionally specify environment variables for pyvenv diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 5bfc2103..33b37100 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -32,7 +32,7 @@ String[1] $group = 'root', Stdlib::Filemode $mode = '0755', Array[Stdlib::Absolutepath] $path = ['/bin', '/usr/bin', '/usr/sbin', '/usr/local/bin',], - Array $environment = [], + Array[String[1]] $environment = [], Optional[String[1]] $prompt = undef, Python::Venv::PipVersion $pip_version = 'latest', Optional[Stdlib::Absolutepath] $python_path = undef, From d6bc593245b779dfd5b7f519187decce2289e074 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2024 21:33:38 +0100 Subject: [PATCH 333/380] CI: Dont pin pip to an outdated version --- spec/acceptance/pip_spec.rb | 4 ---- spec/acceptance/pyvenv_spec.rb | 6 ------ 2 files changed, 10 deletions(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index 5b64c6de..4c4af6cf 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -14,7 +14,6 @@ class { 'python': ensure => 'present', systempkgs => false, mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent package': @@ -47,7 +46,6 @@ class { 'python': ensure => 'present', systempkgs => false, mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent package install': @@ -86,7 +84,6 @@ class { 'python': ensure => 'present', systempkgs => false, mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent package': @@ -116,7 +113,6 @@ class { 'python': ensure => 'present', systempkgs => false, mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent package via extra_index': diff --git a/spec/acceptance/pyvenv_spec.rb b/spec/acceptance/pyvenv_spec.rb index 0b20e27f..263e4a40 100644 --- a/spec/acceptance/pyvenv_spec.rb +++ b/spec/acceptance/pyvenv_spec.rb @@ -26,7 +26,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', } PUPPET @@ -58,7 +57,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent' : ensure => 'latest', @@ -98,7 +96,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent' : virtualenv => '/opt/agent/venv', @@ -135,7 +132,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent' : virtualenv => '/opt/agent/venv', @@ -172,7 +168,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', } python::pip { 'agent' : ensure => '0.1.2', @@ -220,7 +215,6 @@ class { 'python': owner => 'agent', group => 'agent', mode => '0755', - pip_version => '<= 20.3.4', python_path => '/usr/bin/mycustompython', } python::pip { 'agent' : From cad5b1b86ae028dbe5f6590aba43aaaf3df440d7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 26 Nov 2024 21:56:34 +0100 Subject: [PATCH 334/380] CI: Dont set python version --- spec/acceptance/pip_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/acceptance/pip_spec.rb b/spec/acceptance/pip_spec.rb index 4c4af6cf..83a639fa 100644 --- a/spec/acceptance/pip_spec.rb +++ b/spec/acceptance/pip_spec.rb @@ -76,8 +76,7 @@ class { 'python': it 'throws an error' do pp = <<-PUPPET class { 'python': - version => '3', - dev => 'present', + dev => 'present', } python::pyvenv { '/opt/test-venv': From a0cf00fe8c5c235bed5e9e41de78af5ab7c75f09 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 13 Sep 2024 14:53:59 +0200 Subject: [PATCH 335/380] modulesync 9.2.0 --- .github/workflows/ci.yml | 3 ++- .github/workflows/labeler.yml | 1 + .github/workflows/release.yml | 1 + .msync.yml | 2 +- .pmtignore | 1 + Gemfile | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1f82c4c9..8c32acf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,6 +4,7 @@ name: CI +# yamllint disable-line rule:truthy on: pull_request: {} push: @@ -18,4 +19,4 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 66127cd0..73be88dc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -4,6 +4,7 @@ name: "Pull Request Labeler" +# yamllint disable-line rule:truthy on: pull_request_target: {} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 93b33c2b..1b147750 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ name: Release +# yamllint disable-line rule:truthy on: push: tags: diff --git a/.msync.yml b/.msync.yml index 95e8c977..8606f6ec 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.1.0' +modulesync_config_version: '9.2.0' diff --git a/.pmtignore b/.pmtignore index 10b98306..a9d37aa0 100644 --- a/.pmtignore +++ b/.pmtignore @@ -20,6 +20,7 @@ /.github/ /.librarian/ /Puppetfile.lock +/Puppetfile *.iml /.editorconfig /.fixtures.yml diff --git a/Gemfile b/Gemfile index 7123c663..2ac98f89 100644 --- a/Gemfile +++ b/Gemfile @@ -26,7 +26,7 @@ end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' +puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From a2a473d00f74996f78ee42b3c7f12b3fa664000b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 16 Sep 2024 20:59:49 +0200 Subject: [PATCH 336/380] modulesync 9.3.0 --- .github/workflows/release.yml | 2 +- .msync.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b147750..4adf65cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index 8606f6ec..ac84b45d 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.2.0' +modulesync_config_version: '9.3.0' From 8387705f9f4da8ab8eae7aaaa73a87f9bcb4182f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 27 Nov 2024 09:23:09 +0100 Subject: [PATCH 337/380] Add Ubuntu 24.04 support --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 705e0fe3..838a59f9 100644 --- a/metadata.json +++ b/metadata.json @@ -60,7 +60,8 @@ "operatingsystemrelease": [ "18.04", "20.04", - "22.04" + "22.04", + "24.04" ] }, { From 6615ab8ec4511f084be8b60ec6176222496318b4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 21 Aug 2024 10:16:11 +0200 Subject: [PATCH 338/380] Release 7.4.0 --- CHANGELOG.md | 24 ++++++++++++++++++++++-- metadata.json | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a8fac3..9e72c8e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v7.4.0](https://github.com/voxpupuli/puppet-python/tree/v7.4.0) (2024-11-27) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.3.0...v7.4.0) + +**Implemented enhancements:** + +- Add Ubuntu 24.04 support [\#707](https://github.com/voxpupuli/puppet-python/pull/707) ([bastelfreak](https://github.com/bastelfreak)) +- pyvenv: Harden datatype for `$environment` [\#704](https://github.com/voxpupuli/puppet-python/pull/704) ([bastelfreak](https://github.com/bastelfreak)) +- simplify packages version detection [\#703](https://github.com/voxpupuli/puppet-python/pull/703) ([maxadamo](https://github.com/maxadamo)) +- Add support for FreeBSD 14 [\#694](https://github.com/voxpupuli/puppet-python/pull/694) ([smortex](https://github.com/smortex)) + +**Fixed bugs:** + +- `python::pip`'s `notreallyaversion` is not compatible with latest `pip` \(\>= 24.1\) due to changed output \(again\) [\#695](https://github.com/voxpupuli/puppet-python/issues/695) +- Fix `python::pip` - use valid, but highly unlikely package version [\#696](https://github.com/voxpupuli/puppet-python/pull/696) ([acojocariu1-godaddy](https://github.com/acojocariu1-godaddy)) + +**Merged pull requests:** + +- CI: Dont pin pip to an outdated version and don't force python3 package installation [\#706](https://github.com/voxpupuli/puppet-python/pull/706) ([bastelfreak](https://github.com/bastelfreak)) + ## [v7.3.0](https://github.com/voxpupuli/puppet-python/tree/v7.3.0) (2024-02-08) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.2.0...v7.3.0) @@ -293,7 +313,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge - Allow HTTP\_PROXY on bootstrap. [\#488](https://github.com/voxpupuli/puppet-python/pull/488) ([pillarsdotnet](https://github.com/pillarsdotnet)) - Modern pip can install wheels without wheel installed [\#483](https://github.com/voxpupuli/puppet-python/pull/483) ([asottile](https://github.com/asottile)) -- Allow arbitrary pip providers [\#480](https://github.com/voxpupuli/puppet-python/pull/480) ([ethanhs](https://github.com/ethanhs)) +- Allow arbitrary pip providers [\#480](https://github.com/voxpupuli/puppet-python/pull/480) ([emmatyping](https://github.com/emmatyping)) - Add manage\_scl boolean to control managing SCL [\#464](https://github.com/voxpupuli/puppet-python/pull/464) ([bodgit](https://github.com/bodgit)) - Allow pip to work in AIX systems [\#461](https://github.com/voxpupuli/puppet-python/pull/461) ([feltra](https://github.com/feltra)) - move pip bootstrap into a seperate class [\#460](https://github.com/voxpupuli/puppet-python/pull/460) ([feltra](https://github.com/feltra)) @@ -631,7 +651,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge - Revert "Update virtualenv\_version.rb" [\#267](https://github.com/voxpupuli/puppet-python/pull/267) ([shivapoudel](https://github.com/shivapoudel)) - Update virtualenv\_version.rb [\#265](https://github.com/voxpupuli/puppet-python/pull/265) ([shivapoudel](https://github.com/shivapoudel)) - Update params.pp [\#263](https://github.com/voxpupuli/puppet-python/pull/263) ([philippeback](https://github.com/philippeback)) -- Bug virtualenv instead of virtualenv-$version [\#261](https://github.com/voxpupuli/puppet-python/pull/261) ([Asher256](https://github.com/Asher256)) +- Bug virtualenv instead of virtualenv-$version [\#261](https://github.com/voxpupuli/puppet-python/pull/261) ([ghost](https://github.com/ghost)) - Addressing stankevich/puppet-python issue \#258. [\#260](https://github.com/voxpupuli/puppet-python/pull/260) ([rpocase](https://github.com/rpocase)) ## [1.10.0](https://github.com/voxpupuli/puppet-python/tree/1.10.0) (2015-10-29) diff --git a/metadata.json b/metadata.json index 838a59f9..59ff7f08 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.3.1-rc0", + "version": "7.4.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From a775c6c70806e894355c992da14651c8cfc3cda4 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 27 Nov 2024 09:51:15 +0100 Subject: [PATCH 339/380] [blacksmith] Bump version to 7.4.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 59ff7f08..c7b6d37a 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.4.0", + "version": "7.4.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From b50bf95b6703700a4e21ae87c1bc9204ec1e5854 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 27 Nov 2024 09:51:44 +0100 Subject: [PATCH 340/380] Drop EoL Debian 10 support --- manifests/install.pp | 2 +- metadata.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index c3db3d80..e1fc22e4 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -230,7 +230,7 @@ } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) { $pip_package = 'python3-pip' $pip_provider = 'pip3' - } elsif ($facts['os']['name'] == 'Debian') and (versioncmp($facts['os']['release']['major'], '11') >= 0) { + } elsif $facts['os']['name'] == 'Debian' { $pip_package = 'python3-pip' $pip_provider = 'pip3' } else { diff --git a/metadata.json b/metadata.json index c7b6d37a..c3cd8010 100644 --- a/metadata.json +++ b/metadata.json @@ -38,7 +38,6 @@ { "operatingsystem": "Debian", "operatingsystemrelease": [ - "10", "11", "12" ] From de7d06e16f1d5688c38f0cdd065525d46728c79f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 27 Nov 2024 10:10:58 +0100 Subject: [PATCH 341/380] Drop EoL CentOS 7/8 support --- manifests/install.pp | 5 +-- metadata.json | 2 -- spec/classes/python_spec.rb | 70 ------------------------------------- 3 files changed, 1 insertion(+), 76 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index e1fc22e4..c8a279c1 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -215,12 +215,9 @@ if String($python::version) =~ /^python3/ { $pip_package = "${python}-pip" $pip_provider = $python.regsubst(/^.*python3\.?/,'pip3.').regsubst(/\.$/,'') - } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '8') >= 0) { + } elsif $facts['os']['family'] == 'RedHat' { $pip_package = 'python3-pip' $pip_provider = pip3 - } elsif ($facts['os']['family'] == 'RedHat') and (versioncmp($facts['os']['release']['major'], '7') >= 0) { - $pip_package = 'python2-pip' - $pip_provider = pip2 } elsif $facts['os']['family'] == 'FreeBSD' { $pip_package = "py${python::version}-pip" $pip_provider = 'pip' diff --git a/metadata.json b/metadata.json index c3cd8010..80d0d684 100644 --- a/metadata.json +++ b/metadata.json @@ -30,8 +30,6 @@ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7", - "8", "9" ] }, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 54c47fc7..fd39b26d 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -265,76 +265,6 @@ end when 'RedHat', 'CentOS' case facts[:os]['release']['major'] - when '7' - - context 'on a Redhat 7 OS' do - it { is_expected.to contain_class('python::install') } - it { is_expected.to contain_package('pip').with_name('python2-pip') } - - describe 'with python::version' do - context 'python36' do - let(:params) { { version: 'python36' } } - - it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_package('pip').with_name('python36-pip') } - it { is_expected.to contain_package('python').with_name('python36') } - it { is_expected.to contain_package('python-dev').with_name('python36-devel') } - end - end - - describe 'with manage_gunicorn' do - context 'true' do - let(:params) { { manage_gunicorn: true } } - - it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } - end - - context 'empty args' do - # let(:params) {{ :manage_gunicorn => '' }} - it { is_expected.to contain_package('gunicorn').with_name('python-gunicorn') } - end - - context 'false' do - let(:params) { { manage_gunicorn: false } } - - it { is_expected.not_to contain_package('gunicorn') } - end - end - - describe 'with python::provider' do - context 'scl' do - describe 'with version' do - context '3.6 SCL meta package' do - let(:params) { { version: 'rh-python36' } } - - it { is_expected.to compile.with_all_deps } - end - - context '3.6 SCL python package' do - let(:params) { { version: 'rh-python36-python' } } - - it { is_expected.to compile.with_all_deps } - end - end - - describe 'with manage_scl' do - context 'true' do - let(:params) { { provider: 'scl', manage_scl: true } } - - it { is_expected.to contain_package('centos-release-scl') } - it { is_expected.to contain_package('scl-utils') } - end - - context 'false' do - let(:params) { { provider: 'scl', manage_scl: false } } - - it { is_expected.not_to contain_package('centos-release-scl') } - it { is_expected.not_to contain_package('scl-utils') } - end - end - end - end - end when '8' context 'on a Redhat 8 OS' do it { is_expected.to contain_class('python::install') } From 1ea8281d5fe466dcc452e0bf13fece55a2bec002 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 5 Feb 2025 10:36:40 +0100 Subject: [PATCH 342/380] modulesync 9.4.0 --- .github/workflows/prepare_release.yml | 23 +++++++++++++++++++++++ .github/workflows/release.yml | 7 ------- .msync.yml | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/prepare_release.yml diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml new file mode 100644 index 00000000..01efa1a8 --- /dev/null +++ b/.github/workflows/prepare_release.yml @@ -0,0 +1,23 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: 'Prepare Release' + +on: + workflow_dispatch: + inputs: + version: + description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' + required: false + +jobs: + release_prep: + uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' + with: + version: ${{ github.event.inputs.version }} + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4adf65cd..3db60fbc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,10 +21,3 @@ jobs: # https://docs.github.com/en/actions/security-guides/encrypted-secrets username: ${{ secrets.PUPPET_FORGE_USERNAME }} api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} - - create-github-release: - name: Create GitHub Release - runs-on: ubuntu-latest - steps: - - name: Create GitHub release - uses: voxpupuli/gha-create-a-github-release@v1 diff --git a/.msync.yml b/.msync.yml index ac84b45d..36e892e9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.3.0' +modulesync_config_version: '9.4.0' From 44d77b110e52697352de3ddba263e30f8ffdfd1f Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Wed, 19 Mar 2025 13:29:41 +0000 Subject: [PATCH 343/380] modulesync 9.5.0-4-g2cf9dc0 --- .msync.yml | 2 +- Gemfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.msync.yml b/.msync.yml index 36e892e9..32df814c 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.4.0' +modulesync_config_version: '9.5.0' diff --git a/Gemfile b/Gemfile index 2ac98f89..ea079b08 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 9.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 4.0', :require => false + gem 'puppet_metadata', '~> 5.0', :require => false end group :development do @@ -16,7 +16,7 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 3.0', :require => false + gem 'voxpupuli-acceptance', '~> 3.5', :require => false end group :release do From 81daea252076379ab869761040f0c86bbc9e7488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 24 Apr 2025 11:11:07 -1000 Subject: [PATCH 344/380] Add a unit test to illustrate the pyvenv bootstrap issue This module that manage python needs python to be installed in order to work properly under certain conditions. When python is not installed on a node, the python_version fact does not have a value. When using `python::pyvenv` on such a system without a specific version set, a call of the split() function on this unde value cause an error te be raised: ``` Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, The function 'split' was called with arguments it does not accept. It expects one of: (String str, String pattern) rejected: parameter 'str' expects a String value, got Undef (String str, Regexp pattern) rejected: parameter 'str' expects a String value, got Undef (String str, Type[Regexp] pattern) rejected: parameter 'str' expects a String value, got Undef (Sensitive[String] sensitive, String pattern) rejected: parameter 'sensitive' expects a Sensitive[String] value, got Undef (Sensitive[String] sensitive, Regexp pattern) rejected: parameter 'sensitive' expects a Sensitive[String] value, got Undef (Sensitive[String] sensitive, Type[Regexp] pattern) rejected: parameter 'sensitive' expects a Sensitive[String] value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/python/manifests/pyvenv.pp, line: 48, column: 34) (file: /etc/puppetlabs/code/environments/production/modules/taiga/manifests/back/install.pp, line: 15) on node debian12-64-puppet7.example.com ``` --- spec/defines/pyvenv_spec.rb | 125 ++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index ba49fb37..b0578bec 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -6,83 +6,94 @@ on_supported_os.each do |os, facts| next if os == 'gentoo-3-x86_64' + let :title do + '/opt/env' + end + context "on #{os}" do - let :facts do - # python3 is required to use pyvenv - facts.merge( - python3_version: '3.5.1' - ) - end - let :title do - '/opt/env' + context 'with default parameters' do + let :facts do + facts + end + + it { is_expected.to compile } end - context 'with default parameters' do - it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } + context 'with a specific python3 version' do + let :facts do + # python3 is required to use pyvenv + facts.merge( + python3_version: '3.5.1' + ) + end + + context 'with default parameters' do + it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } + end + + describe 'when ensure' do + context 'is absent' do + let :params do + { + ensure: 'absent' + } + end + + it { + expect(subject).to contain_file('/opt/env').with_ensure('absent').with_purge(true) + } + end + end end - describe 'when ensure' do - context 'is absent' do + context "prompt on #{os} with python 3.6" do + let :facts do + # python 3.6 is required for venv and prompt + facts.merge( + python3_version: '3.6.1' + ) + end + let :title do + '/opt/env' + end + + context 'with prompt' do let :params do { - ensure: 'absent' + prompt: 'custom prompt', } end it { - expect(subject).to contain_file('/opt/env').with_ensure('absent').with_purge(true) + is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('python3.6 -m venv --clear --prompt custom\\ prompt /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } end end - end - context "prompt on #{os} with python 3.6" do - let :facts do - # python 3.6 is required for venv and prompt - facts.merge( - python3_version: '3.6.1' - ) - end - let :title do - '/opt/env' - end - - context 'with prompt' do - let :params do - { - prompt: 'custom prompt', - } + context "prompt on #{os} with python 3.5" do + let :facts do + facts.merge( + python3_version: '3.5.1' + ) + end + let :title do + '/opt/env' end - it { - is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('python3.6 -m venv --clear --prompt custom\\ prompt /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') - } - end - end - - context "prompt on #{os} with python 3.5" do - let :facts do - facts.merge( - python3_version: '3.5.1' - ) - end - let :title do - '/opt/env' - end + context 'with prompt' do + let :params do + { + prompt: 'custom prompt', + } + end - context 'with prompt' do - let :params do - { - prompt: 'custom prompt', + it { + is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } end - - it { - is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') - } end end end From 9ad7d6758197ce6df762e93ead1a65670942f5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Thu, 24 Apr 2025 12:00:02 -1000 Subject: [PATCH 345/380] Add fallback on the default system version of Python When Python is not installed, the python_version fact is undef, but we need to know which version of Python is going to be installed by the module in order to use the proper command invocation for building virtual envs. This issue only occurs when the user use the system version of Python, so add the default version of Python for supported operating systems into Hiera and use that as a fallback when the version of Python is unknown. --- REFERENCE.md | 7 +++++++ data/common.yaml | 1 + data/os/Archlinux.yaml | 1 + data/os/Debian/11.yaml | 1 + data/os/Debian/12.yaml | 1 + data/os/FreeBSD.yaml | 1 + data/os/Gentoo.yaml | 1 + data/os/RedHat/8.yaml | 1 + data/os/RedHat/9.yaml | 1 + data/os/Ubuntu/20.04.yaml | 1 + data/os/Ubuntu/22.04.yaml | 1 + data/os/Ubuntu/24.04.yaml | 1 + hiera.yaml | 23 +++++++++++++++++++++++ manifests/init.pp | 2 ++ manifests/pyvenv.pp | 2 +- 15 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 data/common.yaml create mode 100644 data/os/Archlinux.yaml create mode 100644 data/os/Debian/11.yaml create mode 100644 data/os/Debian/12.yaml create mode 100644 data/os/FreeBSD.yaml create mode 100644 data/os/Gentoo.yaml create mode 100644 data/os/RedHat/8.yaml create mode 100644 data/os/RedHat/9.yaml create mode 100644 data/os/Ubuntu/20.04.yaml create mode 100644 data/os/Ubuntu/22.04.yaml create mode 100644 data/os/Ubuntu/24.04.yaml create mode 100644 hiera.yaml diff --git a/REFERENCE.md b/REFERENCE.md index d690f047..4352dd43 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -67,6 +67,7 @@ class { 'python' : The following parameters are available in the `python` class: +* [`default_system_version`](#-python--default_system_version) * [`ensure`](#-python--ensure) * [`version`](#-python--version) * [`pip`](#-python--pip) @@ -92,6 +93,12 @@ The following parameters are available in the `python` class: * [`anaconda_installer_url`](#-python--anaconda_installer_url) * [`anaconda_install_path`](#-python--anaconda_install_path) +##### `default_system_version` + +Data type: `Python::Version` + +The default version of Python provided by the operating system. Only used as a fallback if Python is not installed yet to determine how to handle some actions that vary depending on the Python version used. + ##### `ensure` Data type: `Python::Package::Ensure` diff --git a/data/common.yaml b/data/common.yaml new file mode 100644 index 00000000..8d945465 --- /dev/null +++ b/data/common.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.11" diff --git a/data/os/Archlinux.yaml b/data/os/Archlinux.yaml new file mode 100644 index 00000000..3bd58ed5 --- /dev/null +++ b/data/os/Archlinux.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.13" diff --git a/data/os/Debian/11.yaml b/data/os/Debian/11.yaml new file mode 100644 index 00000000..c3b18ece --- /dev/null +++ b/data/os/Debian/11.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.9" diff --git a/data/os/Debian/12.yaml b/data/os/Debian/12.yaml new file mode 100644 index 00000000..8d945465 --- /dev/null +++ b/data/os/Debian/12.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.11" diff --git a/data/os/FreeBSD.yaml b/data/os/FreeBSD.yaml new file mode 100644 index 00000000..8d945465 --- /dev/null +++ b/data/os/FreeBSD.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.11" diff --git a/data/os/Gentoo.yaml b/data/os/Gentoo.yaml new file mode 100644 index 00000000..68b52939 --- /dev/null +++ b/data/os/Gentoo.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.12" diff --git a/data/os/RedHat/8.yaml b/data/os/RedHat/8.yaml new file mode 100644 index 00000000..5de86ac2 --- /dev/null +++ b/data/os/RedHat/8.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.6" diff --git a/data/os/RedHat/9.yaml b/data/os/RedHat/9.yaml new file mode 100644 index 00000000..c3b18ece --- /dev/null +++ b/data/os/RedHat/9.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.9" diff --git a/data/os/Ubuntu/20.04.yaml b/data/os/Ubuntu/20.04.yaml new file mode 100644 index 00000000..20aa9c3e --- /dev/null +++ b/data/os/Ubuntu/20.04.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.8" diff --git a/data/os/Ubuntu/22.04.yaml b/data/os/Ubuntu/22.04.yaml new file mode 100644 index 00000000..383744c0 --- /dev/null +++ b/data/os/Ubuntu/22.04.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.10" diff --git a/data/os/Ubuntu/24.04.yaml b/data/os/Ubuntu/24.04.yaml new file mode 100644 index 00000000..68b52939 --- /dev/null +++ b/data/os/Ubuntu/24.04.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.12" diff --git a/hiera.yaml b/hiera.yaml new file mode 100644 index 00000000..9cea3e4d --- /dev/null +++ b/hiera.yaml @@ -0,0 +1,23 @@ +--- +version: 5 + +defaults: # Used for any hierarchy level that omits these keys. + datadir: data # This path is relative to hiera.yaml's directory. + data_hash: yaml_data # Use the built-in YAML backend. + +hierarchy: + - name: "archicture" + paths: + - "architecture/%{facts.os.architecture}.yaml" + - "architecture/common.yaml" + - name: "osfamily/major release" + paths: + - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" # Used to distinguish between Debian and Ubuntu + - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" # + - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" # Used for Solaris + - name: "osfamily" + paths: + - "os/%{facts.os.name}.yaml" + - "os/%{facts.os.family}.yaml" + - name: 'common' + path: 'common.yaml' diff --git a/manifests/init.pp b/manifests/init.pp index b457edbd..3f5ac23f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,5 +1,6 @@ # @summary Installs and manages python, python-dev and gunicorn. # +# @param default_system_version The default version of Python provided by the operating system. Only used as a fallback if Python is not installed yet to determine how to handle some actions that vary depending on the Python version used. # @param ensure Desired installation state for the Python package. # @param version Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using. # Allowed values: @@ -38,6 +39,7 @@ # } # class python ( + Python::Version $default_system_version, Python::Package::Ensure $ensure = 'present', Python::Version $version = $facts['os']['family'] ? { 'Archlinux' => 'system', default => '3' }, Python::Package::Ensure $pip = 'present', diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 33b37100..6627a406 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -41,7 +41,7 @@ if $ensure == 'present' { $python_version = $version ? { - 'system' => $facts['python3_version'], + 'system' => $facts['python3_version'].lest || { $python::default_system_version }, default => $version, } From a2723a8137503802848d475fb7f37f0904e8cb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 28 Apr 2025 08:30:01 -1000 Subject: [PATCH 346/380] Drop EoL FreeBSD 11/12 support --- metadata.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/metadata.json b/metadata.json index b061ee01..29bec65c 100644 --- a/metadata.json +++ b/metadata.json @@ -43,8 +43,6 @@ { "operatingsystem": "FreeBSD", "operatingsystemrelease": [ - "11", - "12", "13", "14" ] From 9e110c9382999d16bc0a5cdaea0120541ff502d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 28 Apr 2025 08:32:05 -1000 Subject: [PATCH 347/380] Drop EoL Ubuntu 20.04 support --- data/os/Ubuntu/20.04.yaml | 1 - manifests/install.pp | 2 +- metadata.json | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 data/os/Ubuntu/20.04.yaml diff --git a/data/os/Ubuntu/20.04.yaml b/data/os/Ubuntu/20.04.yaml deleted file mode 100644 index 20aa9c3e..00000000 --- a/data/os/Ubuntu/20.04.yaml +++ /dev/null @@ -1 +0,0 @@ -python::default_system_version: "3.8" diff --git a/manifests/install.pp b/manifests/install.pp index c8a279c1..60adfc05 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -224,7 +224,7 @@ } elsif $facts['os']['family'] == 'Gentoo' { $pip_package = 'dev-python/pip' $pip_provider = 'pip' - } elsif ($facts['os']['name'] == 'Ubuntu') and (versioncmp($facts['os']['release']['major'], '20.04') >= 0) { + } elsif $facts['os']['name'] == 'Ubuntu' { $pip_package = 'python3-pip' $pip_provider = 'pip3' } elsif $facts['os']['name'] == 'Debian' { diff --git a/metadata.json b/metadata.json index b061ee01..32d855ee 100644 --- a/metadata.json +++ b/metadata.json @@ -55,7 +55,6 @@ { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "20.04", "22.04", "24.04" ] From a476028061e90e3c39d5f2bb9529feb22cdc1b42 Mon Sep 17 00:00:00 2001 From: Release Automation Date: Mon, 28 Apr 2025 19:15:07 +0000 Subject: [PATCH 348/380] Release 8.0.0 --- CHANGELOG.md | 18 +++++++++++++++++- metadata.json | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e72c8e2..6a4c996b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v8.0.0](https://github.com/voxpupuli/puppet-python/tree/v8.0.0) (2025-04-28) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.4.0...v8.0.0) + +**Breaking changes:** + +- Drop EoL Ubuntu 20.04 support [\#719](https://github.com/voxpupuli/puppet-python/pull/719) ([smortex](https://github.com/smortex)) +- Drop EoL FreeBSD 11/12 support [\#718](https://github.com/voxpupuli/puppet-python/pull/718) ([smortex](https://github.com/smortex)) +- Drop EoL Ubuntu 18.04 support [\#710](https://github.com/voxpupuli/puppet-python/pull/710) ([bastelfreak](https://github.com/bastelfreak)) +- Drop EoL CentOS 7/8 support [\#709](https://github.com/voxpupuli/puppet-python/pull/709) ([bastelfreak](https://github.com/bastelfreak)) +- Drop EoL Debian 10 support [\#708](https://github.com/voxpupuli/puppet-python/pull/708) ([bastelfreak](https://github.com/bastelfreak)) + +**Fixed bugs:** + +- Fix bootstrapping `python::pyvenv` when Python is not installed [\#716](https://github.com/voxpupuli/puppet-python/pull/716) ([smortex](https://github.com/smortex)) + ## [v7.4.0](https://github.com/voxpupuli/puppet-python/tree/v7.4.0) (2024-11-27) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.3.0...v7.4.0) @@ -78,7 +94,7 @@ These should not affect the functionality of the module. **Fixed bugs:** -- Fix pip installation on Gentoo [\#651](https://github.com/voxpupuli/puppet-python/pull/651) ([jameslikeslinux](https://github.com/jameslikeslinux)) +- Fix pip installation on Gentoo [\#651](https://github.com/voxpupuli/puppet-python/pull/651) ([puppetjoy](https://github.com/puppetjoy)) ## [v6.4.0](https://github.com/voxpupuli/puppet-python/tree/v6.4.0) (2022-11-06) diff --git a/metadata.json b/metadata.json index 68aece65..4f3a512e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "7.4.1-rc0", + "version": "8.0.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From dfef775dff983d3ddb3193882a7e3c0ed38ee161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 28 Apr 2025 09:33:02 -1000 Subject: [PATCH 349/380] [blacksmith] Bump version to 8.0.1-rc0 --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 4f3a512e..7f19e856 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "8.0.0", + "version": "8.0.1-rc0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0", From e546675e5551919a6349e35766af3c36e7639f77 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Wed, 28 May 2025 15:49:05 +0000 Subject: [PATCH 350/380] modulesync 9.6.0-4-gdb4d91b --- .msync.yml | 2 +- Gemfile | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.msync.yml b/.msync.yml index 32df814c..b86acb82 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.5.0' +modulesync_config_version: '9.7.0' diff --git a/Gemfile b/Gemfile index ea079b08..f08ae17f 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 9.0', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false + gem 'voxpupuli-test', '~> 10.0', :require => false gem 'puppet_metadata', '~> 5.0', :require => false end From 35c08b78cf62cd2daf878a55752dc25a3b297d94 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Fri, 13 Jun 2025 07:11:52 +0000 Subject: [PATCH 351/380] modulesync 9.7.0-10-g2151f5f --- .github/workflows/ci.yml | 3 +++ .github/workflows/labeler.yml | 4 ++++ .github/workflows/prepare_release.yml | 4 ++++ .github/workflows/release.yml | 3 +++ .msync.yml | 2 +- Gemfile | 8 +++----- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c32acf9..44674150 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ concurrency: group: ${{ github.ref_name }} cancel-in-progress: true +permissions: + contents: read + jobs: puppet: name: Puppet diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 73be88dc..eacd0b33 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -8,6 +8,10 @@ name: "Pull Request Labeler" on: pull_request_target: {} +permissions: + contents: read + pull-requests: write + jobs: labeler: permissions: diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml index 01efa1a8..2e3cc689 100644 --- a/.github/workflows/prepare_release.yml +++ b/.github/workflows/prepare_release.yml @@ -11,6 +11,10 @@ on: description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' required: false +permissions: + contents: write + pull-requests: write + jobs: release_prep: uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3db60fbc..0a8b1b18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,9 @@ on: tags: - '*' +permissions: + contents: write + jobs: release: name: Release diff --git a/.msync.yml b/.msync.yml index b86acb82..af9a220d 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '9.7.0' +modulesync_config_version: '10.0.0' diff --git a/Gemfile b/Gemfile index f08ae17f..fc8cf4d1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 10.0', :require => false + gem 'voxpupuli-test', '~> 11.0', :require => false gem 'puppet_metadata', '~> 5.0', :require => false end @@ -18,13 +18,11 @@ group :system_tests do end group :release do - gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'voxpupuli-release', '~> 4.0', :require => false end gem 'rake', :require => false -gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] -gem 'puppet', puppetversion, :require => false, :groups => [:test] +gem 'openvox', ENV.fetch('OPENVOX_GEM_VERSION', [">= 7", "< 9"]), :require => false, :groups => [:test] # vim: syntax=ruby From 5e0d878236f1171a5455c550db8e8dab11a7897e Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Fri, 13 Jun 2025 22:18:35 -0700 Subject: [PATCH 352/380] .fixtures.yml: remove puppet_version Not needed anymore and breaks testing with openvox. --- .fixtures.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.fixtures.yml b/.fixtures.yml index 8d63745d..0c369870 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,4 +4,3 @@ fixtures: epel: https://github.com/voxpupuli/puppet-epel.git yumrepo_core: repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git - puppet_version: ">= 6.0.0" From a83d99639691b98a5451849905bac4fa3120d366 Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Wed, 18 Jun 2025 09:31:09 +0200 Subject: [PATCH 353/380] Cleanup fixtures --- .fixtures.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 0c369870..4a4f5b85 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,6 @@ +--- fixtures: repositories: - stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git epel: https://github.com/voxpupuli/puppet-epel.git - yumrepo_core: - repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git + yumrepo_core: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git From 459e30efb651ece57f49453d18ff9ee6ee3326ac Mon Sep 17 00:00:00 2001 From: Calle Englund Date: Mon, 23 Jun 2025 13:50:19 +0200 Subject: [PATCH 354/380] Run gunicorn specs for all supported os --- spec/defines/gunicorn_spec.rb | 41 ++++++++++++++--------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/spec/defines/gunicorn_spec.rb b/spec/defines/gunicorn_spec.rb index 13284087..b9258a58 100644 --- a/spec/defines/gunicorn_spec.rb +++ b/spec/defines/gunicorn_spec.rb @@ -5,37 +5,28 @@ describe 'python::gunicorn', type: :define do let(:title) { 'test-app' } - context 'on Debian OS' do - let :facts do - { - id: 'root', - kernel: 'Linux', - lsbdistcodename: 'squeeze', - osfamily: 'Debian', - operatingsystem: 'Debian', - operatingsystemrelease: '6', - path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - concat_basedir: '/dne' - } - end + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) { facts } - describe 'test-app with default parameter values' do - context 'configures test app with default parameter values' do - let(:params) { { dir: '/srv/testapp' } } + describe 'test-app with default parameter values' do + context 'configures test app with default parameter values' do + let(:params) { { dir: '/srv/testapp' } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=error}) } - end + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=error}) } + end - context 'test-app with custom log level' do - let(:params) { { dir: '/srv/testapp', log_level: 'info' } } + context 'test-app with custom log level' do + let(:params) { { dir: '/srv/testapp', log_level: 'info' } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=info}) } - end + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=info}) } + end - context 'test-app with custom gunicorn preload arguments' do - let(:params) { { dir: '/srv/testapp', args: ['--preload'] } } + context 'test-app with custom gunicorn preload arguments' do + let(:params) { { dir: '/srv/testapp', args: ['--preload'] } } - it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--preload}) } + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--preload}) } + end end end end From 91d351ecc6ab04668d2e347b5d9b62d80a2d9799 Mon Sep 17 00:00:00 2001 From: Calle Englund Date: Mon, 23 Jun 2025 17:20:14 +0200 Subject: [PATCH 355/380] Expect current default for gunicorn workers Given that legacy facts were removed from facterdb 3, the current behavior relies on `NilClass#to_i` resolving to missing fact to 0. The added test case for custom `workers` parameter given cannot give false positives with the default formula always being an odd number. --- spec/defines/gunicorn_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/defines/gunicorn_spec.rb b/spec/defines/gunicorn_spec.rb index b9258a58..dc4d8bda 100644 --- a/spec/defines/gunicorn_spec.rb +++ b/spec/defines/gunicorn_spec.rb @@ -12,8 +12,13 @@ describe 'test-app with default parameter values' do context 'configures test app with default parameter values' do let(:params) { { dir: '/srv/testapp' } } + let(:expected_workers) do + # templates/gunicorn.erb + (facts[:processorcount].to_i * 2) + 1 + end it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=error}) } + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--workers=#{expected_workers}}) } end context 'test-app with custom log level' do @@ -27,6 +32,12 @@ it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--preload}) } end + + context 'test-app with custom workers count' do + let(:params) { { dir: '/srv/testapp', workers: 42 } } + + it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--workers=#{params[:workers]}}) } + end end end end From 67c1a82e75f4de12d5e460aae21e4f271cffaea6 Mon Sep 17 00:00:00 2001 From: Calle Englund Date: Mon, 23 Jun 2025 17:59:28 +0200 Subject: [PATCH 356/380] Pick default gunicorn workers from non-legacy fact While the documentation for the core fact `processors.count` states that it is an _integer_ already, the previous behavior was to silently treat a missing fact as a processor count of zero, via `NilClass#to_i`. This does not happen in FacterDB entries for supported os, but the spec still mirrors the conversion done by the template. --- manifests/gunicorn.pp | 2 ++ spec/defines/gunicorn_spec.rb | 5 ++++- templates/gunicorn.erb | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 7670f394..5393ac33 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -55,6 +55,8 @@ String[1] $template = 'python/gunicorn.erb', Array $args = [], ) { + $processor_count = fact('processors.count') + if $manage_config_dir { file { $config_dir: ensure => directory, diff --git a/spec/defines/gunicorn_spec.rb b/spec/defines/gunicorn_spec.rb index dc4d8bda..de36c580 100644 --- a/spec/defines/gunicorn_spec.rb +++ b/spec/defines/gunicorn_spec.rb @@ -13,8 +13,11 @@ context 'configures test app with default parameter values' do let(:params) { { dir: '/srv/testapp' } } let(:expected_workers) do + # manifests/gunicorn.pp + processor_count = facts.dig(:processors, 'count') + # templates/gunicorn.erb - (facts[:processorcount].to_i * 2) + 1 + (processor_count.to_i * 2) + 1 end it { is_expected.to contain_file('/etc/gunicorn.d/test-app').with_mode('0644').with_content(%r{--log-level=error}) } diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index 07605ade..57dd4748 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -39,7 +39,7 @@ CONFIG = { <% if @workers -%> '--workers=<%= @workers %>', <% else -%> - '--workers=<%= @processorcount.to_i*2 + 1 %>', + '--workers=<%= @processor_count.to_i*2 + 1 %>', <% end -%> '--timeout=<%= @timeout %>', <% if @access_log_format -%> From cdcb65e0e9378e597f6c833816bbbc670381e614 Mon Sep 17 00:00:00 2001 From: Brian Schonecker Date: Mon, 7 Jul 2025 15:19:01 -0400 Subject: [PATCH 357/380] Add section in README that simulates `python3 -m pip install pandas --user` (#725) * Add section in README that simulates python3 -m pip install pandas --user. * Update README.md Co-authored-by: Kenyon Ralph * Update README.md Co-authored-by: Kenyon Ralph * Update README.md Co-authored-by: Kenyon Ralph * Update README.md Co-authored-by: Kenyon Ralph * Update README.md Co-authored-by: Kenyon Ralph --------- Co-authored-by: Kenyon Ralph --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index a91504ca..59d95fd3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,35 @@ For class usage refer to the [Reference]("https://github.com/voxpupuli/puppet-py bundle exec rake strings:generate\[',,,,false,true'] ``` +### Install Python package to a user's default install directory + +The following code simulates + +```shell +python3 -m pip install pandas --user +``` +where pip installs packages to a user's default install directory -- +typically `~/.local/` on Linux. + +```puppet +# Somewhat hackishly, install Python PIP module PANDAS for Oracle Cloud API queries. +python::pyvenv { 'user_python_venv': + ensure => present, + version => 'system', + systempkgs => true, + venv_dir => '/home/example/.local', + owner => 'example', + group => 'example', + mode => '0750', +} + +python::pip { 'pandas': + virtualenv => '/home/example/.local', + owner => 'example', + group => 'example', +} +``` + ### hiera configuration This module supports configuration through hiera. The following example From cede4737714af131bb94ee5df093f74a490cdc2e Mon Sep 17 00:00:00 2001 From: Alin Cociorvan Date: Thu, 10 Jul 2025 13:27:11 +0300 Subject: [PATCH 358/380] pip: allow v-prefixed version string --- manifests/pip.pp | 6 +++--- spec/defines/pip_spec.rb | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index eaada706..76b3af48 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -160,8 +160,8 @@ # If it wasn't or if there is any error, the package manager will trigger a failure. $grep_regex = $_ensure ? { /^(present|absent|latest)$/ => "^${real_pkgname}[[:space:]].*$", - /^[0-9].*$/ => "^${real_pkgname}[[:space:]]\\+(\\?${_ensure}\\()$\\|$\\|, \\|[[:space:]]\\)", - default => fail('ensure can be a version number or one of: present, absent, latest') + /^v?[0-9].*$/ => "^${real_pkgname}[[:space:]]\\+(\\?${_ensure}\\()$\\|$\\|, \\|[[:space:]]\\)", + default => fail('ensure can be a version number (e.g. 1.7.0 or v1.7.0) or one of: present, absent, latest') } $extras_string = empty($extras) ? { @@ -195,7 +195,7 @@ } } else { case $_ensure { - /^[0-9].*$/: { + /^v?[0-9].*$/: { # Specific version $command = "${pip_install} ${install_args} ${pip_common_args}==${_ensure}" $unless_command = "${pip_env} list | grep -i -e '${grep_regex}'" diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index d7115427..40add6d6 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -147,6 +147,20 @@ end end + describe 'install specific version' do + context 'supports v-prefixed version string' do + let(:params) { { ensure: 'v1.7.0' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install rpyc==v1.7.0') } + end + + context 'supports version string without v-prefix' do + let(:params) { { ensure: '1.7.0' } } + + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install rpyc==1.7.0') } + end + end + describe 'uninstall' do context 'adds correct title' do let(:params) { { ensure: 'absent' } } From 86ae49a0dc28d6321cad46249bc3505f153307ac Mon Sep 17 00:00:00 2001 From: Christoph Maser Date: Sun, 3 Aug 2025 14:52:55 +0200 Subject: [PATCH 359/380] Drop puppet, update openvox minimum version to 8.19 * drop support for puppet as discussed in [1] * update openvox minimum version to 8.19.0 as discussed in [2] and [3] [1] https://github.com/voxpupuli/community-triage/issues/59 [2] https://github.com/voxpupuli/community-triage/issues/60 [3] https://github.com/voxpupuli/modulesync_config/pull/978#discussion_r2232830327 --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index 7f19e856..8a7a76cc 100644 --- a/metadata.json +++ b/metadata.json @@ -90,8 +90,8 @@ ], "requirements": [ { - "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "name": "openvox", + "version_requirement": ">= 8.19.0 < 9.0.0" } ], "dependencies": [ From c925952c7580f327999321161e019e4a58872e07 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Tue, 12 Aug 2025 08:06:22 +0000 Subject: [PATCH 360/380] modulesync 10.0.0-19-g1adc8e0 --- .msync.yml | 2 +- Gemfile | 2 +- Rakefile | 14 +++----------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.msync.yml b/.msync.yml index af9a220d..cf1792b6 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.0.0' +modulesync_config_version: '10.1.0' diff --git a/Gemfile b/Gemfile index fc8cf4d1..ddd05cc1 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 3.5', :require => false + gem 'voxpupuli-acceptance', '~> 4.0', :require => false end group :release do diff --git a/Rakefile b/Rakefile index 58250c39..fab1b62a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,30 +1,22 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), -# otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' rescue LoadError - begin - require 'puppetlabs_spec_helper/rake_tasks' - rescue LoadError - end + # only available if gem group test is installed end -# load optional tasks for acceptance -# only available if gem group releases is installed begin require 'voxpupuli/acceptance/rake' rescue LoadError + # only available if gem group acceptance is installed end -# load optional tasks for releases -# only available if gem group releases is installed begin require 'voxpupuli/release/rake_tasks' rescue LoadError - # voxpupuli-release not present + # only available if gem group releases is installed else GCGConfig.user = 'voxpupuli' GCGConfig.project = 'puppet-python' From 4722bf28c40eb101c2503ee859a11cfea3894d14 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Tue, 23 Sep 2025 13:03:56 +0000 Subject: [PATCH 361/380] modulesync 10.1.0-26-ga82038c --- .github/CONTRIBUTING.md | 272 ---------------------------------------- .msync.yml | 2 +- Gemfile | 2 +- 3 files changed, 2 insertions(+), 274 deletions(-) delete mode 100644 .github/CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index daceb642..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,272 +0,0 @@ -# Contribution guidelines - -## Table of contents - -* [Contributing](#contributing) -* [Writing proper commits - short version](#writing-proper-commits-short-version) -* [Writing proper commits - long version](#writing-proper-commits-long-version) -* [Dependencies](#dependencies) - * [Note for OS X users](#note-for-os-x-users) -* [The test matrix](#the-test-matrix) -* [Syntax and style](#syntax-and-style) -* [Running the unit tests](#running-the-unit-tests) -* [Unit tests in docker](#unit-tests-in-docker) -* [Integration tests](#integration-tests) - -This module has grown over time based on a range of contributions from -people using it. If you follow these contributing guidelines your patch -will likely make it into a release a little more quickly. - -## Contributing - -Please note that this project is released with a Contributor Code of Conduct. -By participating in this project you agree to abide by its terms. -[Contributor Code of Conduct](https://voxpupuli.org/coc/). - -* Fork the repo. -* Create a separate branch for your change. -* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). -* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. -* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. -* Squash your commits down into logical components. Make sure to rebase against our current master. -* Push the branch to your fork and submit a pull request. - -Please be prepared to repeat some of these steps as our contributors review your code. - -Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! - -## Writing proper commits - short version - -* Make commits of logical units. -* Check for unnecessary whitespace with "git diff --check" before committing. -* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). -* Do not check in commented out code or unneeded files. -* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. -* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". -* The body should provide a meaningful commit message, which: - *uses the imperative, present tense: `change`, not `changed` or `changes`. - * includes motivation for the change, and contrasts its implementation with the previous behavior. - * Make sure that you have tests for the bug you are fixing, or feature you are adding. - * Make sure the test suites passes after your commit: - * When introducing a new feature, make sure it is properly documented in the README.md - -## Writing proper commits - long version - - 1. Make separate commits for logically separate changes. - - Please break your commits down into logically consistent units - which include new or changed tests relevant to the rest of the - change. The goal of doing this is to make the diff easier to - read for whoever is reviewing your code. In general, the easier - your diff is to read, the more likely someone will be happy to - review it and get it into the code base. - - If you are going to refactor a piece of code, please do so as a - separate commit from your feature or bug fix changes. - - We also really appreciate changes that include tests to make - sure the bug is not re-introduced, and that the feature is not - accidentally broken. - - Describe the technical detail of the change(s). If your - description starts to get too long, that is a good sign that you - probably need to split up your commit into more finely grained - pieces. - - Commits which plainly describe the things which help - reviewers check the patch and future developers understand the - code are much more likely to be merged in with a minimum of - bike-shedding or requested changes. Ideally, the commit message - would include information, and be in a form suitable for - inclusion in the release notes for the version of Puppet that - includes them. - - Please also check that you are not introducing any trailing - whitespace or other "whitespace errors". You can do this by - running "git diff --check" on your changes before you commit. - - 2. Sending your patches - - To submit your changes via a GitHub pull request, we _highly_ - recommend that you have them on a topic branch, instead of - directly on `master`. - It makes things much easier to keep track of, especially if - you decide to work on another thing before your first change - is merged in. - - GitHub has some pretty good - [general documentation](http://help.github.com/) on using - their site. They also have documentation on - [creating pull requests](http://help.github.com/send-pull-requests/). - - In general, after pushing your topic branch up to your - repository on GitHub, you can switch to the branch in the - GitHub UI and click "Pull Request" towards the top of the page - in order to open a pull request. - - - 3. Update the related GitHub issue. - - If there is a GitHub issue associated with the change you - submitted, then you should update the ticket to include the - location of your branch, along with any other commentary you - may wish to make. - -## Dependencies - -The testing and development tools have a bunch of dependencies, -all managed by [bundler](http://bundler.io/) according to the -[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). - -By default the tests use a baseline version of Puppet. - -If you have Ruby 2.x or want a specific version of Puppet, -you must set an environment variable such as: - -```sh -export PUPPET_GEM_VERSION="~> 6.1.0" -``` - -You can install all needed gems for spec tests into the modules directory by -running: - -```sh -bundle config set --local path '.vendor/' -bundle config set --local without 'development system_tests release' -bundle install --jobs "$(nproc)" -``` - -If you also want to run acceptance tests: - -```sh -bundle config set --local path '.vendor/' -bundle config set --local without 'development release' -bundle config set --local with 'system_tests' -bundle install --jobs "$(nproc)" -``` - -Our all in one solution if you don't know if you need to install or update gems: - -```sh -bundle config set --local path '.vendor/' -bundle config set --local without 'development release' -bundle config set --local with 'system_tests' -bundle install --jobs "$(nproc)" -bundle update -bundle clean -``` - -As an alternative to the `--jobs "$(nproc)` parameter, you can set an -environment variable: - -```sh -BUNDLE_JOBS="$(nproc)" -``` - -### Note for OS X users - -`nproc` isn't a valid command under OS x. As an alternative, you can do: - -```sh ---jobs "$(sysctl -n hw.ncpu)" -``` - -## The test matrix - -### Syntax and style - -The test suite will run [Puppet Lint](http://puppet-lint.com/) and -[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to -check various syntax and style things. You can run these locally with: - -```sh -bundle exec rake lint -bundle exec rake validate -``` - -It will also run some [Rubocop](http://batsov.com/rubocop/) tests -against it. You can run those locally ahead of time with: - -```sh -bundle exec rake rubocop -``` - -### Running the unit tests - -The unit test suite covers most of the code, as mentioned above please -add tests if you're adding new functionality. If you've not used -[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask -about how best to test your new feature. - -To run the linter, the syntax checker and the unit tests: - -```sh -bundle exec rake test -``` - -To run your all the unit tests - -```sh -bundle exec rake spec -``` - -To run a specific spec test set the `SPEC` variable: - -```sh -bundle exec rake spec SPEC=spec/foo_spec.rb -``` - -#### Unit tests in docker - -Some people don't want to run the dependencies locally or don't want to install -ruby. We ship a Dockerfile that enables you to run all unit tests and linting. -You only need to run: - -```sh -docker build . -``` - -Please ensure that a docker daemon is running and that your user has the -permission to talk to it. You can specify a remote docker host by setting the -`DOCKER_HOST` environment variable. it will copy the content of the module into -the docker image. So it will not work if a Gemfile.lock exists. - -### Integration tests - -The unit tests just check the code runs, not that it does exactly what -we want on a real machine. For that we're using -[beaker](https://github.com/puppetlabs/beaker). - -This fires up a new virtual machine (using vagrant) and runs a series of -simple tests against it after applying the module. You can run this -with: - -```sh -BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker -``` - -or - -```sh -BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker -``` - -This latter example will use the distribution's own version of Puppet. - -You can replace the string `debian11` with any common operating system. -The following strings are known to work: - -* ubuntu2004 -* ubuntu2204 -* debian11 -* debian12 -* centos9 -* archlinux -* almalinux8 -* almalinux9 -* fedora36 - -For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). - -The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) -repository. diff --git a/.msync.yml b/.msync.yml index cf1792b6..68fb43b2 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.1.0' +modulesync_config_version: '10.2.0' diff --git a/Gemfile b/Gemfile index ddd05cc1..2aaf7d52 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 11.0', :require => false + gem 'voxpupuli-test', '~> 12.0', :require => false gem 'puppet_metadata', '~> 5.0', :require => false end From 22199d2d5f6162232a34614e418f63e2f016d0c5 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Tue, 23 Sep 2025 23:13:39 -0700 Subject: [PATCH 362/380] puppet-lint fix: indentation --- manifests/pip.pp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 76b3af48..f5d7d5fa 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -218,12 +218,14 @@ # Unfortunately this is the smartest way of getting the latest available package version with pip as of now # Note: we DO need to repeat ourselves with "from version" in both grep and sed as on some systems pip returns # more than one line with paretheses. - $latest_version = join([ + $latest_version = join( + [ "${pip_install} ${legacy_resolver} ${pypi_index} ${pypi_extra_index} ${proxy_flag}", " ${install_args} ${install_editable} '${real_pkgname}==9!0dev0+x' 2>&1", " | sed -nE 's/.*\\(from versions: (.*, )*(.*)\\)/\\2/p'", ' | tr -d "[:space:]"', - ]) + ], + ) # Packages with underscores in their names are listed with dashes in their place in `pip freeze` output $pkgname_with_dashes = regsubst($real_pkgname, '_', '-', 'G') From 23a43317c0d87e720a4a3413778aaace721745fe Mon Sep 17 00:00:00 2001 From: Tom Judge <157825077+tj-cisco@users.noreply.github.com> Date: Tue, 23 Sep 2025 11:09:11 -0400 Subject: [PATCH 363/380] Allow setting python::version to Integer Allow setting `python::version` to an integer value to match the `default` option in `install.pp`. This is required for FreeBSD. --- REFERENCE.md | 11 ++++++++++- types/version.pp | 12 +++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 4352dd43..f5d739e2 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1212,5 +1212,14 @@ Alias of `Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/]` Match all valid versions for python -Alias of `Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]` +Alias of + +```puppet +Variant[Integer, Pattern[ + /\A(python)?[0-9](\.?[0-9])*/, + /\Apypy\Z/, + /\Asystem\Z/, + /\Arh-python[0-9]{2}(?:-python)?\Z/ + ]] +``` diff --git a/types/version.pp b/types/version.pp index 5bbcaaa8..075d3587 100644 --- a/types/version.pp +++ b/types/version.pp @@ -1,8 +1,10 @@ # @summary Match all valid versions for python # -type Python::Version = Pattern[ - /\A(python)?[0-9](\.?[0-9])*/, - /\Apypy\Z/, - /\Asystem\Z/, - /\Arh-python[0-9]{2}(?:-python)?\Z/ +type Python::Version = Variant[Integer, + Pattern[ + /\A(python)?[0-9](\.?[0-9])*/, + /\Apypy\Z/, + /\Asystem\Z/, + /\Arh-python[0-9]{2}(?:-python)?\Z/ + ] ] From f99d48d01e30e9dff905f73528dfd8cd5e0746c8 Mon Sep 17 00:00:00 2001 From: Kenyon Ralph Date: Sat, 27 Sep 2025 23:53:22 -0700 Subject: [PATCH 364/380] init.pp: remove useless exec with default title Per the docs, the special value `default` sets default attribute values for other resource bodies in the same expression. There are no resources in this expression so it doesn't do anything. This was probably intended to be a "legacy-style default, but the style guide says to avoid these anyway. --- REFERENCE.md | 4 ---- manifests/init.pp | 6 ------ 2 files changed, 10 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index f5d739e2..85da05a1 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -180,12 +180,8 @@ Default value: `true` ##### `umask` -Data type: `Optional[Python::Umask]` - The default umask for invoked exec calls. -Default value: `undef` - ##### `manage_gunicorn` manage the state for package gunicorn diff --git a/manifests/init.pp b/manifests/init.pp index 3f5ac23f..31061daf 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -62,7 +62,6 @@ Stdlib::Httpurl $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh', Stdlib::Absolutepath $anaconda_install_path = '/opt/python', Boolean $manage_scl = true, - Optional[Python::Umask] $umask = undef, ) inherits python::params { $exec_prefix = $provider ? { 'scl' => "/usr/bin/scl enable ${version} -- ", @@ -76,11 +75,6 @@ Class['python::install'] -> Class['python::config'] - # Set default umask. - exec { default: - umask => $umask, - } - # Allow hiera configuration of python resources create_resources('python::pip', $python_pips) create_resources('python::pyvenv', $python_pyvenvs) From a8114def4801f5bc5deb2f752a4207158b5233ad Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Sat, 27 Sep 2025 13:14:01 +0000 Subject: [PATCH 365/380] modulesync 10.3.0 --- .msync.yml | 2 +- Gemfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.msync.yml b/.msync.yml index 68fb43b2..814fbd04 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.2.0' +modulesync_config_version: '10.3.0' diff --git a/Gemfile b/Gemfile index 2aaf7d52..56259860 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 12.0', :require => false + gem 'voxpupuli-test', '~> 13.0', :require => false gem 'puppet_metadata', '~> 5.0', :require => false end @@ -18,7 +18,7 @@ group :system_tests do end group :release do - gem 'voxpupuli-release', '~> 4.0', :require => false + gem 'voxpupuli-release', '~> 5.0', :require => false end gem 'rake', :require => false From c73bf337ea970c5a467361c726de27a7ed0a57ef Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Fri, 17 Oct 2025 14:57:58 +0000 Subject: [PATCH 366/380] modulesync 10.4.0 --- .github/workflows/ci.yml | 2 +- .msync.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44674150..4bf69968 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,4 +22,4 @@ permissions: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v4 diff --git a/.msync.yml b/.msync.yml index 814fbd04..81ea369a 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.3.0' +modulesync_config_version: '10.4.0' From f50e44030ed40581b3ada6b52516a8f57ec8c214 Mon Sep 17 00:00:00 2001 From: Szparki Date: Thu, 30 Oct 2025 19:02:44 +0200 Subject: [PATCH 367/380] Making sure group ownership is not set to 'root' only, with this can handle 'wheel' in FreeBSD --- manifests/dotfile.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/dotfile.pp b/manifests/dotfile.pp index 4961f12f..66d59b1e 100644 --- a/manifests/dotfile.pp +++ b/manifests/dotfile.pp @@ -26,7 +26,7 @@ Enum['absent', 'present'] $ensure = 'present', Stdlib::Absolutepath $filename = $title, String[1] $owner = 'root', - String[1] $group = 'root', + String[1] $group = getvar('python::params::group'), Stdlib::Filemode $mode = '0644', Hash $config = {}, ) { From e895f49c350e1393d617241649e42ef148900308 Mon Sep 17 00:00:00 2001 From: Szparki Date: Fri, 31 Oct 2025 11:20:22 +0200 Subject: [PATCH 368/380] Updating REFERENCE.md --- REFERENCE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/REFERENCE.md b/REFERENCE.md index 85da05a1..def63d6a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -420,7 +420,7 @@ Data type: `String[1]` group owner of dotfile -Default value: `'root'` +Default value: `getvar('python::params::group')` ##### `config` From 5c5a5bc9c916f89b1bbf97a0f762c578e8cce6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Fri, 31 Oct 2025 17:17:27 -1000 Subject: [PATCH 369/380] Include python class before testing python::dotfile If the python class was not included in the catalog first, python::params has not been loaded, so the required group is undef causing compilation failure. --- spec/defines/dotfile_spec.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/defines/dotfile_spec.rb b/spec/defines/dotfile_spec.rb index 30ce21b3..a44426f7 100644 --- a/spec/defines/dotfile_spec.rb +++ b/spec/defines/dotfile_spec.rb @@ -9,6 +9,16 @@ facts end + let(:root_group) do + if facts[:os]['family'] == 'FreeBSD' + 'wheel' + else + 'root' + end + end + + let(:pre_condition) { 'include python' } + describe 'dotfile as' do context 'fails with empty string filename' do let(:title) { '' } @@ -32,7 +42,7 @@ context 'succeeds with filename in a non-existing path' do let(:title) { '/home/someuser/.pip/pip.conf' } - it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o root -g root -d /home/someuser/.pip') } + it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command("install -o root -g #{root_group} -d /home/someuser/.pip") } it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_mode('0644') } end @@ -40,7 +50,7 @@ let(:title) { '/home/someuser/.pip/pip.conf' } let(:params) { { owner: 'someuser' } } - it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command('install -o someuser -g root -d /home/someuser/.pip') } + it { is_expected.to contain_exec('create /home/someuser/.pip/pip.conf\'s parent dir').with_command("install -o someuser -g #{root_group} -d /home/someuser/.pip") } it { is_expected.to contain_file('/home/someuser/.pip/pip.conf').with_owner('someuser') } end From 5b3d64ef4fc27a130f71e67f1664e5931878709b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 28 Sep 2025 10:16:57 -1000 Subject: [PATCH 370/380] Do not pass `--log` to `pip install` When passing a `--log` option to `pip install`, _verbose_ logging is appended to the specified file, and the default logging captured by puppet is _quitter_ than the default. When an installation error occur, the quieter output does not contain the reason for the failure, and inspection of the log file is necessary to determine the reason of the error. This is impractical in CI systems where this file cannot be retrieved easily, and makes fixing regressions harder. On production systems, this log is also mostly useless since projects dependencies versions are generally expected to be found in the requirement file used for installation in order for deployments to be reproducible. --- manifests/pip.pp | 2 +- manifests/pyvenv.pp | 2 +- manifests/requirements.pp | 2 +- spec/classes/python_spec.rb | 4 ++-- spec/defines/pip_spec.rb | 16 ++++++++-------- spec/defines/pyvenv_spec.rb | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index f5d7d5fa..9d568207 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -181,7 +181,7 @@ default => "'${url}#egg=${egg_name}'", } - $pip_install = "${pip_env} --log ${log}/pip.log install" + $pip_install = "${pip_env} install" $pip_common_args = "${pypi_index} ${pypi_extra_index} ${proxy_flag} ${install_editable} ${source}" # Explicit version out of VCS when PIP supported URL is provided diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 6627a406..7aa7202f 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -94,7 +94,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${prompt_arg} ${venv_dir} && ${pip_cmd} --log ${venv_dir}/pip.log install ${pip_upgrade} && ${pip_cmd} --log ${venv_dir}/pip.log install --upgrade setuptools", + command => "${virtualenv_cmd} --clear ${system_pkgs_flag} ${prompt_arg} ${venv_dir} && ${pip_cmd} install ${pip_upgrade} && ${pip_cmd} install --upgrade setuptools", user => $owner, creates => "${venv_dir}/bin/activate", path => $_path, diff --git a/manifests/requirements.pp b/manifests/requirements.pp index f2743509..374a70ae 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -98,7 +98,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log ${log}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements} ${extra_pip_args}", + command => "${pip_env} install ${proxy_flag} ${src_flag} -r ${requirements} ${extra_pip_args}", refreshonly => !$forceupdate, timeout => $timeout, cwd => $cwd, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index fd39b26d..74852970 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -157,7 +157,7 @@ it { expect(subject).to contain_exec('python_virtualenv_/opt/env1'). with( - command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools', + command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip install --upgrade pip && /opt/env1/bin/pip install --upgrade setuptools', user: 'root', creates: '/opt/env1/bin/activate', path: [ @@ -177,7 +177,7 @@ it { expect(subject).to contain_exec('python_virtualenv_/opt/env2'). with( - command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools', + command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip install --upgrade setuptools', user: 'root', creates: '/opt/env2/bin/activate', path: [ diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index 40add6d6..abe5cda0 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -77,7 +77,7 @@ context 'adds proxy to install command if proxy set' do let(:params) { { proxy: 'http://my.proxy:3128' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --proxy=http://my.proxy:3128 rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install --proxy=http://my.proxy:3128 rpyc') } end end @@ -91,7 +91,7 @@ context 'adds index to install command if index set' do let(:params) { { index: 'http://www.example.com/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --index-url=http://www.example.com/simple/ rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install --index-url=http://www.example.com/simple/ rpyc') } end end @@ -105,7 +105,7 @@ context 'adds extra_index to install command if extra_index set' do let(:params) { { extra_index: 'http://www.example.com/extra/simple/' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --extra-index-url=http://www.example.com/extra/simple/ rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install --extra-index-url=http://www.example.com/extra/simple/ rpyc') } end end @@ -122,7 +122,7 @@ context 'adds install_args to install command if install_args set' do let(:params) { { install_args: '--pre' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install --pre rpyc') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install --pre rpyc') } end end @@ -151,13 +151,13 @@ context 'supports v-prefixed version string' do let(:params) { { ensure: 'v1.7.0' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install rpyc==v1.7.0') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install rpyc==v1.7.0') } end context 'supports version string without v-prefix' do let(:params) { { ensure: '1.7.0' } } - it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip --log /tmp/pip.log install rpyc==1.7.0') } + it { is_expected.to contain_exec('pip_install_rpyc').with_command('pip install rpyc==1.7.0') } end end @@ -235,13 +235,13 @@ context 'suceeds with no extras' do let(:params) { {} } - it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests') } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip install requests') } end context 'succeeds with extras' do let(:params) { { extras: ['security'] } } - it { is_expected.to contain_exec('pip_install_requests').with_command('pip --log /tmp/pip.log install requests[security]') } + it { is_expected.to contain_exec('pip_install_requests').with_command('pip install requests[security]') } end end end diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index b0578bec..57d87078 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -29,7 +29,7 @@ context 'with default parameters' do it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') } - it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') } + it { is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip install --upgrade pip && /opt/env/bin/pip install --upgrade setuptools') } end describe 'when ensure' do @@ -67,7 +67,7 @@ it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('python3.6 -m venv --clear --prompt custom\\ prompt /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('python3.6 -m venv --clear --prompt custom\\ prompt /opt/env && /opt/env/bin/pip install --upgrade pip && /opt/env/bin/pip install --upgrade setuptools') } end end @@ -91,7 +91,7 @@ it { is_expected.to contain_file('/opt/env').that_requires('Class[python::install]') - is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade pip && /opt/env/bin/pip --log /opt/env/pip.log install --upgrade setuptools') + is_expected.to contain_exec('python_virtualenv_/opt/env').with_command('pyvenv-3.5 --clear /opt/env && /opt/env/bin/pip install --upgrade pip && /opt/env/bin/pip install --upgrade setuptools') } end end From b3fb50ee88ac9304d6ccb9321a4a54bccfdd4eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Wed, 17 Dec 2025 10:34:21 -1000 Subject: [PATCH 371/380] Add support for Debian 13 --- data/os/Debian/13.yaml | 1 + metadata.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 data/os/Debian/13.yaml diff --git a/data/os/Debian/13.yaml b/data/os/Debian/13.yaml new file mode 100644 index 00000000..3bd58ed5 --- /dev/null +++ b/data/os/Debian/13.yaml @@ -0,0 +1 @@ +python::default_system_version: "3.13" diff --git a/metadata.json b/metadata.json index 8a7a76cc..a536b318 100644 --- a/metadata.json +++ b/metadata.json @@ -37,7 +37,8 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "11", - "12" + "12", + "13" ] }, { From a7f429183aa9bad56e6ce035d4bf259628f40514 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Mon, 29 Dec 2025 18:59:41 +0000 Subject: [PATCH 372/380] modulesync 10.5.0 --- .devcontainer/devcontainer.json | 5 +++++ .msync.yml | 2 +- Gemfile | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..168a5cb4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,5 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +{ + "name": "VoxBox", + "image": "ghcr.io/voxpupuli/voxbox:latest" +} diff --git a/.msync.yml b/.msync.yml index 81ea369a..179bafc0 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.4.0' +modulesync_config_version: '10.5.0' diff --git a/Gemfile b/Gemfile index 56259860..5f69bec8 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do gem 'voxpupuli-test', '~> 13.0', :require => false - gem 'puppet_metadata', '~> 5.0', :require => false + gem 'puppet_metadata', '~> 6.0', :require => false end group :development do From 779216513622af5a2fcc5e1bc1cc9c2debd7829f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 27 Jan 2026 07:00:01 -1000 Subject: [PATCH 373/380] Revert "Allow setting `python::version` in hiera to `Integer`" --- REFERENCE.md | 11 +---------- types/version.pp | 12 +++++------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index def63d6a..7369552e 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1208,14 +1208,5 @@ Alias of `Pattern[/^(<|>|<=|>=|==) [0-9]*(\.[0-9]+)*$/, /\Alatest\Z/]` Match all valid versions for python -Alias of - -```puppet -Variant[Integer, Pattern[ - /\A(python)?[0-9](\.?[0-9])*/, - /\Apypy\Z/, - /\Asystem\Z/, - /\Arh-python[0-9]{2}(?:-python)?\Z/ - ]] -``` +Alias of `Pattern[/\A(python)?[0-9](\.?[0-9])*/, /\Apypy\Z/, /\Asystem\Z/, /\Arh-python[0-9]{2}(?:-python)?\Z/]` diff --git a/types/version.pp b/types/version.pp index 075d3587..5bbcaaa8 100644 --- a/types/version.pp +++ b/types/version.pp @@ -1,10 +1,8 @@ # @summary Match all valid versions for python # -type Python::Version = Variant[Integer, - Pattern[ - /\A(python)?[0-9](\.?[0-9])*/, - /\Apypy\Z/, - /\Asystem\Z/, - /\Arh-python[0-9]{2}(?:-python)?\Z/ - ] +type Python::Version = Pattern[ + /\A(python)?[0-9](\.?[0-9])*/, + /\Apypy\Z/, + /\Asystem\Z/, + /\Arh-python[0-9]{2}(?:-python)?\Z/ ] From ac0e72b1f20b433928cbc4addee461340bcf0bd0 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Fri, 6 Mar 2026 09:57:45 +0000 Subject: [PATCH 374/380] modulesync 10.6.0 --- .devcontainer/devcontainer.json | 1 - .msync.yml | 2 +- Gemfile | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 168a5cb4..08c6abf9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,4 +1,3 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the { "name": "VoxBox", "image": "ghcr.io/voxpupuli/voxbox:latest" diff --git a/.msync.yml b/.msync.yml index 179bafc0..7d6d4ee4 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.5.0' +modulesync_config_version: '10.6.0' diff --git a/Gemfile b/Gemfile index 5f69bec8..e0c85815 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 13.0', :require => false + gem 'voxpupuli-test', '~> 14.0', :require => false gem 'puppet_metadata', '~> 6.0', :require => false end @@ -18,7 +18,7 @@ group :system_tests do end group :release do - gem 'voxpupuli-release', '~> 5.0', :require => false + gem 'voxpupuli-release', '~> 5.3', :require => false end gem 'rake', :require => false From 4682910696f96fe4fd10ad3032aed5ce3a3b966f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 6 Mar 2026 13:08:19 +0100 Subject: [PATCH 375/380] rubocop: autocorrect --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 13 +++++++ spec/classes/python_spec.rb | 46 ++++++++++++------------- spec/defines/pip_spec.rb | 8 ++--- spec/defines/pyvenv_spec.rb | 8 ++--- spec/defines/requirements_spec.rb | 4 +-- spec/unit/facter/pip_version_spec.rb | 2 -- spec/unit/facter/python_release_spec.rb | 2 -- spec/unit/facter/python_version_spec.rb | 2 -- 9 files changed, 48 insertions(+), 39 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 53ac1898..ea22bff8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..f8daacee --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,13 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --no-auto-gen-timestamp` +# using RuboCop version 1.85.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 3 +RSpec/LeakyLocalVariable: + Exclude: + - 'spec/acceptance/class_spec.rb' + - 'spec/acceptance/facts_test_spec.rb' diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 74852970..f1c2d9a1 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -36,7 +36,7 @@ manage_python_package: false, manage_dev_package: false, manage_pip_package: false, - manage_venv_package: false + manage_venv_package: false, } end @@ -53,7 +53,7 @@ manage_pip_package: true, manage_venv_package: true, pip: 'present', - venv: 'present' + venv: 'present', } end @@ -112,12 +112,12 @@ { python_pyvenvs: { '/opt/env1' => { - version: '3.8' + version: '3.8', }, '/opt/env2' => { - version: '3.8' - } - } + version: '3.8', + }, + }, } end @@ -139,13 +139,13 @@ python_pyvenvs: { '/opt/env1' => { version: '3.8', - pip_version: 'latest' + pip_version: 'latest', }, '/opt/env2' => { version: '3.8', - pip_version: '<= 20.3.4' - } - } + pip_version: '<= 20.3.4', + }, + }, } end @@ -155,8 +155,8 @@ it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') } it { - expect(subject).to contain_exec('python_virtualenv_/opt/env1'). - with( + expect(subject).to contain_exec('python_virtualenv_/opt/env1') + .with( command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip install --upgrade pip && /opt/env1/bin/pip install --upgrade setuptools', user: 'root', creates: '/opt/env1/bin/activate', @@ -164,19 +164,19 @@ '/bin', '/usr/bin', '/usr/sbin', - '/usr/local/bin' + '/usr/local/bin', ], cwd: '/tmp', environment: [], timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env1\[\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$} - ). - that_requires('File[/opt/env1]') + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env1\[\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$}, + ) + .that_requires('File[/opt/env1]') } it { - expect(subject).to contain_exec('python_virtualenv_/opt/env2'). - with( + expect(subject).to contain_exec('python_virtualenv_/opt/env2') + .with( command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip install --upgrade setuptools', user: 'root', creates: '/opt/env2/bin/activate', @@ -184,14 +184,14 @@ '/bin', '/usr/bin', '/usr/sbin', - '/usr/local/bin' + '/usr/local/bin', ], cwd: '/tmp', environment: [], timeout: 600, - unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env2\[\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$} - ). - that_requires('File[/opt/env2]') + unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\"\]\*/opt/env2\[\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$}, + ) + .that_requires('File[/opt/env2]') } it { is_expected.to contain_file('/opt/env1') } @@ -384,7 +384,7 @@ it { expect(subject).to contain_package('pip').with( - 'provider' => 'pip' + 'provider' => 'pip', ) } end diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index abe5cda0..a00a7792 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -21,7 +21,7 @@ operatingsystemrelease: '6', path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', concat_basedir: '/dne', - pip_version: '18.1' + pip_version: '18.1', } end @@ -195,7 +195,7 @@ operatingsystemrelease: '10.12', path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', concat_basedir: '/dne', - pip_version: '20.3.4' + pip_version: '20.3.4', } end @@ -221,13 +221,13 @@ kernel: 'Linux', lsbdistcodename: 'squeeze', os: { - family: 'Debian' + family: 'Debian', }, osfamily: 'Debian', operatingsystem: 'Debian', operatingsystemrelease: '6', path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - concat_basedir: '/dne' + concat_basedir: '/dne', } end diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 57d87078..6ce6646b 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -23,7 +23,7 @@ let :facts do # python3 is required to use pyvenv facts.merge( - python3_version: '3.5.1' + python3_version: '3.5.1', ) end @@ -36,7 +36,7 @@ context 'is absent' do let :params do { - ensure: 'absent' + ensure: 'absent', } end @@ -51,7 +51,7 @@ let :facts do # python 3.6 is required for venv and prompt facts.merge( - python3_version: '3.6.1' + python3_version: '3.6.1', ) end let :title do @@ -75,7 +75,7 @@ context "prompt on #{os} with python 3.5" do let :facts do facts.merge( - python3_version: '3.5.1' + python3_version: '3.5.1', ) end let :title do diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 1b9a75fb..82dc0b37 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -16,7 +16,7 @@ context 'with /requirements.txt' do let :params do { - requirements: '/requirements.txt' + requirements: '/requirements.txt', } end @@ -35,7 +35,7 @@ let :params do { owner: 'bob', - group: 'bob' + group: 'bob', } end diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 06bcf3de..3e6cd29f 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -7,7 +7,6 @@ Facter.clear end - # rubocop:disable RSpec/IndexedLet let(:pip_version_output) do <<~EOS pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7) @@ -25,7 +24,6 @@ pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) EOS end - # rubocop:enable RSpec/IndexedLet describe 'pip_version' do context 'returns pip version when pip present' do diff --git a/spec/unit/facter/python_release_spec.rb b/spec/unit/facter/python_release_spec.rb index d87b10b2..6026c1e3 100644 --- a/spec/unit/facter/python_release_spec.rb +++ b/spec/unit/facter/python_release_spec.rb @@ -7,7 +7,6 @@ Facter.clear end - # rubocop:disable RSpec/IndexedLet let(:python2_version_output) do <<~EOS Python 2.7.9 @@ -18,7 +17,6 @@ Python 3.3.0 EOS end - # rubocop:enable RSpec/IndexedLet describe 'python_release' do context 'returns Python release when `python` present' do diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index 386fcffb..d66d280b 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -7,7 +7,6 @@ Facter.clear end - # rubocop:disable RSpec/IndexedLet let(:python2_version_output) do <<~EOS Python 2.7.9 @@ -18,7 +17,6 @@ Python 3.3.0 EOS end - # rubocop:enable RSpec/IndexedLet describe 'python_version' do context 'returns Python version when `python` present' do From 4e23f0e62d828fe87de648bcf8b6e849591228df Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 6 Mar 2026 13:23:51 +0100 Subject: [PATCH 376/380] regenerate REFERENCE.md --- REFERENCE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/REFERENCE.md b/REFERENCE.md index def63d6a..e00c04c0 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -99,6 +99,8 @@ Data type: `Python::Version` The default version of Python provided by the operating system. Only used as a fallback if Python is not installed yet to determine how to handle some actions that vary depending on the Python version used. +Default value: `'3.11'` + ##### `ensure` Data type: `Python::Package::Ensure` From 36a97306bf902eaf4fe373d0dee8c2633e7e5a0b Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Fri, 27 Mar 2026 15:51:04 +0000 Subject: [PATCH 377/380] modulesync 10.7.0 --- .github/workflows/create_tag.yml | 22 ++++++++++++++++++++++ .github/workflows/prepare_release.yml | 5 ++++- .github/workflows/release.yml | 6 ++++-- .msync.yml | 2 +- .rubocop.yml | 3 +-- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/create_tag.yml diff --git a/.github/workflows/create_tag.yml b/.github/workflows/create_tag.yml new file mode 100644 index 00000000..c835e75a --- /dev/null +++ b/.github/workflows/create_tag.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Create Git tag + +on: + workflow_dispatch: + +permissions: {} + +jobs: + create_tag: + uses: 'voxpupuli/gha-puppet/.github/workflows/create_tag.yml@v4' + with: + allowed_owner: 'voxpupuli' + git_name: 'pccibot' + git_email: '12855858+pccibot@users.noreply.github.com' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + ssh_private_key: ${{ secrets.PCCI_SSH_PRIVATE_KEY }} diff --git a/.github/workflows/prepare_release.yml b/.github/workflows/prepare_release.yml index 2e3cc689..b3725319 100644 --- a/.github/workflows/prepare_release.yml +++ b/.github/workflows/prepare_release.yml @@ -17,11 +17,14 @@ permissions: jobs: release_prep: - uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' + uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v4' with: version: ${{ github.event.inputs.version }} allowed_owner: 'voxpupuli' + git_name: 'pccibot' + git_email: '12855858+pccibot@users.noreply.github.com' secrets: # Configure secrets here: # https://docs.github.com/en/actions/security-guides/encrypted-secrets github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' + ssh_private_key: '${{ secrets.PCCI_SSH_PRIVATE_KEY }}' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a8b1b18..9062a93c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,9 @@ name: Release on: push: tags: - - '*' + # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#onpushbranchestagsbranches-ignoretags-ignore + # https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#filter-pattern-cheat-sheet + - 'v[0-9]+.[0-9]+.[0-9]+' permissions: contents: write @@ -16,7 +18,7 @@ permissions: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v4 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index 7d6d4ee4..fae75b07 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.6.0' +modulesync_config_version: '10.7.0' diff --git a/.rubocop.yml b/.rubocop.yml index ea22bff8..fded90cf 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,7 @@ --- -inherit_from: .rubocop_todo.yml - # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +inherit_from: .rubocop_todo.yml inherit_gem: voxpupuli-test: rubocop.yml From 62fc3ef996f4557750a6ccc50265c9116639a699 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Tue, 14 Apr 2026 16:08:09 +0000 Subject: [PATCH 378/380] modulesync 10.8.0 --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ .msync.yml | 2 +- Gemfile | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bf69968..e9744066 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,29 @@ on: branches: - main - master + workflow_dispatch: + inputs: + beaker_staging_url: + description: |- + URL to a staging Server to test unreleased packages. + We will append the version to the Server and assume all packages are in the same directory. + Only supported for AIO packages. + required: false + type: string + default: 'https://artifacts.voxpupuli.org/openvox-agent' + beaker_collection: + description: |- + When set to staging, we will download the packages from staging_url. + Otherwise we will use the official repos. Supported values: puppet7, puppet8, openvox7, openvox8, staging. + When unset, we will generate a list of supported collections based on metadata.json. + required: false + type: string + beaker_staging_version: + description: |- + The package version we want to test. + Only used for beaker_collection = staging + required: false + type: string concurrency: group: ${{ github.ref_name }} @@ -23,3 +46,7 @@ jobs: puppet: name: Puppet uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v4 + with: + beaker_staging_url: ${{ inputs.beaker_staging_url }} + beaker_collection: ${{ inputs.beaker_collection }} + beaker_staging_version: ${{ inputs.beaker_staging_version }} diff --git a/.msync.yml b/.msync.yml index fae75b07..bfb9bee8 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '10.7.0' +modulesync_config_version: '10.8.0' diff --git a/Gemfile b/Gemfile index e0c85815..12839821 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do gem 'voxpupuli-test', '~> 14.0', :require => false - gem 'puppet_metadata', '~> 6.0', :require => false + gem 'puppet_metadata', '~> 6.1', :require => false end group :development do @@ -14,7 +14,7 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 4.0', :require => false + gem 'voxpupuli-acceptance', '~> 4.4', :require => false end group :release do From 8ff45f7ec378384d9dad7f2f67221b9714420cef Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 4 May 2026 10:17:23 +0200 Subject: [PATCH 379/380] puppet/epel: Allow 6.x --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index a536b318..8788bc5f 100644 --- a/metadata.json +++ b/metadata.json @@ -102,7 +102,7 @@ }, { "name": "puppet/epel", - "version_requirement": ">= 3.0.0 < 6.0.0" + "version_requirement": ">= 3.0.0 < 7.0.0" } ] } From f0345bcb3956b2fc0ec1d11555ce5ad26e0c9a32 Mon Sep 17 00:00:00 2001 From: pccibot <12855858+pccibot@users.noreply.github.com> Date: Tue, 5 May 2026 07:49:26 +0000 Subject: [PATCH 380/380] Release 9.0.0 --- CHANGELOG.md | 32 +++++++++++++++++++++++++++++++- metadata.json | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4c996b..2c8c0db3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,36 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v9.0.0](https://github.com/voxpupuli/puppet-python/tree/v9.0.0) (2026-05-05) + +[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v8.0.0...v9.0.0) + +**Breaking changes:** + +- `init.pp`: remove useless `exec` with `default` title that was trying to set a default `umask` [\#735](https://github.com/voxpupuli/puppet-python/pull/735) ([kenyon](https://github.com/kenyon)) +- Drop puppet, update openvox minimum version to 8.19 [\#729](https://github.com/voxpupuli/puppet-python/pull/729) ([TheMeier](https://github.com/TheMeier)) + +**Implemented enhancements:** + +- puppet/epel: Allow 6.x [\#751](https://github.com/voxpupuli/puppet-python/pull/751) ([bastelfreak](https://github.com/bastelfreak)) +- Add support for Debian 13 [\#740](https://github.com/voxpupuli/puppet-python/pull/740) ([smortex](https://github.com/smortex)) +- Do not pass `--log` to `pip install` [\#736](https://github.com/voxpupuli/puppet-python/pull/736) ([smortex](https://github.com/smortex)) +- Allow a version to start with "v" in `python::pip` [\#727](https://github.com/voxpupuli/puppet-python/pull/727) ([techsk8](https://github.com/techsk8)) + +**Fixed bugs:** + +- Fix group ownership for `pip.conf` on FreeBSD [\#739](https://github.com/voxpupuli/puppet-python/pull/739) ([Szparki](https://github.com/Szparki)) +- Replace legacy fact in gunicorn config templating [\#724](https://github.com/voxpupuli/puppet-python/pull/724) ([notCalle](https://github.com/notCalle)) + +**Closed issues:** + +- "Error: Could not find group root" on FreeBSD [\#738](https://github.com/voxpupuli/puppet-python/issues/738) +- Define pip\_package in hieradata [\#731](https://github.com/voxpupuli/puppet-python/issues/731) + +**Merged pull requests:** + +- Add section in README that simulates `python3 -m pip install pandas --user` [\#725](https://github.com/voxpupuli/puppet-python/pull/725) ([bschonec](https://github.com/bschonec)) + ## [v8.0.0](https://github.com/voxpupuli/puppet-python/tree/v8.0.0) (2025-04-28) [Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v7.4.0...v8.0.0) @@ -495,7 +525,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge - Fix tests: Pin rake for ruby 1.9.3 [\#387](https://github.com/voxpupuli/puppet-python/pull/387) ([waipeng](https://github.com/waipeng)) - Support virtualenv for Ubuntu 16.04 [\#386](https://github.com/voxpupuli/puppet-python/pull/386) ([waipeng](https://github.com/waipeng)) - Set virtualenv package name for Debian stretch [\#383](https://github.com/voxpupuli/puppet-python/pull/383) ([sergiik](https://github.com/sergiik)) -- Update gunicorn.pp - Add manage\_config\_dir [\#382](https://github.com/voxpupuli/puppet-python/pull/382) ([bc-bjoern](https://github.com/bc-bjoern)) +- Update gunicorn.pp - Add manage\_config\_dir [\#382](https://github.com/voxpupuli/puppet-python/pull/382) ([epik0r](https://github.com/epik0r)) - Support latest puppet versions [\#376](https://github.com/voxpupuli/puppet-python/pull/376) ([ghoneycutt](https://github.com/ghoneycutt)) - Add python release as available facts [\#355](https://github.com/voxpupuli/puppet-python/pull/355) ([jcpunk](https://github.com/jcpunk)) - Allow hiera config for dotfiles [\#344](https://github.com/voxpupuli/puppet-python/pull/344) ([puppetninja](https://github.com/puppetninja)) diff --git a/metadata.json b/metadata.json index 8788bc5f..9cd44130 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-python", - "version": "8.0.1-rc0", + "version": "9.0.0", "author": "Vox Pupuli", "summary": "Puppet module for Python", "license": "Apache-2.0",