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

(maint) Fixes for Forge score #47

Merged
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
25 changes: 7 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,16 @@ begin
rescue LoadError
end

Rake::Task[:lint].clear

PuppetLint.configuration.relative = true
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}"
PuppetLint.configuration.fail_on_warnings = true

# Forsake support for Puppet 2.6.2 for the benefit of cleaner code.
# http://puppet-lint.com/checks/class_parameter_defaults/
PuppetLint.configuration.send('disable_class_parameter_defaults')
# http://puppet-lint.com/checks/class_inherits_from_params_class/
PuppetLint.configuration.send('relative')
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_documentation')
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
PuppetLint.configuration.send('disable_only_variable_string')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

exclude_paths = [
"bundle/**/*",
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths
PuppetSyntax.exclude_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Run acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
Expand Down
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

validate_re($arch, ['^x86$','^x64$','^i386$','^amd64$','^x86_64$','^power$'])

if versioncmp("$::clientversion", '3.8.0') < 0 {
if versioncmp("${::clientversion}", '3.8.0') < 0 {
fail('upgrading requires Puppet 3.8')
}
elsif versioncmp("$::clientversion", '4.0.0') >= 0 {
elsif versioncmp("${::clientversion}", '4.0.0') >= 0 {
info('puppet_agent performs no actions on Puppet 4+')
}
else {
Expand Down
8 changes: 4 additions & 4 deletions manifests/osfamily/debian.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@


apt::source { 'pc1_repo':
location => $source,
repos => 'PC1',
key => {
location => $source,
repos => 'PC1',
key => {
'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30',
'server' => 'pgp.mit.edu',
},
notify => Notify['pc1_repo_force'],
notify => Notify['pc1_repo_force'],
}

# apt_update doesn't inherit the future class dependency, so it
Expand Down
14 changes: 7 additions & 7 deletions manifests/osfamily/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
}

yumrepo { 'pc1_repo':
baseurl => $source,
descr => "Puppet Labs PC1 Repository",
enabled => true,
gpgcheck => '1',
gpgkey => "file://$gpg_path",
sslcacert => $_sslcacert_path,
baseurl => $source,
descr => 'Puppet Labs PC1 Repository',
enabled => true,
gpgcheck => '1',
gpgkey => "file://${gpg_path}",
sslcacert => $_sslcacert_path,
sslclientcert => $_sslclientcert_path,
sslclientkey => $_sslclientkey_path,
sslclientkey => $_sslclientkey_path,
}
}

18 changes: 9 additions & 9 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
$path_separator = ':'
}
'windows' : {
$confdir = $puppet_confdir
$mco_dir = $mco_confdir
$confdir = $::puppet_confdir
$mco_dir = $::mco_confdir

$mcodirs = [$mco_dir] # Directories should already exists as they have not changed
$puppetdirs = [regsubst($confdir,'\/etc\/','/code/')]
Expand All @@ -50,12 +50,12 @@
}
}

$ssldir = "$confdir/ssl"
$config = "$confdir/puppet.conf"
$ssldir = "${confdir}/ssl"
$config = "${confdir}/puppet.conf"

$mco_server = "$mco_dir/server.cfg"
$mco_client = "$mco_dir/client.cfg"
$mco_libdir = "$mco_install/plugins"
$mco_plugins = "$mco_dir/facts.yaml"
$mco_log = "$logdir/mcollective.log"
$mco_server = "${mco_dir}/server.cfg"
$mco_client = "${mco_dir}/client.cfg"
$mco_libdir = "${mco_install}/plugins"
$mco_plugins = "${mco_dir}/facts.yaml"
$mco_log = "${logdir}/mcollective.log"
}
4 changes: 2 additions & 2 deletions manifests/prepare/mco_client_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

$mco_client = $::puppet_agent::params::mco_client
file { $mco_client:
ensure => file,
source => $::mco_client_config,
ensure => file,
source => $::mco_client_config,
}

