Sha256: e385c986614970e7cc86dfb9fd2e608e4453b6ca7575c01bd7ec53fef26ca60f
Contents?: true
Size: 1.24 KB
Versions: 14
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require 'bolt/error' # Sets a particular feature to present on a target. # # Features are used to determine what implementation of a task should be run. # Currently supported features are # - powershell # - shell # - puppet-agent # # **NOTE:** Not available in apply block Puppet::Functions.create_function(:set_feature) do # @param target The Target object to add features to. See {get_targets}. # @param feature The string identifying the feature. # @param value Whether the feature is supported. # @return The target with the updated feature # @example Add the puppet-agent feature to a target # set_feature($target, 'puppet-agent', true) dispatch :set_feature do param 'Target', :target param 'String', :feature optional_param 'Boolean', :value end def set_feature(target, feature, value = true) unless Puppet[:tasks] raise Puppet::ParseErrorWithIssue .from_issue_and_stack(Bolt::PAL::Issues::PLAN_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, action: 'set_feature') end inventory = Puppet.lookup(:bolt_inventory) executor = Puppet.lookup(:bolt_executor) executor.report_function_call(self.class.name) inventory.set_feature(target, feature, value) target end end
Version data entries
14 entries across 14 versions & 1 rubygems