foreman_rh_cloud 3.0.26 → 3.0.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/database.yml.example +2 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +12 -1
- data/package.json +3 -3
- data/test/unit/foreman_rh_cloud_self_host_test.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56cd1d6cfd15e872954f934c6d4da54a0fa7fac6d376dfce68c7df38bbbab7fe
|
4
|
+
data.tar.gz: be90bca3b783d987b548a3aa9b2a792a6528fbf7131cd9e130af72c9b4e6c102
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a052bbb5346617f391a7a3125c5400ad8c2601d6d79f5101e78e17dcaadbdf0b3a071b2845f707f16b94642ce2b4542e585d6e09afade4d06eedc5dbd46c09
|
7
|
+
data.tar.gz: 77c1aca4f971996b13067142c932e49dd6fd5df1e5efd6be09dd0e25e086f7859bba47157b826ec6dc2d8e8837dd2bb6e4c36f97e5045f404a2527484c1ed369
|
data/config/database.yml.example
CHANGED
data/lib/foreman_rh_cloud.rb
CHANGED
@@ -98,6 +98,17 @@ module ForemanRhCloud
|
|
98
98
|
|
99
99
|
# For testing purposes we can override the default hostname with an environment variable SATELLITE_RH_CLOUD_FOREMAN_HOST
|
100
100
|
def self.foreman_host
|
101
|
-
@foreman_host ||=
|
101
|
+
@foreman_host ||= begin
|
102
|
+
fullname = foreman_host_name
|
103
|
+
::Host.unscoped.friendly.find(fullname)
|
104
|
+
rescue ActiveRecord::RecordNotFound
|
105
|
+
# fullname didn't work. Let's try shortname
|
106
|
+
shortname = /(?<shortname>[^\.]*)\.?.*/.match(fullname)[:shortname]
|
107
|
+
::Host.unscoped.friendly.find(shortname)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.foreman_host_name
|
112
|
+
ENV['SATELLITE_RH_CLOUD_FOREMAN_HOST'] || ::SmartProxy.default_capsule.name
|
102
113
|
end
|
103
114
|
end
|
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "foreman_rh_cloud",
|
3
|
-
"version": "3.0.
|
3
|
+
"version": "3.0.28",
|
4
4
|
"description": "Inventory Upload =============",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -26,7 +26,6 @@
|
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"@babel/core": "~7.7.0",
|
29
|
-
"@redhat-cloud-services/frontend-components": "^2.5.0",
|
30
29
|
"@theforeman/builder": "~4.14.0",
|
31
30
|
"@theforeman/stories": "~4.14.0",
|
32
31
|
"@theforeman/test": "~4.14.0",
|
@@ -43,6 +42,7 @@
|
|
43
42
|
},
|
44
43
|
"dependencies": {
|
45
44
|
"jed": "~1.1.1",
|
46
|
-
"react-intl": "~2.8.0"
|
45
|
+
"react-intl": "~2.8.0",
|
46
|
+
"@redhat-cloud-services/frontend-components": "^2.5.0"
|
47
47
|
}
|
48
48
|
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_plugin_helper'
|
2
|
+
|
3
|
+
class ForemanRhCloudSelfHostTest < ActiveSupport::TestCase
|
4
|
+
setup do
|
5
|
+
# reset cached value
|
6
|
+
ForemanRhCloud.instance_variable_set(:@foreman_host, nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
test 'finds host by fullname' do
|
10
|
+
@domain
|
11
|
+
@host = FactoryBot.create(:host, :managed)
|
12
|
+
ForemanRhCloud.expects(:foreman_host_name).returns(@host.name)
|
13
|
+
|
14
|
+
actual = ForemanRhCloud.foreman_host
|
15
|
+
|
16
|
+
assert_not_nil actual
|
17
|
+
end
|
18
|
+
|
19
|
+
test 'finds host by shortname' do
|
20
|
+
@host = FactoryBot.create(:host, :managed)
|
21
|
+
Host.where(name: @host.name).update_all(name: @host.shortname)
|
22
|
+
ForemanRhCloud.expects(:foreman_host_name).returns(@host.name)
|
23
|
+
|
24
|
+
actual = ForemanRhCloud.foreman_host
|
25
|
+
|
26
|
+
assert_not_nil actual
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_rh_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- test/test_plugin_helper.rb
|
268
268
|
- test/unit/archived_report_generator_test.rb
|
269
269
|
- test/unit/fact_helpers_test.rb
|
270
|
+
- test/unit/foreman_rh_cloud_self_host_test.rb
|
270
271
|
- test/unit/insights_facet_test.rb
|
271
272
|
- test/unit/metadata_generator_test.rb
|
272
273
|
- test/unit/rh_cloud_http_proxy_test.rb
|
@@ -698,6 +699,7 @@ test_files:
|
|
698
699
|
- test/test_plugin_helper.rb
|
699
700
|
- test/unit/archived_report_generator_test.rb
|
700
701
|
- test/unit/fact_helpers_test.rb
|
702
|
+
- test/unit/foreman_rh_cloud_self_host_test.rb
|
701
703
|
- test/unit/insights_facet_test.rb
|
702
704
|
- test/unit/metadata_generator_test.rb
|
703
705
|
- test/unit/rh_cloud_http_proxy_test.rb
|