foreman_webhooks 3.2.1 → 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 -1
- data/app/views/foreman_webhooks/webhook_templates/katello_-_publish.erb +1 -1
- data/app/views/foreman_webhooks/webhook_templates/katello_-_repo_sync.erb +1 -1
- data/app/views/foreman_webhooks/webhook_templates/remote_execution_-_host_job.erb +1 -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 +6 -6
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
|
@@ -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:
|