Skip to content
Snippets Groups Projects
Commit 710e797f authored by Thomas Bellman's avatar Thomas Bellman
Browse files

Finish splitting into individual files.

I had actually not finished breaking out all definitions and classes
to their own individual files in commit c5ae6d50; those that manage
grid host certificates were still left in init.pp, and obviously I
did not look very carefully before committing...  Time to finish the
job properly.
parent be9a53c1
No related branches found
No related tags found
No related merge requests found
# Copyright © 2015-2020 National Supercomputer Centre,
# Linköping University, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Convenience class for managing the grid host certificate.
* This class installs the grid host certificate, from ${fqdn}-cert.pem
* and ${fqdn}-key.pem at the source. Overrides ..::default_absent.
*
* See x509certs::hostcert::gridcert::manage for details.
* See also the classes x509certs::hostcert::gridcert::default_absent
* and x509certs::hostcert::gridcert::absent.
*/
class x509certs::hostcert::gridcert
inherits x509certs::hostcert::gridcert::default_absent
{
X509certs::Hostcert::Gridcert::Manage[$::fqdn] {
ensure => 'present',
}
}
# Copyright © 2015-2020 National Supercomputer Centre,
# Linköping University, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Convenience class for managing the grid host certificate.
* This class makes sure the grid host certificate is absent, overriding
* the x509certs::hostcert::gridcert class.
*
* See x509certs::hostcert::gridcert::manage for details.
* See also the classes x509certs::hostcert::gridcert::default_absent
* and x509certs::hostcert::gridcert.
*/
class x509certs::hostcert::gridcert::absent
inherits x509certs::hostcert::gridcert
{
X509certs::Hostcert::Gridcert::Manage[$::fqdn] {
ensure => 'absent',
}
}
# Copyright © 2015-2020 National Supercomputer Centre,
# Linköping University, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Convenience class for managing the grid host certificate.
* This class is useful as a default for nodes, to make sure that the
* host certificate is absent by default.
*
* See x509certs::hostcert::gridcert::manage for details.
* See also the classes x509certs::hostcert::gridcert and
* x509certs::hostcert::gridcert::absent.
*/
class x509certs::hostcert::gridcert::default_absent
{
x509certs::hostcert::gridcert::manage {
$::fqdn:
ensure => 'absent';
}
}
# Copyright © 2015-2020 National Supercomputer Centre,
# Linköping University, Sweden
# Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Manage a "grid host certificate".
*
* A grid host certificate is installed in the /etc/grid-security
* directory under the name "hostcert.pem" and "hostkey.pem" instead
* of in the usual directories. There is also no provision for having
* a CA chain file; CA chains are expected to be managed by installing
* CA certificates in /etc/grid-security/certificates, using the
* x509certs::gridca definition. This is how many grid applications,
* e.g. dCache or NorduGrid ARC, want their certificates.
*
* $x509certs::config::hostcert_source is used to find the
* certificate and key files, unless overriden by the $source
* parameter. Certificate and key files at the source are expected
* to be named "${name}-cert.pem" and "${name}-key.pem".
*
* Despite being a definition, it really is a singleton. This is
* mostly intended as a helper for the x509certs::hostcert::gridcert
* classes below.
*/
define x509certs::hostcert::gridcert::manage($source='', $ensure='present')
{
include x509certs
include x509certs::config
$sourcebase = $source ? {
'' => $x509certs::config::hostcert_source,
default => $source
}
case $ensure
{
'present': {
include x509certs::grid_security_dir
file {
"${x509certs::grid_secdir}/hostcert.pem":
source => "${sourcebase}/${name}-cert.pem",
owner => 'root', group => 'root', mode => '0644';
"${x509certs::grid_secdir}/hostkey.pem":
source => "${sourcebase}/${name}-key.pem",
owner => 'root', group => 'root', mode => '0400';
}
}
'absent': {
file {
"${x509certs::grid_secdir}/hostcert.pem":
ensure => absent;
"${x509certs::grid_secdir}/hostkey.pem":
ensure => absent;
}
}
default: {
fail("X509certs::Hostcert::Gridcert[${title}]:",
"Bad parameter ensure, ``${ensure}''")
}
}
}
...@@ -3,108 +3,6 @@ ...@@ -3,108 +3,6 @@
# Licensed under the GNU LGPL v3+; see the README file for more information. # Licensed under the GNU LGPL v3+; see the README file for more information.
/*
* Manage a "grid host certificate".
*
* A grid host certificate is installed in the /etc/grid-security
* directory under the name "hostcert.pem" and "hostkey.pem" instead
* of in the usual directories. There is also no provision for having
* a CA chain file; CA chains are expected to be managed by installing
* CA certificates in /etc/grid-security/certificates, using the
* x509certs::gridca definition. This is how many grid applications,
* e.g. dCache or NorduGrid ARC, want their certificates.
*
* $x509certs::config::hostcert_source is used to find the
* certificate and key files, unless overriden by the $source
* parameter. Certificate and key files at the source are expected
* to be named "${name}-cert.pem" and "${name}-key.pem".
*
* Despite being a definition, it really is a singleton. This is
* mostly intended as a helper for the x509certs::hostcert::gridcert
* classes below.
*/
define x509certs::hostcert::gridcert::manage($source='', $ensure='present')
{
include x509certs
include x509certs::config
$sourcebase = $source ? {
'' => $x509certs::config::hostcert_source,
default => $source
}
case $ensure
{
'present': {
include x509certs::grid_security_dir
file {
"${x509certs::grid_secdir}/hostcert.pem":
source => "${sourcebase}/${name}-cert.pem",
owner => 'root', group => 'root', mode => '0644';
"${x509certs::grid_secdir}/hostkey.pem":
source => "${sourcebase}/${name}-key.pem",
owner => 'root', group => 'root', mode => '0400';
}
}
'absent': {
file {
"${x509certs::grid_secdir}/hostcert.pem":
ensure => absent;
"${x509certs::grid_secdir}/hostkey.pem":
ensure => absent;
}
}
default: {
fail("X509certs::Hostcert::Gridcert[${title}]:",
"Bad parameter ensure, ``${ensure}''")
}
}
}
/*
* Convenience classes for managing the grid host certificate:
*
* - x509certs::hostcert::gridcert::default_absent
* Usable as a default for nodes, to make sure the host certificate
* is absent by default.
*
* - x509certs::hostcert::gridcert
* Install the grid host certificate, from ${fqdn}-cert.pem and
* ${fqdn}-key.pem at the source. Overrides ..::default_absent.
*
* - x509certs::hostcert::gridcert::absent
* Make sure the grid host certificate is absent, overriding the
* ...::present class.
*
* See the x509certs::hostcert::gridcert::manage for information about
* details.
*/
class x509certs::hostcert::gridcert::default_absent
{
x509certs::hostcert::gridcert::manage { $::fqdn: ensure => 'absent'; }
}
class x509certs::hostcert::gridcert
inherits x509certs::hostcert::gridcert::default_absent
{
X509certs::Hostcert::Gridcert::Manage[$::fqdn] { ensure => 'present', }
}
class x509certs::hostcert::gridcert::absent
inherits x509certs::hostcert::gridcert
{
X509certs::Hostcert::Gridcert::Manage[$::fqdn] { ensure => 'absent', }
}
/* /*
* Directory locations and other constants. * Directory locations and other constants.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment