puppet-mesos icon indicating copy to clipboard operation
puppet-mesos copied to clipboard

Turn actions in the superclass into a define.

Open domq opened this issue 9 years ago • 1 comments

As per the recommendation of https://stackoverflow.com/questions/15627779/#answer-15628828 : this technique allows default values to propagate to the common (superclass) actions, without being forced to use a global value setting mechanism such as Hiera.

  • The define takes all its information as parameters, except for $mesos_ensure that it simply closes over in the parent class ($mesos_ensure is a private variable and there is little point in overriding it; users would want to set $version instead)
  • In call sites (both subclasses), pass all parameters along from the current scope, that is, the superclass if no overrides take place - thus keeping the correct data flow when Hiera is in use
  • Hoist file { $conf_dir: } into mesos::common (was previously a duplicate resource between superclass and derived class, yet working for some reason)

domq avatar Jun 03 '15 15:06 domq

See my use case. Without this PR, /etc/mesos/zk doesn't get created, and in fact it gets deleted by Puppet if created manually (due to the superclass-level default value of $zookeeper being the empty string). The whole epfl-sti/cluster.foreman project doesn't currently depend on Hiera so I'm unable / unwilling to feed the value for $mesos::zookeeper that way.

domq avatar Jun 03 '15 16:06 domq