voxpupuli / puppet-mcollective

MCollective Server and Client Puppet Module
https://forge.puppet.com/puppet/mcollective
Apache License 2.0
120 stars 178 forks source link

Simplification of plugin installation by source #261

Open Herr-Herner opened 8 years ago

Herr-Herner commented 8 years ago

Because the current mcollective-puppet-agentpackages are unavailable in the current repos, I have created a source based defined resource. It uses some find operations on a directory structure to filter out the proper files for the server and the client side in respect to the matrix provided here: http://docs.puppetlabs.com/mcollective/deploy/plugins.html#about-plugins--available-plugin-types

I have put those resources to my profile, but I dislike the solution. The current state of the resource implementation is the following:

Server-Side:

define profile::mcollective::server::plugin($source, $ensure = 'present') {
  # Target
  $module_path = get_module_path('mcollective')
  $target      = "${module_path}/files/plugins/${name}"
  # Command
  $find    = '/usr/bin/find * -type f \\( -regex "^.*\\.\\(rb\\|ddl\\|erb\\)$" -and \\
  -regex "^\\(agent\\|audit\\|connector\\|data\\|facts\\|registration\\|security\\|util\\|validator\\).*" \\)'
  $command = "mkdir -p ${target} ; ${find} -exec cp --parents {} ${target} \\;"

  exec { "profile::mcollective::server::plugin::${name}":
    command => $command,
    cwd     => $source,
    creates => $target,
    path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
  }

Client-side:

define profile::mcollective::client::plugin ($source, $ensure = 'present') {
  # Target
  $module_path = get_module_path('mcollective')
  $target      = "${module_path}/files/plugins/${name}"
  # Command
  $find    = 'find * -type f \\( -regex "^.*\\.\\(rb\\|ddl\\|erb\\)$" -and \\
  -regex "^\\(agent\\|aggregate\\|application\\|connector\\|data\\|discovery\\|pluginpackager\\|security\\|util\\|validator\\).*" -and \\
    \\( -not -regex "^agent.*" -or -regex "^.*\\.ddl$" \\) -and \\( -not -regex "^data.*" -or -regex "^.*\\.ddl$" \\) \\)'
  $command = "mkdir -p ${target} ; ${find} -exec cp --parents {} ${target} \\;"

  exec { "profile::mcollective::client::plugin::${name}":
    command => $command,
    cwd     => $source,
    creates => $target,
    path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
  }

}

Should I try to inline this feature into the mcollective module? Is someone interested in this feature?

igalic commented 8 years ago

@Herr-Herner i'm very confused as to what this is trying to achieve, and how…

jyaworski commented 8 years ago

What's the status of this?