if $::mco_client_settings {
Expand Down
4 changes: 2 additions & 2 deletions manifests/prepare/mco_server_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

$mco_server = $::puppet_agent::params::mco_server
file { $mco_server:
ensure => file,
source => $::mco_server_config,
ensure => file,
source => $::mco_server_config,
}

if $::mco_server_settings {
Expand Down
3 changes: 2 additions & 1 deletion manifests/prepare/puppet_config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
}

# manage puppet.conf contents, using inifile module
['master', 'agent', 'main'].each |$section| {
['master', 'agent', 'main'].each |$loop_section| {
$section = $loop_section
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lint is dumb.

manifests/prepare/puppet_config.pp - WARNING: top-scope variable being used without an explicit namespace on line 29
manifests/prepare/puppet_config.pp - WARNING: top-scope variable being used without an explicit namespace on line 31

[# Removed settings
'allow_variables_with_dashes', 'async_storeconfigs', 'binder', 'catalog_format', 'certdnsnames',
'certificate_expire_warning', 'couchdb_url', 'dbadapter', 'dbconnections', 'dblocation', 'dbmigrate', 'dbname',
Expand Down
14 changes: 7 additions & 7 deletions manifests/prepare/ssl.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

$ssl_dir = $::puppet_agent::params::ssldir
file { $ssl_dir:
ensure => directory,
source => $::puppet_ssldir,
backup => false,
recurse => false,
ensure => directory,
source => $::puppet_ssldir,
backup => false,
recurse => false,
}

$sslpaths = {
Expand All @@ -37,9 +37,9 @@
# The only one that's a file, not a directory.
if $::puppet_sslpaths['hostcrl']['path_exists'] {
file { "${ssl_dir}/crl.pem":
ensure => file,
source => $::puppet_sslpaths['hostcrl']['path'],
backup => false
ensure => file,
source => $::puppet_sslpaths['hostcrl']['path'],
backup => false
}
}
}
14 changes: 7 additions & 7 deletions manifests/windows/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@
}

$_msi_location = $_source ? {
/^puppet:/ => "${env_temp_variable}\\puppet-agent.msi",
/^puppet:/ => "${::env_temp_variable}\\puppet-agent.msi",
default => $_source,
}

if $_source =~ /^puppet:/ {
file{ $_msi_location:
source => $_source,
before => File["${env_temp_variable}\\install_puppet.bat"],
before => File["${::env_temp_variable}\\install_puppet.bat"],
}
}

$_cmd_location = $::rubyplatform ? {
/i386/ => "C:\\Windows\\system32\\cmd.exe",
/i386/ => 'C:\\Windows\\system32\\cmd.exe',
default => "${::system32}\\cmd.exe"
}

$_timestamp = strftime('%Y_%m_%d-%H_%M')
$_logfile = "${env_temp_variable}\\puppet-${_timestamp}-installer.log"
$_logfile = "${::env_temp_variable}\\puppet-${_timestamp}-installer.log"
notice ("Puppet upgrade log file at ${_logfile}")
debug ("Installing puppet from ${_msi_location}")
file { "${env_temp_variable}\\install_puppet.bat":
file { "${::env_temp_variable}\\install_puppet.bat":
ensure => file,
content => template('puppet_agent/install_puppet.bat.erb')
}->
exec { 'install_puppet.bat':
command => "${::system32}\\cmd.exe /c start /b ${_cmd_location} /c \"${env_temp_variable}\\install_puppet.bat\"",
path => $::path,
command => "${::system32}\\cmd.exe /c start /b ${_cmd_location} /c \"${::env_temp_variable}\\install_puppet.bat\"",
path => $::path,
}
}
6 changes: 6 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 3.8.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}
],
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 4.6.0"},
{"name":"puppetlabs-inifile","version_requirement":">= 1.2.0"},
Expand Down