foreman_webhooks 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/foreman_webhooks/deliver_webhook_job.rb +13 -1
- data/app/models/webhook.rb +2 -2
- data/app/views/foreman_webhooks/webhook_templates/katello_-_content_view.erb +1 -1
- data/app/views/foreman_webhooks/webhook_templates/katello_-_promote.erb +1 -2
- data/app/views/foreman_webhooks/webhook_templates/katello_-_publish.erb +1 -2
- data/app/views/foreman_webhooks/webhook_templates/katello_-_repo_sync.erb +1 -2
- data/app/views/foreman_webhooks/webhook_templates/remote_execution_-_host_job.erb +2 -1
- data/lib/foreman_webhooks/version.rb +1 -1
- data/test/jobs/foreman_webhooks/deliver_webhook_job_test.rb +2 -1
- data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookTestModal.js +10 -12
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 457b89d953e3410524cd3ad5aee4d63ca47192037523ee2c606e69d291e0e8e2
|
4
|
+
data.tar.gz: 9e43a93a35c44a7e8d0d3fdcecef2f4196120645ffe9b0517fba5a3ded221620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dca14e67eb8d98c5677ecdbb0e11a1a580fa9d6499f4c164aa263668a7709cee10441cd552fb4f0d2b9a74965520d0e4f29f7c311020817e70d4de3af96ca71
|
7
|
+
data.tar.gz: 939a492793d040c4555e73eedf6dc8a66cc4c72121addfdc3ac659ba5642599ad6960c1a3182299e0e98321d7dec52e524b52450d11d0eb5766e546e612a387c
|
@@ -6,13 +6,25 @@ module ForemanWebhooks
|
|
6
6
|
|
7
7
|
def perform(options)
|
8
8
|
webhook = Webhook.unscoped.find_by(id: options[:webhook_id])
|
9
|
-
WebhookService.new(
|
9
|
+
result = WebhookService.new(
|
10
10
|
webhook: webhook,
|
11
11
|
headers: options[:headers],
|
12
12
|
url: options[:url],
|
13
13
|
event_name: options[:event_name],
|
14
14
|
payload: options[:payload]
|
15
15
|
).execute
|
16
|
+
|
17
|
+
return unless result[:status] == :error
|
18
|
+
|
19
|
+
raise [result[:http_status], result[:message]].compact.join(': ')
|
20
|
+
end
|
21
|
+
|
22
|
+
rescue_from(StandardError) do |error|
|
23
|
+
Foreman::Logging.logger('background').error(
|
24
|
+
'DeliverWebhook: '\
|
25
|
+
"Error while delivering - #{error.message}"
|
26
|
+
)
|
27
|
+
raise error # propagate the error to the tasking system to properly report it there
|
16
28
|
end
|
17
29
|
|
18
30
|
def webhook_id
|
data/app/models/webhook.rb
CHANGED
@@ -82,8 +82,8 @@ class Webhook < ApplicationRecord
|
|
82
82
|
def test(payload: nil)
|
83
83
|
ForemanWebhooks::WebhookService.new(
|
84
84
|
webhook: self,
|
85
|
-
headers:
|
86
|
-
url:
|
85
|
+
headers: http_headers,
|
86
|
+
url: target_url,
|
87
87
|
event_name: event,
|
88
88
|
payload: test_payload(payload || '')
|
89
89
|
).execute
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%#
|
2
2
|
name: Katello Promote
|
3
|
-
description: Example payload for actions.katello.content_view.promote_suceeded
|
3
|
+
description: Example payload for actions.katello.content_view.promote_suceeded.event.foreman
|
4
4
|
snippet: false
|
5
5
|
model: WebhookTemplate
|
6
6
|
-%>
|
@@ -20,4 +20,3 @@ model: WebhookTemplate
|
|
20
20
|
# Task ended at <%= @object.task.ended_at %>
|
21
21
|
# Task resulted with <%= @object.task.result %>
|
22
22
|
# Task state <%= @object.task.state %>
|
23
|
-
# Task action output <%= @object.task.action_continuous_output %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%#
|
2
2
|
name: Katello Publish
|
3
|
-
description: Example payload for actions.katello.content_view.publish_suceeded
|
3
|
+
description: Example payload for actions.katello.content_view.publish_suceeded.event.foreman
|
4
4
|
snippet: false
|
5
5
|
model: WebhookTemplate
|
6
6
|
-%>
|
@@ -21,4 +21,3 @@ model: WebhookTemplate
|
|
21
21
|
# Task ended at <%= @object.task.ended_at %>
|
22
22
|
# Task resulted with <%= @object.task.result %>
|
23
23
|
# Task state <%= @object.task.state %>
|
24
|
-
# Task action output <%= @object.task.action_continuous_output %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%#
|
2
2
|
name: Katello Sync
|
3
|
-
description: Example payload for actions.katello.repository.sync_succeeded
|
3
|
+
description: Example payload for actions.katello.repository.sync_succeeded.event.foreman
|
4
4
|
snippet: false
|
5
5
|
model: WebhookTemplate
|
6
6
|
-%>
|
@@ -24,4 +24,3 @@ model: WebhookTemplate
|
|
24
24
|
# Task ended at <%= @object.task.ended_at %>
|
25
25
|
# Task resulted with <%= @object.task.result %>
|
26
26
|
# Task state <%= @object.task.state %>
|
27
|
-
# Task action output <%= @object.task.action_continuous_output %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%#
|
2
2
|
name: Remote Execution Host Job
|
3
|
-
description: Example payload for actions.remote_execution.run_host_job_succeeded
|
3
|
+
description: Example payload for actions.remote_execution.run_host_job_succeeded.event.foreman
|
4
4
|
snippet: false
|
5
5
|
model: WebhookTemplate
|
6
6
|
-%>
|
@@ -18,3 +18,4 @@ model: WebhookTemplate
|
|
18
18
|
# Task ended at <%= @object.task.ended_at %>
|
19
19
|
# Task resulted with <%= @object.task.result %>
|
20
20
|
# Task state <%= @object.task.state %>
|
21
|
+
# Task action output <%= @object.task.action_continuous_output %>
|
@@ -10,7 +10,8 @@ module ForemanWebhooks
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'executes the webhook service' do
|
13
|
-
|
13
|
+
result = { status: :success }
|
14
|
+
::ForemanWebhooks::WebhookService.any_instance.expects(:execute).once.returns(result)
|
14
15
|
job.perform_now
|
15
16
|
end
|
16
17
|
end
|
data/webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookTestModal.js
CHANGED
@@ -58,18 +58,16 @@ const WebhookTestModal = ({ toTest }) => {
|
|
58
58
|
enforceFocus
|
59
59
|
className="webhooks-modal"
|
60
60
|
>
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
)}
|
72
|
-
</p>
|
61
|
+
{`${sprintf(__('You are about to test %s webhook.'), name)} `}
|
62
|
+
{`${__(
|
63
|
+
'Please, note that this will not contain actual information or render the attached template.'
|
64
|
+
)} `}
|
65
|
+
{`${__(
|
66
|
+
'In case you are using dynamic URL (ERB template), this will not be rendered correctly due to the absence of a real object.'
|
67
|
+
)} `}
|
68
|
+
{__('You can specify below a custom payload to test the webhook with.')}
|
69
|
+
<br />
|
70
|
+
<br />
|
73
71
|
<ForemanForm
|
74
72
|
onSubmit={handleSubmit}
|
75
73
|
initialValues={initialTestValues}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_webhooks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Goebel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -245,7 +245,7 @@ licenses:
|
|
245
245
|
- GPL-3.0
|
246
246
|
metadata:
|
247
247
|
is_foreman_plugin: 'true'
|
248
|
-
post_install_message:
|
248
|
+
post_install_message:
|
249
249
|
rdoc_options: []
|
250
250
|
require_paths:
|
251
251
|
- lib
|
@@ -260,8 +260,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
- !ruby/object:Gem::Version
|
261
261
|
version: '0'
|
262
262
|
requirements: []
|
263
|
-
rubygems_version: 3.
|
264
|
-
signing_key:
|
263
|
+
rubygems_version: 3.4.10
|
264
|
+
signing_key:
|
265
265
|
specification_version: 4
|
266
266
|
summary: Configure webhooks for Foreman.
|
267
267
|
test_files:
|
@@ -269,14 +269,14 @@ test_files:
|
|
269
269
|
- test/controllers/api/v2/webhooks_controller_test.rb
|
270
270
|
- test/factories/webhook.rb
|
271
271
|
- test/factories/webhook_template.rb
|
272
|
-
- test/jobs/foreman_webhooks/deliver_webhook_job_test.rb
|
273
|
-
- test/models/webhook_test.rb
|
274
|
-
- test/test_plugin_helper.rb
|
275
|
-
- test/unit/foreman_webhooks/webhook_service_test.rb
|
276
272
|
- test/graphql/foreman_webhooks/queries/webhook_query_test.rb
|
277
273
|
- test/graphql/foreman_webhooks/queries/webhook_template_query_test.rb
|
278
274
|
- test/graphql/foreman_webhooks/queries/webhook_templates_query_test.rb
|
279
275
|
- test/graphql/foreman_webhooks/queries/webhooks_query_test.rb
|
276
|
+
- test/jobs/foreman_webhooks/deliver_webhook_job_test.rb
|
277
|
+
- test/models/webhook_test.rb
|
278
|
+
- test/test_plugin_helper.rb
|
279
|
+
- test/unit/foreman_webhooks/webhook_service_test.rb
|
280
280
|
- webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
|
281
281
|
- webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/Formatters/__tests__/enabledCellFormatter.test.js
|
282
282
|
- webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhooksTable/Components/__tests__/EnabledCell.test.js
|