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

General code modernisation - assorted bugfixes. #46

Merged
merged 17 commits into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from 16 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
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
puppet_version: ">= 6.0.0"
51 changes: 43 additions & 8 deletions manifests/ca.pp
Original file line number Diff line number Diff line change
@@ -1,21 +1,56 @@
# @summary
# Creates per CA configuration files.
#
# @example
# fetchcrl::ca{'EDG-Tutorial-CA':
# agingtolerance => 168
# }
#
# @param name
# The name of the CA to manage a configuration for.
#
# @param anchorname
# The name of the CA to manage a configuration for.
#
# @param nowarnings
# Should warnings be supressed for this CA.
#
# @param noerrors
# Should errors be supressed for this CA.
#
# @param httptimeout
# The timeout for this CA.
#
# @param agingtolerance
# The delay if failures before it is considered an error.
#
# @param crl_url
# A list of URLs to download CAs from
#
define fetchcrl::ca(
$anchorname = $title,
$nowarnings = true,
$noerrors = true,
$httptimeout = undef,
$agingtolerance = undef,
$crl_url = []
String[1] $anchorname = $title,
Boolean $nowarnings = false,
Boolean $noerrors = false,
Optional[Integer] $httptimeout = undef,
Optional[Integer] $agingtolerance = undef,
Array[Stdlib::Httpurl] $crl_url = [],
) {

include '::fetchcrl'
include 'fetchcrl'

file{"/etc/${::fetchcrl::pkgname}.d/${anchorname}.conf":
traylenator marked this conversation as resolved.
Show resolved Hide resolved
ensure => file,
mode => '0644',
owner => root,
group => root,
content => template('fetchcrl/fetch-crl-anchor.conf.erb'),
content => epp('fetchcrl/fetch-crl-anchor.conf.epp',{
'anchorname' => $anchorname,
'agingtolerance' => $agingtolerance,
'nowarnings' => $nowarnings,
'noerrors' => $noerrors,
'httptimeout' => $httptimeout,
'crl_url' => $crl_url,
}),
}
}

