Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modulesync 3.0.0 & puppet-lint updates #556

Merged
merged 3 commits into from
Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Vox Pupuli Security Policy

Our vulnerabilities reporting process is at https://voxpupuli.org/security/
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.12.0'
modulesync_config_version: '3.0.0'
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ RSpec/RepeatedDescription:
RSpec/NestedGroups:
Enabled: False

RSpec/MultipleExpectations:
Enabled: false

# this is broken on ruby1.9
Layout/IndentHeredoc:
Enabled: False
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
os: linux
dist: bionic
language: ruby
cache: bundler
Expand All @@ -7,7 +8,7 @@ before_install:
- bundle --version
script:
- 'bundle exec rake $CHECK'
matrix:
jobs:
fast_finish: true
include:
- rvm: 2.4.4
Expand Down Expand Up @@ -76,7 +77,7 @@ notifications:
- "chat.freenode.org#voxpupuli-notifications"
deploy:
provider: puppetforge
user: puppet
username: puppet
password:
secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo="
on:
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <| |>
Expand All @@ -27,5 +26,4 @@
}
}
}

}
2 changes: 1 addition & 1 deletion manifests/dotfile.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
1 change: 0 additions & 1 deletion manifests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@
content => template($template),
}
}

}
16 changes: 7 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,31 @@
$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,
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 ? {
'scl' => "/usr/bin/scl enable ${version} -- ",
'rhscl' => "/usr/bin/scl enable ${version} -- ",
default => '',
}

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']}")
}
Expand All @@ -96,5 +95,4 @@
create_resources('python::virtualenv', $python_virtualenvs)
create_resources('python::requirements', $python_requirements)
create_resources('python::dotfile', $python_dotfiles)

}
6 changes: 1 addition & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# include python::install
#
class python::install {

$python = $python::version ? {
'system' => 'python',
'pypy' => 'pypy',
Expand Down Expand Up @@ -67,7 +66,6 @@

case $python::provider {
'pip': {

if $python::manage_pip_package {
package { 'pip':
ensure => $pip_ensure,
Expand Down Expand Up @@ -208,7 +206,7 @@
'AIX': {
if String($python::version) =~ /^python3/ {
class { 'python::pip::bootstrap':
version => 'pip3',
version => 'pip3',
}
} else {
if $python::manage_pip_package {
Expand All @@ -227,7 +225,6 @@
provider => 'yum',
}
}

}
default: {
if $python::manage_pip_package {
Expand All @@ -243,7 +240,6 @@
alias => $pythondev,
}
}

}
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ? {
Expand Down
17 changes: 8 additions & 9 deletions manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -111,9 +111,9 @@
}

$pypi_index = $index ? {
false => '',
default => "--index-url=${index}",
}
false => '',
default => "--index-url=${index}",
}

$proxy_flag = $proxy ? {
undef => '',
Expand Down Expand Up @@ -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}) ]"
Expand Down Expand Up @@ -243,5 +243,4 @@
path => $_path,
provider => $exec_provider,
}

}
4 changes: 2 additions & 2 deletions manifests/pip/bootstrap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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}"],
}
}

Expand Down
4 changes: 2 additions & 2 deletions manifests/pyvenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down
3 changes: 1 addition & 2 deletions manifests/requirements.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
$log_dir = '/tmp',
$timeout = 1800,
) {

include python

if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion manifests/virtualenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '',
Expand Down
4 changes: 2 additions & 2 deletions spec/acceptance/facts_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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+})
Expand All @@ -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+})
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -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 }