From 518cc9be5ffc8bb16bc8c2414a8ffc33c4ccdcc1 Mon Sep 17 00:00:00 2001 From: Sean O'Keeffe Date: Thu, 15 Jun 2017 16:24:10 +0100 Subject: [PATCH] Refactor to Puppet 4 types --- manifests/foreman_proxy_content.pp | 12 ++--- manifests/init.pp | 84 +++++++++--------------------- 2 files changed, 29 insertions(+), 67 deletions(-) diff --git a/manifests/foreman_proxy_content.pp b/manifests/foreman_proxy_content.pp index 35b53736..09f91587 100644 --- a/manifests/foreman_proxy_content.pp +++ b/manifests/foreman_proxy_content.pp @@ -4,22 +4,18 @@ # # $parent_fqdn:: FQDN of the parent node. Does not usually # need to be set. -# type:Optional[String] # # $foreman_proxy_fqdn:: FQDN of the foreman proxy -# type:String # # $foreman_proxy_cname:: additional names of the foreman proxy -# type:Array # # $certs_tar:: Path to tar file with certs to generate -# type:Optional[String] # class certs::foreman_proxy_content ( - $parent_fqdn = $::fqdn, - $foreman_proxy_fqdn = $::certs::params::node_fqdn, - $foreman_proxy_cname = $::certs::params::cname, - $certs_tar = $::certs::params::certs_tar, + Optional[String] $parent_fqdn = $::fqdn, + String $foreman_proxy_fqdn = $::certs::params::node_fqdn, + Array[String] $foreman_proxy_cname = $::certs::params::cname, + Optional[String] $certs_tar = $::certs::params::certs_tar, ) inherits certs::params { # until we support again pushing the cert rpms to the Katello, diff --git a/manifests/init.pp b/manifests/init.pp index b09309a8..ad422b29 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,128 +8,94 @@ # # $node_fqdn:: The fqdn of the host the generated certificates # should be for -# type:String # # $cname:: The alternative names of the host the generated certificates # should be for -# type:array # # $server_ca_cert:: Path to the CA that issued the ssl certificates for https # if not specified, the default CA will be used -# type:Optional[Stdlib::Absolutepath] # # $server_cert:: Path to the ssl certificate for https # if not specified, the default CA will generate one -# type:Optional[Stdlib::Absolutepath] # # $server_key:: Path to the ssl key for https # if not specified, the default CA will generate one -# type:Optional[Stdlib::Absolutepath] # # $server_cert_req:: Path to the ssl certificate request for https # if not specified, the default CA will generate one -# type:Optional[Stdlib::Absolutepath] # # === Advanced parameters: # # $log_dir:: Where the log files should go -# type:Stdlib::Absolutepath # # $generate:: Should the generation of the certs be part of the # configuration -# type:Boolean # # $regenerate:: Force regeneration of the certificates (excluding # ca certificates) -# type:Boolean # # $regenerate_ca:: Force regeneration of the ca certificate -# type:Boolean # # $deploy:: Deploy the certs on the configured system. False means # we want apply it on a different system -# type:Boolean # # $ca_common_name:: Common name for the generated CA certificate -# type:String # # $country:: Country attribute for managed certificates -# type:String[2] # # $state:: State attribute for managed certificates -# type:String # # $city:: City attribute for managed certificates -# type:String # # $org:: Org attribute for managed certificates -# type:String # # $org_unit:: Org unit attribute for managed certificates -# type:String # # $expiration:: Expiration attribute for managed certificates -# type:String # # $ca_expiration:: CA expiration attribute for managed certificates -# type:String # # $pki_dir:: The PKI directory under which to place certs -# type:Stdlib::Absolutepath # # $ssl_build_dir:: The directory where SSL keys, certs and RPMs will be generated -# type:Stdlib::Absolutepath # # $user:: The system user name who should own the certs -# type:String # # $group:: The group who should own the certs -# type:String # # $default_ca_name:: The name of the default CA -# type:String # # $server_ca_name:: The name of the server CA (used for https) -# type:String # class certs ( - $log_dir = $::certs::params::log_dir, - $node_fqdn = $::certs::params::node_fqdn, - $cname = $::certs::params::cname, - $generate = $::certs::params::generate, - $regenerate = $::certs::params::regenerate, - $regenerate_ca = $::certs::params::regenerate_ca, - $deploy = $::certs::params::deploy, - $ca_common_name = $::certs::params::ca_common_name, - $country = $::certs::params::country, - $state = $::certs::params::state, - $city = $::certs::params::city, - $org = $::certs::params::org, - $org_unit = $::certs::params::org_unit, - - $expiration = $::certs::params::expiration, - $ca_expiration = $::certs::params::ca_expiration, - - $server_cert = $::certs::params::server_cert, - $server_key = $::certs::params::server_key, - $server_cert_req = $::certs::params::server_cert_req, - $server_ca_cert = $::certs::params::server_ca_cert, - - $pki_dir = $::certs::params::pki_dir, - $ssl_build_dir = $::certs::params::ssl_build_dir, - - $user = $::certs::params::user, - $group = $::certs::params::group, - - $default_ca_name = $::certs::params::default_ca_name, - $server_ca_name = $::certs::params::server_ca_name, + Stdlib::Absolutepath $log_dir = $::certs::params::log_dir, + String $node_fqdn = $::certs::params::node_fqdn, + Array[String] $cname = $::certs::params::cname, + Boolean $generate = $::certs::params::generate, + Boolean $regenerate = $::certs::params::regenerate, + Boolean $regenerate_ca = $::certs::params::regenerate_ca, + Boolean $deploy = $::certs::params::deploy, + String $ca_common_name = $::certs::params::ca_common_name, + String[2,2] $country = $::certs::params::country, + String $state = $::certs::params::state, + String $city = $::certs::params::city, + String $org = $::certs::params::org, + String $org_unit = $::certs::params::org_unit, + String $expiration = $::certs::params::expiration, + String $ca_expiration = $::certs::params::ca_expiration, + Optional[Stdlib::Absolutepath] $server_cert = $::certs::params::server_cert, + Optional[Stdlib::Absolutepath] $server_key = $::certs::params::server_key, + Optional[Stdlib::Absolutepath] $server_cert_req = $::certs::params::server_cert_req, + Optional[Stdlib::Absolutepath] $server_ca_cert = $::certs::params::server_ca_cert, + Stdlib::Absolutepath $pki_dir = $::certs::params::pki_dir, + Stdlib::Absolutepath $ssl_build_dir = $::certs::params::ssl_build_dir, + String $user = $::certs::params::user, + String $group = $::certs::params::group, + String $default_ca_name = $::certs::params::default_ca_name, + String $server_ca_name = $::certs::params::server_ca_name, ) inherits certs::params { if $server_cert { - validate_absolute_path($server_cert) - validate_absolute_path($server_cert_req) - validate_absolute_path($server_key) - validate_absolute_path($server_ca_cert) validate_file_exists($server_cert, $server_cert_req, $server_key, $server_ca_cert) }