Browse Source

Simplify the definition of required parameters

This patch removes the redundant logics to fail when some of the
required parameters are missing, by the built-in behavior to define
required parameters.

Change-Id: Ieebd67e2551709731ebd11957d28d1762ec308d4
changes/81/759781/1
Takashi Kajinami 2 years ago
parent
commit
6ffe4898a9
  1. 22
      manifests/plugins/kmip.pp
  2. 26
      manifests/plugins/p11_crypto.pp

22
manifests/plugins/kmip.pp

@ -4,6 +4,12 @@
#
# === Parameters
#
# [*kmip_plugin_host*]
# (required) username for KMIP device
#
# [*kmip_plugin_port*]
# (required) port for KMIP device
#
# [*kmip_plugin_username*]
# (optional) username for KMIP device
# Defaults to undef
@ -13,12 +19,6 @@
# when the kmip_plugin_username parameter is set.
# Defaults to undef
#
# [*kmip_plugin_host*]
# (required) username for KMIP device
#
# [*kmip_plugin_port*]
# (required) port for KMIP device
#
# [*kmip_plugin_keyfile*]
# (optional) key file for KMIP device. This parameter is required when
# the kmip_plugin_username parameter is not set.
@ -39,10 +39,10 @@
# Defaults to false
#
class barbican::plugins::kmip (
$kmip_plugin_host,
$kmip_plugin_port,
$kmip_plugin_username = undef,
$kmip_plugin_password = undef,
$kmip_plugin_host = undef,
$kmip_plugin_port = undef,
$kmip_plugin_keyfile = undef,
$kmip_plugin_certfile = undef,
$kmip_plugin_ca_certs = undef,
@ -51,12 +51,6 @@ class barbican::plugins::kmip (
include barbican::deps
if $kmip_plugin_host == undef {
fail('kmip_plugin_host must be defined')
}
if $kmip_plugin_port == undef {
fail('kmip_plugin_port must be defined')
}
if $kmip_plugin_username != undef {
if $kmip_plugin_password == undef {
fail('kmip_plugin_password must be defined if kmip_plugin_username is defined')

26
manifests/plugins/p11_crypto.pp

@ -56,11 +56,11 @@
# Defaults to false
#
class barbican::plugins::p11_crypto (
$p11_crypto_plugin_library_path = undef,
$p11_crypto_plugin_login = undef,
$p11_crypto_plugin_mkek_label = undef,
$p11_crypto_plugin_mkek_length = undef,
$p11_crypto_plugin_hmac_label = undef,
$p11_crypto_plugin_library_path,
$p11_crypto_plugin_login,
$p11_crypto_plugin_mkek_label,
$p11_crypto_plugin_mkek_length,
$p11_crypto_plugin_hmac_label,
$p11_crypto_plugin_token_serial_number = $::os_service_default,
$p11_crypto_plugin_token_label = $::os_service_default,
$p11_crypto_plugin_slot_id = $::os_service_default,
@ -73,22 +73,6 @@ class barbican::plugins::p11_crypto (
include barbican::deps
if $p11_crypto_plugin_library_path == undef {
fail('p11_crypto_plugin_library_path must be defined')
}
if $p11_crypto_plugin_login == undef {
fail('p11_crypto_plugin_login must be defined')
}
if $p11_crypto_plugin_mkek_label == undef {
fail('p11_crypto_plugin_mkek_label must be defined')
}
if $p11_crypto_plugin_mkek_length == undef {
fail('p11_crypto_plugin_mkek_length must be defined')
}
if $p11_crypto_plugin_hmac_label == undef {
fail('p11_crypto_plugin_hmac_label must be defined')
}
barbican_config {
'p11_crypto_plugin/library_path': value => $p11_crypto_plugin_library_path;
'p11_crypto_plugin/login': value => $p11_crypto_plugin_login;

Loading…
Cancel
Save