Skip to content

Commit 8685a72

Browse files
committed
Add fail-when-not-found flag for puppet resource service
1 parent 10c0219 commit 8685a72

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/puppet/application/resource.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def help
111111
create_resources.
112112
113113
* --fail-when-not-found:
114-
Fails and returns an exit code if the resource is not found, valid only
114+
Fails and returns an exit code of 1 if the resource is not found, valid only
115115
for Windows and SystemD services.
116116
117117
EXAMPLE
@@ -243,8 +243,7 @@ def find_or_save_resources(type, name, params)
243243
# save returns [resource that was saved, transaction log from applying the resource]
244244
save_result, report = Puppet::Resource.indirection.save(resource, key)
245245
status = report.resource_statuses[resource.ref]
246-
binding.irb
247-
raise "Failed to manage resource #{resource.ref}" if status&.failed?
246+
raise "Failed to manage resource #{resource.ref}" if status&.failed? && !options[:fail_when_not_found].nil? && options[:fail_when_not_found]
248247

249248
[save_result]
250249
end

0 commit comments

Comments
 (0)