20 changes: 17 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
# Configures fetch-crl
#
#
# @api private
#
class fetchcrl::config (
$agingtolerance = $fetchcrl::agingtolerance,
$nosymlinks = $fetchcrl::nosymlinks,
$nowarnings = $fetchcrl::nowarnings,
$noerrors = $fetchcrl::noerrors,
$http_proxy = $fetchcrl::http_proxy,
$httptimeout = $fetchcrl::httptimeout,
$parallelism = $fetchcrl::parallelism,
$logmode = $fetchcrl::logmode,
$pkgname = $fetchcrl::pkgname,
$cache_control_request = $fetchcrl::cache_control_request,
) inherits fetchcrl {
) {

assert_private()

file{"/etc/${pkgname}.conf":
ensure => present,
content => template('fetchcrl/fetch-crl.conf.erb'),
content => epp('fetchcrl/fetch-crl.conf.epp',{
'agingtolerance' => $agingtolerance,
'nosymlinks' => $nosymlinks,
'nowarnings' => $nowarnings,
'noerrors' => $noerrors,
'http_proxy' => $http_proxy,
'httptimeout' => $httptimeout,
'parallelism' => $parallelism,
'logmode' => $logmode,
'cache_control_request' => $cache_control_request,
}),
mode => '0644',
owner => root,
group => root,
Expand Down
116 changes: 89 additions & 27 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,32 +1,94 @@
#Class: fetchcrl
## Parameters
## *pkgversion*
# Version of fetch-crl, defaults to present.

# fetchcrl
#
# @summary
# Main class, installs fetch-crl and configured it.
# https://wiki.nikhef.nl/grid/FetchCRL3
#
# @example
# class{'fetchcrl':
# http_proxy => 'http:://squid.example.org:8000',
# carepo => 'http://yum.example.org/yumrepo',
# cache_control_request => '3600',
# }
#
# @param capkgs
# CA policy packages to install.
#
# @param carepo
# Repository URL of CA packages.
#
# @param manage_carepo
# Should package repository be configured.
#
# @param capkgs_version
# Version of CA packages.
#
# @param pkg_version
# Version of fetch-crl package.
#
# @param agingtolerance
# Number of hours delay time before errors are generated in case downloads consistently fail.
#
# @param nosymlinks
# do not create serial number symlinks.
#
# @param noerrors
# do not produce errors.
#
# @param nowarnings
# do not produce warnings.
#
# @param http_proxy
# List of http proxy URLs.
#
# @param httptimeout
# Time out for http.
#
# @param parallelism
# Number of fetchs to run concurrently.
#
# @param logmode
# Specify how logging is done.
#
# @param pkgname
# Name of fetch-crl package.
#
# @param runatboot
# Should fetch-crl be ran at boot time.
#
# @param runcron
# Should fetch-crl be run as a cron job.
#
# @param cache_control_request
# sends a cache-control max-age hint in seconds towards the server in the HTTP request.
#
class fetchcrl (
$capkgs = $fetchcrl::params::capkgs,
$carepo = $fetchcrl::params::carepo,
$manage_carepo = $fetchcrl::params::manage_carepo,
$capkgs_version = $fetchcrl::params::capkgs_version,
$pkg_version = $fetchcrl::params::pkg_version,
$agingtolerance = $fetchcrl::params::agingtolerance,
$nosymlinks = $fetchcrl::params::nosymlinks,
$nowarnings = $fetchcrl::params::nowarnings,
$http_proxy = $fetchcrl::params::http_proxy,
$httptimeout = $fetchcrl::params::httptimeout,
$parallelism = $fetchcrl::params::parallelism,
$logmode = $fetchcrl::params::logmode,
$pkgname = $fetchcrl::params::pkgname,
$runboot = $fetchcrl::params::runboot,
$runcron = $fetchcrl::params::runcron,
$cache_control_request = $fetchcrl::params::cache_control_request,

) inherits fetchcrl::params {
Array[String[1]] $capkgs = ['ca-policy-egi-core'],
Stdlib::Httpurl $carepo = 'http://repository.egi.eu/sw/production/cas/1/current/',
Boolean $manage_carepo = true,
String $capkgs_version = 'present',
String $pkg_version = 'present',
Integer $agingtolerance = 24,
Boolean $nosymlinks = true,
Boolean $nowarnings = true,
Boolean $noerrors = false,
Optional[Stdlib::Httpurl] $http_proxy = undef,
Integer $httptimeout = 30,
Integer $parallelism = 4,
Enum['direct','qualified',
'cache','syslog'] $logmode = 'syslog',
String[1] $pkgname = 'fetch-crl',
Boolean $runboot = false,
Boolean $runcron = true,
Optional[Integer] $cache_control_request = undef,
) {

Class['fetchcrl::install'] -> Class['fetchcrl::config'] -> Class['fetchcrl::service']
contain 'fetchcrl::install'
contain 'fetchcrl::config'
contain 'fetchcrl::service'

class{'::fetchcrl::install':}
class{'::fetchcrl::config':}
class{'::fetchcrl::service':}
Class['fetchcrl::install']
-> Class['fetchcrl::config']
~> Class['fetchcrl::service']

}
20 changes: 13 additions & 7 deletions manifests/install.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#Class fetchcrl::install
# @summary
# Installs fetch-crl
#
# @api private
#
class fetchcrl::install (
$pkgname = $fetchcrl::pkgname,
$capkgs = $fetchcrl::capkgs,
$carepo = $fetchcrl::carepo,
$manage_carepo = $fetchcrl::manage_carepo,
$pkgname = $fetchcrl::pkgname,
$capkgs = $fetchcrl::capkgs,
$carepo = $fetchcrl::carepo,
$manage_carepo = $fetchcrl::manage_carepo,
$capkgs_version = $fetchcrl::capkgs_version,
$pkg_version = $fetchcrl::pkg_version
) inherits fetchcrl {
$pkg_version = $fetchcrl::pkg_version
) {

assert_private()

# The fetch-crl package.
package{$pkgname:
Expand Down
58 changes: 0 additions & 58 deletions manifests/params.pp

This file was deleted.

11 changes: 8 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#Class: fetchcrl::service
# @summary
# Controls fetch-crl cron and startup
#
# @api private
#
class fetchcrl::service (
$pkgname = $fetchcrl::pkgname,
$runboot = $fetchcrl::runboot,
$runcron = $fetchcrl::runcron,
) inherits fetchcrl {
) {

assert_private()

service { "${pkgname}-boot":
ensure => $runboot,
Expand All @@ -16,6 +22,5 @@
enable => $runcron,
hasstatus => true,
hasrestart => true,
require => Class['fetchcrl::install'];
}
}
5 changes: 4 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"x509"
],
"dependencies": [

{
"name": "puppetlabs-stdlib",
"version_requirement": ">= 4.13.1 < 6.0.0"
}
],
"requirements": [
{
Expand Down
Loading