Skip to content

Commit

Permalink
(SIMP-4512) Improve pluginsync_on (#63)
Browse files Browse the repository at this point in the history
Before this commit, `pluginsync_on` only synced facts and used many
expensive `on()` methods that scaled poorly with both modules and hosts.

This patch reimplements the method using a simple puppet manifest.  It
syncs all the assets a normal pluginsync would (including augeas lenses) and
only executes a single `apply_manifest_on` per host.

SIMP-4512 #close
  • Loading branch information
op-ct authored and trevor-vaughan committed Mar 13, 2018
1 parent c90dce8 commit c8ab53f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### 1.10.2 / 2018-03-04
* Reimplemented `pluginsync_on` with a Puppet manifest to completely mimic
a native pluginsync
- Syncs _all_ assets (e.g., augeas lenses) instead of just the facts
- Simpler
- Much faster, especially with many modules or SUTs

### 1.10.1 / 2018-02-13
* Updated the Puppet version mapping list for Puppet 5
* Fixed a bug in the way that the latest Puppet 5 version was being determined
Expand Down
20 changes: 11 additions & 9 deletions lib/simp/beaker_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,17 @@ def clear_temp_hieradata
# pluginsync custom facts for all modules
def pluginsync_on( suts = hosts )
puts "== pluginsync_on'" if ENV['BEAKER_helpers_verbose']
suts.each do |sut|
puts " ** pluginsync_on: '#{sut}'" if ENV['BEAKER_helpers_verbose']
fact_path = on(sut, %q(puppet config print factpath)).output.strip.split(':').first
on(sut, %q(puppet config print modulepath)).output.strip.split(':').each do |mod_path|
sut.mkdir_p(fact_path)
next if on(sut, "ls #{mod_path}/*/lib/facter 2>/dev/null ", :accept_all_exit_codes => true).exit_code != 0
on(sut, %Q(find #{mod_path}/*/lib/facter -type f -name '*.rb' -exec cp -a {} '#{fact_path}/' \\; ))
end
end
pluginsync_manifest =<<-PLUGINSYNC_MANIFEST
file { $::settings::libdir:
ensure => directory,
source => 'puppet:///plugins',
recurse => true,
purge => true,
backup => false,
noop => false
}
PLUGINSYNC_MANIFEST
apply_manifest_on(hosts, pluginsync_manifest)
end


Expand Down
2 changes: 1 addition & 1 deletion lib/simp/beaker_helpers/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Simp; end

module Simp::BeakerHelpers
VERSION = '1.10.1'
VERSION = '1.10.2'
end

0 comments on commit c8ab53f

Please sign in to comment.