bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb in bolt-1.8.1 vs bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb in bolt-1.9.0
- old
+ new
@@ -61,21 +61,22 @@
# Ensure Puppet is installed
versions = run_task(executor, unknown_targets, 'puppet_agent::version')
need_install, installed = versions.partition { |r| r['version'].nil? }
installed.each do |r|
Puppet.debug "Puppet Agent #{r['version']} installed on #{r.target.name}"
+ inventory.set_feature(r.target, 'puppet-agent')
end
unless need_install.empty?
need_install_targets = need_install.map(&:target)
run_task(executor, need_install_targets, 'puppet_agent::install')
-
+ # Service task works best when targets have puppet-agent feature
+ need_install_targets.each { |target| inventory.set_feature(target, 'puppet-agent') }
# Ensure the Puppet service is stopped after new install
run_task(executor, need_install_targets, 'service', 'action' => 'stop', 'name' => 'puppet')
run_task(executor, need_install_targets, 'service', 'action' => 'disable', 'name' => 'puppet')
end
end
- targets.each { |target| inventory.set_feature(target, 'puppet-agent') }
# Gather facts, including custom facts
plugins = applicator.build_plugin_tarball do |mod|
search_dirs = []
search_dirs << mod.plugins if mod.plugins?