Skip to content

Commit

Permalink
Resolve puppet-lint (#81)
Browse files Browse the repository at this point in the history
Co-authored-by: Raphaël Pinson <[email protected]>
  • Loading branch information
jcpunk and raphink authored Jan 18, 2021
1 parent 2545522 commit b2190b5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions manifests/files.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ensure no file not managed by puppet ends up in there.
file { $lens_dir:
ensure => directory,
purge => $::augeas::purge,
purge => $augeas::purge,
force => true,
recurse => true,
recurselimit => 1,
Expand All @@ -29,7 +29,7 @@

file { "${lens_dir}/tests":
ensure => directory,
purge => $::augeas::purge,
purge => $augeas::purge,
force => true,
mode => '0644',
owner => $augeas::files_owner,
Expand Down
6 changes: 2 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
String $files_owner = 'root',
String $files_group = 'root',
$version = present,
$ruby_package = $::augeas::params::ruby_pkg,
$ruby_package = $augeas::params::ruby_pkg,
$ruby_version = present,
$lens_dir = $::augeas::params::lens_dir,
$lens_dir = $augeas::params::lens_dir,
$purge = true,
) inherits augeas::params {

if versioncmp($::puppetversion, '4.0.0') >= 0 {
contain 'augeas::files'
} else {
Expand All @@ -27,5 +26,4 @@

Package['ruby-augeas', $augeas::params::augeas_pkgs] -> Augeas <| |> # lint:ignore:spaceship_operator_without_tag
}

}
3 changes: 1 addition & 2 deletions manifests/lens.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$test_source = undef,
$stock_since = false,
) {
include ::augeas
include augeas

if $lens_source != undef {
if $lens_content != undef {
Expand Down Expand Up @@ -59,7 +59,6 @@
}

if (!$stock_since or versioncmp($::augeasversion, $stock_since) < 0) {

assert_type(Pattern[/^\/.*/], $augeas::lens_dir)

$lens_name = "${name}.aug"
Expand Down
8 changes: 4 additions & 4 deletions manifests/packages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# Sets up packages for Augeas
#
class augeas::packages {
package { $::augeas::params::augeas_pkgs:
ensure => $::augeas::version,
package { $augeas::params::augeas_pkgs:
ensure => $augeas::version,
}

package { 'ruby-augeas':
ensure => $::augeas::ruby_version,
name => $::augeas::ruby_package,
ensure => $augeas::ruby_version,
name => $augeas::ruby_package,
}
}
6 changes: 2 additions & 4 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Default parameters for the Augeas module
#
class augeas::params {

case $::osfamily {
'RedHat': {
$ruby_pkg = $::operatingsystem ? {
Expand All @@ -23,7 +22,7 @@
# SLES 11 SP3
$ruby_pkg = 'ruby1.8-rubygem-ruby-augeas'
}
$augeas_pkgs = ['augeas', 'augeas-lenses', 'libaugeas0' ]
$augeas_pkgs = ['augeas', 'augeas-lenses', 'libaugeas0']
}

'Debian': {
Expand All @@ -48,7 +47,7 @@
$augeas_pkgs = ['augeas']
}

default: { fail("Unsupported OS family: ${::osfamily}") }
default: { fail("Unsupported OS family: ${facts['os']['family']}") }
}

if versioncmp($::puppetversion, '4.0.0') >= 0 {
Expand All @@ -59,5 +58,4 @@
} else {
$lens_dir = '/usr/share/augeas/lenses'
}

}
5 changes: 5 additions & 0 deletions spec/classes/augeas_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
let(:facts) do
{
osfamily: 'MS-DOS',
os: { family: 'MS-DOS' },
}
end

Expand Down Expand Up @@ -43,6 +44,7 @@
case facts[:lsbdistcodename]
when 'squeeze', 'lucid', 'precise'
let(:facts) do
super().merge(ruby: { version: '1.8.7' })
super().merge(rubyversion: '1.8.7')
end

Expand All @@ -54,6 +56,7 @@
}
else
let(:facts) do
super().merge(ruby: { version: '1.9.3' })
super().merge(rubyversion: '1.9.3')
end

Expand Down Expand Up @@ -136,6 +139,7 @@
case facts[:lsbdistcodename]
when 'squeeze', 'lucid', 'precise'
let(:facts) do
super().merge(ruby: { version: '1.8.7' })
super().merge(rubyversion: '1.8.7')
end

Expand All @@ -147,6 +151,7 @@
}
else
let(:facts) do
super().merge(ruby: { version: '1.9.3' })
super().merge(rubyversion: '1.9.3')
end

Expand Down
2 changes: 2 additions & 0 deletions spec/defines/augeas_lens_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
end

let(:facts) do
super().merge(augeas: { version: '1.0.0' })
super().merge(augeasversion: '1.0.0')
end

Expand All @@ -72,6 +73,7 @@
end

let(:facts) do
super().merge(augeas: { version: '1.3.0' })
super().merge(augeasversion: '1.3.0')
end

Expand Down

0 comments on commit b2190b5

Please sign in to comment.