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 #188

Merged
merged 5 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -60,7 +61,7 @@ notifications:
- "chat.freenode.org#voxpupuli-notifications"
deploy:
provider: puppetforge
user: puppet
username: puppet
password:
secure: "iItNJ/PlMvdSiYjtXWJkS69mF/4XUriTRC6axFoiTgX8BzGNWA1U/anENNyzmhRKcH/Nc0erVeau+RX8vyJ0HmIJOCvYfq5Q/SQWex1fDXLe/UYJkAEWwmeIOVSF2nTEUPDvDn/d6bNEdULw5yrNn1dT8eLqIIXl6/nThdpiS917BX6CeYdojr/mISrLsvihuB5DQRdVzH+hK1bXcECihnOfNH9lQ0lZ2v2ohJiLJL0DadDg0YMMeJMlP7CnBZzRs7fhTPdLMjzCvysef9nqBYRlGBRUn+CaQ4VoQZlWB1JchJup4qCGeU9ANkb8gdKYTy1kFkBrEDuqlUUuuTTMhDpQ+2fGF32zgnXCSnVY8AIriFfO9c1ljxL6k6vaHpfnsPcMrxuQXNeOPGYpVjNGi/Hz8OjuZ3IT07c8SmZgmGaNp+ZIKErJQV0eob0NeA/1P7HheRS5aPEiN8vj/ZGuIGa+BhbTp2riJ599urrSqGDcJ0YzNeW2BvBZQoXs953X4N4yROz4xKMNqPz/jhyGM9w5SBJ/uLiIvKTu+bSsJ2VNyrOOu25eYqzH1zKc71fKiWa1ZOTHKVM24chlmoq3tZTSpSn6OxpptKLxAYZG0IUdFSMy66m8nss1AxL2djScAptugsqpfLqziMArAoN9iWXCeGiWz1qLRl+5AlMrmMY="
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: 1 addition & 1 deletion functions/bool2num_hash_recursive.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function yum::bool2num_hash_recursive($arg) {
Hash => yum::bool2num_hash_recursive($value),
default => $value,
}
Hash({ $key => $return_value })
Hash( { $key => $return_value })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks odd. Why is Hash() needed in he first place? I think the whole map can be removed and put in the reduce.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a stab at it, but couldn't get rid of it. This does suggest a bug in the strict linting. If it at least also allowed a space at the end it would at least be symmetrical, but now it isn't.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I raised voxpupuli/puppet-lint-manifest_whitespace-check#8 for this. Should we continue and merge this as is?. Because the PR fixes some gemfile dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should definitely merge it. A linting issue shouldn't hold up fixes.

}.reduce |$attrs_memo, $kv| {
merge($attrs_memo, $kv)
}
Expand Down
4 changes: 1 addition & 3 deletions manifests/clean.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# A $(yum clean all) Exec to be notified if desired.
class yum::clean {

exec{'yum_clean_all':
exec { 'yum_clean_all':
command => '/usr/bin/yum clean all',
refreshonly => true,
}

}
1 change: 0 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Variant[Boolean, Integer, Enum['absent'], String] $ensure,
String $key = $title,
) {

$_ensure = $ensure ? {
Boolean => bool2num($ensure),
default => $ensure,
Expand Down
1 change: 0 additions & 1 deletion manifests/gpgkey.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
String $group = 'root',
String $mode = '0644'
) {

$_creators = [$content, $source]
$_used_creators = $_creators.filter |$value| { !empty($value) }

Expand Down
1 change: 0 additions & 1 deletion manifests/group.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
Enum['present', 'installed', 'latest', 'absent', 'purged'] $ensure = 'present',
Optional[Integer] $timeout = undef,
) {

Exec {
path => '/bin:/usr/bin:/sbin:/usr/sbin',
environment => 'LC_ALL=C',
Expand Down
9 changes: 4 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
class yum (
Boolean $clean_old_kernels = true,
Boolean $keep_kernel_devel = false,
Hash[String, Variant[String, Integer, Boolean, Hash[String, Variant[String, Integer, Boolean]]]] $config_options = { },
Hash[String, Variant[String, Integer, Boolean, Hash[String, Variant[String, Integer, Boolean]]]] $config_options = {},
Optional[Hash[String, Optional[Hash[String, Variant[String, Integer, Boolean]]]]] $repos = {},
Array[String] $managed_repos = [],
Boolean $manage_os_default_repos = false,
Expand All @@ -105,7 +105,6 @@
Hash[String, Hash[String, String]] $gpgkeys = {},
String $utils_package_name = 'yum-utils',
) {

$module_metadata = load_module_metadata($module_name)
$supported_operatingsystems = $module_metadata['operatingsystem_support']
$supported_os_names = $supported_operatingsystems.map |$os| {
Expand Down Expand Up @@ -162,16 +161,16 @@
}

$_normalized_ensure = $_ensure ? {
Boolean => Hash({ ensure => bool2num($_ensure) }), # lint:ignore:unquoted_string_in_selector
default => Hash({ ensure => $_ensure }), # lint:ignore:unquoted_string_in_selector
Boolean => Hash( { ensure => bool2num($_ensure) }), # lint:ignore:unquoted_string_in_selector
bastelfreak marked this conversation as resolved.
Show resolved Hide resolved
default => Hash( { ensure => $_ensure }), # lint:ignore:unquoted_string_in_selector
}

$_normalized_attrs = $attrs ? {
Hash => merge($attrs, $_normalized_ensure),
default => $_normalized_ensure,
}

Hash({ $key => $_normalized_attrs })
Hash( { $key => $_normalized_attrs })
}.reduce |$memo, $cfg_opt_hash| {
merge($memo, $cfg_opt_hash)
}
Expand Down
1 change: 0 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
Enum['present', 'installed', 'absent', 'purged'] $ensure = 'present',
Optional[Integer] $timeout = undef,
) {

Exec {
path => '/bin:/usr/bin:/sbin:/usr/sbin',
environment => 'LC_ALL=C',
Expand Down
1 change: 0 additions & 1 deletion manifests/plugin/versionlock.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
String $path = '/etc/yum/pluginconf.d/versionlock.list',
Boolean $clean = false,
) {

yum::plugin { 'versionlock':
ensure => $ensure,
}
Expand Down
4 changes: 0 additions & 4 deletions manifests/versionlock.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,12 @@
}

if $facts['package_provider'] == 'yum' and $version =~ Undef {

assert_type(Yum::VersionlockString, $name) |$_expected, $actual | {
fail("Package name must be formatted as %{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}, not \'${actual}\'. See Yum::Versionlock documentation for details.")
}

$_versionlock = "${line_prefix}${name}"

} else {

assert_type(Yum::RpmName, $name) |$_expected, $actual | {
fail("Package name must be formatted as Yum::RpmName, not \'${actual}\'. See Yum::Rpmname documentation for details.")
}
Expand All @@ -89,7 +86,6 @@
'yum' => "${line_prefix}${epoch}:${name}-${version}-${release}.${arch}",
default => "${line_prefix}${name}-${epoch}:${version}-${release}.${arch}",
}

}

unless $ensure == 'absent' {
Expand Down
10 changes: 6 additions & 4 deletions spec/defines/versionlock_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,17 @@
end

let(:title) { 'bash' }
let(:params) { { version: '4.3' } }

context 'with version set' do
it { is_expected.to compile.with_all_deps }
let(:params) { { version: '4.3' } }

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("0:bash-4.3-*.*\n")
end
end

context 'with version, release, epoch and arch set' do
it { is_expected.to compile.with_all_deps }
let(:params) do
{
version: '4.3',
Expand All @@ -120,8 +119,11 @@
}
end

it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("42:bash-4.3-3.2.arm\n")
context 'it works' do
it { is_expected.to compile.with_all_deps }
it 'contains a well-formed Concat::Fragment' do
is_expected.to contain_concat__fragment("yum-versionlock-#{title}").with_content("42:bash-4.3-3.2.arm\n")
end
end
end
end
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 }