Skip to content

Instantly share code, notes, and snippets.

@JayH5
Last active January 26, 2016 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayH5/57f236f74d917442db2b to your computer and use it in GitHub Desktop.
Save JayH5/57f236f74d917442db2b to your computer and use it in GitHub Desktop.
diff --git a/manifests/config.pp b/manifests/config.pp
index 7fbe41a..a7dc508 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -29,21 +29,23 @@ class marathon::config(
}
if ($mesos_auth_principal != undef and $mesos_auth_secret != undef) {
- $secret_options = {
- 'mesos_authentication_principal' => $mesos_auth_principal,
- 'mesos_authentication_secret_file' => $mesos_auth_secret_file,
+ validate_absolute_path($mesos_auth_secret_file)
+ file { $mesos_auth_secret_file:
+ ensure => file,
+ content => $mesos_auth_secret,
+ owner => $owner,
+ group => $group,
+ mode => '0400',
}
- $configure_secrets = true
- } elsif ($options['mesos_authentication_principal'] != undef and $mesos_auth_secret != undef) {
+
$secret_options = {
+ 'mesos_authentication_principal' => $mesos_auth_principal,
'mesos_authentication_secret_file' => $mesos_auth_secret_file,
}
- $configure_secrets = true
+ $real_options = merge($options, $secret_options)
} else {
- $secret_options = {}
- $configure_secrets = false
+ $real_options = $options
}
- $real_options = merge($secret_options, $options)
if $master {
mesos::property { 'marathon_master':
@@ -105,17 +107,4 @@ class marathon::config(
group => $group,
mode => '0644',
}
-
- if ($configure_secrets) {
- $real_mesos_auth_secret_file = $real_options['mesos_authentication_secret_file']
- validate_absolute_path($real_mesos_auth_secret_file)
-
- file { $real_mesos_auth_secret_file:
- ensure => file,
- content => $mesos_auth_secret,
- owner => $owner,
- group => $group,
- mode => '0400',
- }
- }
}
diff --git a/manifests/init.pp b/manifests/init.pp
index f70031c..baf69ff 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -58,13 +58,16 @@
# than that.
#
# [*mesos_auth_principal*]
-# Principal for authentification at mesos master.
+# Principal for authentification at mesos master. If this parameter is not set
+# then the Mesos authentication secret will not be managed.
#
# [*mesos_auth_secret*]
-# Secret for authentification at mesos master.
+# Secret for authentification at mesos master. If this parameter is not set
+# then the Mesos authentication secret will not be managed.
#
# [*mesos_auth_secret_file*]
-# Location for storing the secret. This parameter is merged into $options.
+# Location for storing the secret. If the principal or secret are not provided
+# then this file will not be managed.
#
# [*service_manage*]
# Whether or not to manage the state of the Marathon service with Puppet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment