foreman_rh_cloud 1.0.13.1 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98e764cf33b2ab8c20150a8a62ddbbbd3054acb763fe2be687a41f48953ba325
4
- data.tar.gz: fb53b2c932ba73df66e19454b5db35c6d63daa23e26d5f34667e5712b1f1e135
3
+ metadata.gz: 830861dcfd46371108e610046d742960ace76310a79bf3fde268de4230de0ccb
4
+ data.tar.gz: a42767333df5769a37bcd9e28ebb9e7eab815a13933bdd38cb678c77602eb5b0
5
5
  SHA512:
6
- metadata.gz: a3b338417ad7ef6b45e9a1ccd1a1c764be52ff702f71b18231e60b847165b437d384aefe3799c3450611d19bd34797d91806ab405acc154448412e6dfb76c340
7
- data.tar.gz: c38fe55bcdd4be6e1c9d63e54b4b7ae25e3221829c095bfa74e7425bbff79c56e93abf5ce5d0f0ba3ec98d96e00012771bbc9c329d10d67d2a9632514f921e5c
6
+ metadata.gz: bc3f5e9f3f5dff9c8198bc10d131c42f6b2cd8ef5409711182af631effda0b0b99a2c12f9e0b0e1cf4d30a821f58d28fef94edc2341a2938693ba773832a8a27
7
+ data.tar.gz: 87731548c51473f8f88d20f9036d3709135734795c950ffb70fe86b302d18c209a3825fa720b1227ffbe3cc4a51960f7386a6cbfce0d91494f94afb0d2de4745
@@ -107,7 +107,7 @@ module ForemanInventoryUpload
107
107
  {
108
108
  'ipv4_addresses': [host_ips_cache[nic.ip]].compact,
109
109
  'ipv6_addresses': [nic.ip6].compact,
110
- 'mtu': nic.try(:mtu),
110
+ 'mtu': nic.try(:mtu) && nic.mtu.to_i,
111
111
  'mac_address': nic.mac,
112
112
  'name': nic.identifier,
113
113
  }.compact.to_json
@@ -1,3 +1,3 @@
1
1
  module ForemanRhCloud
2
- VERSION = '1.0.13.1'.freeze
2
+ VERSION = '1.0.14'.freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "1.0.13.1",
3
+ "version": "1.0.14",
4
4
  "description": "Inventory Upload =============",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -77,6 +77,11 @@ class SliceGeneratorTest < ActiveSupport::TestCase
77
77
  assert_nil actual_system_profile['cores_per_socket']
78
78
  assert_nil actual_system_profile['system_memory_bytes']
79
79
  assert_nil actual_system_profile['os_release']
80
+ assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
81
+ assert_not_nil(actual_nic = actual_network_interfaces.first)
82
+ refute actual_nic.key?('mtu')
83
+ refute actual_nic.key?('mac_address')
84
+ refute actual_nic.key?('name')
80
85
  end
81
86
 
82
87
  test 'hosts report fields should be present if fact exist' do
@@ -99,7 +104,9 @@ class SliceGeneratorTest < ActiveSupport::TestCase
99
104
  end
100
105
 
101
106
  test 'generates ip_address and mac_address fields' do
102
- @host.interfaces << FactoryBot.build(:nic_managed)
107
+ nic = FactoryBot.build(:nic_managed)
108
+ nic.attrs['mtu'] = '1500'
109
+ @host.interfaces << nic
103
110
  batch = Host.where(id: @host.id).in_batches.first
104
111
  generator = create_generator(batch)
105
112
 
@@ -115,6 +122,36 @@ class SliceGeneratorTest < ActiveSupport::TestCase
115
122
  assert_equal 1, generator.hosts_count
116
123
  end
117
124
 
125
+ test 'generates nic fields' do
126
+ ip6 = Array.new(4) { '%x' % rand(16**4) }.join(':') + '::' + '5'
127
+ nic = FactoryBot.build(:nic_managed, ip6: ip6)
128
+ nic.attrs['mtu'] = '1500'
129
+ @host.interfaces << nic
130
+ batch = Host.where(id: @host.id).in_batches.first
131
+ generator = create_generator(batch)
132
+
133
+ json_str = generator.render
134
+ actual = JSON.parse(json_str.join("\n"))
135
+
136
+ assert_equal 'slice_123', actual['report_slice_id']
137
+ assert_not_nil(actual_host = actual['hosts'].first)
138
+ expected_ip = @host.interfaces.where.not(ip: nil).first.ip
139
+ assert_not_nil actual_host['ip_addresses'].find { |addr| addr == expected_ip }
140
+ expected_mac = @host.interfaces.where.not(mac: nil).first.mac
141
+ assert_not_nil actual_host['mac_addresses'].find { |mac| mac == expected_mac }
142
+ assert_not_nil(actual_system_profile = actual_host['system_profile'])
143
+ assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
144
+ assert_not_nil(actual_nic = actual_network_interfaces.find { |nic_node| nic_node['ipv4_addresses'].first == nic.ip })
145
+ assert_equal nic.ip, actual_nic['ipv4_addresses'].first
146
+ assert_equal nic.ip6, actual_nic['ipv6_addresses'].first
147
+ assert_equal 1500, actual_nic['mtu']
148
+ assert_equal nic.mac, actual_nic['mac_address']
149
+ assert_equal nic.identifier, actual_nic['name']
150
+ assert_equal @host.fqdn, actual_host['fqdn']
151
+ assert_equal '1234', actual_host['account']
152
+ assert_equal 1, generator.hosts_count
153
+ end
154
+
118
155
  test 'generates obfuscated ip_address fields without inisghts-client' do
119
156
  FactoryBot.create(:setting, :name => 'obfuscate_inventory_ips', :value => true)
120
157
 
@@ -21,10 +21,10 @@ const SyncModal = ({ show, toggleModal }) => (
21
21
  <Modal.Body>
22
22
  <Grid>
23
23
  <p>
24
- {__(`Please go over the following steps to add a RHSM API token:`)}
24
+ {__(`Please go over the following steps to add a Red Hat API token:`)}
25
25
  </p>
26
26
  <p>
27
- {__(`1. Obtain an RHSM API token: `)}
27
+ {__(`1. Obtain an Red Hat API token: `)}
28
28
  <a
29
29
  href="https://access.redhat.com/management/api"
30
30
  target="_blank"
@@ -19,7 +19,7 @@ const InsightsCloudSync = ({ data: { settingsUrl }, syncInsights }) => {
19
19
  recommendations output for hosts managed here`)}
20
20
  </p>
21
21
  <p>
22
- {__(`1. Obtain an RHSM API token: `)}
22
+ {__(`1. Obtain an Red Hat API token: `)}
23
23
  <a
24
24
  href="https://access.redhat.com/management/api"
25
25
  target="_blank"
@@ -19,7 +19,7 @@ exports[`InsightsCloudSync render 1`] = `
19
19
  recommendations output for hosts managed here
20
20
  </p>
21
21
  <p>
22
- 1. Obtain an RHSM API token:
22
+ 1. Obtain an Red Hat API token:
23
23
  <a
24
24
  href="https://access.redhat.com/management/api"
25
25
  rel="noopener noreferrer"
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: 1.0.13.1
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Red Hat Cloud team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -532,7 +532,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
532
532
  licenses:
533
533
  - GPL-3.0
534
534
  metadata: {}
535
- post_install_message:
535
+ post_install_message:
536
536
  rdoc_options: []
537
537
  require_paths:
538
538
  - lib
@@ -547,25 +547,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
547
547
  - !ruby/object:Gem::Version
548
548
  version: '0'
549
549
  requirements: []
550
- rubygems_version: 3.0.8
551
- signing_key:
550
+ rubygems_version: 3.1.4
551
+ signing_key:
552
552
  specification_version: 4
553
553
  summary: Summary of ForemanRhCloud.
554
554
  test_files:
555
- - test/test_plugin_helper.rb
556
- - test/factories/inventory_upload_factories.rb
557
- - test/factories/insights_factories.rb
558
- - test/controllers/reports_controller_test.rb
559
- - test/controllers/uploads_controller_test.rb
560
555
  - test/controllers/accounts_controller_test.rb
561
556
  - test/controllers/insights_sync/settings_controller_test.rb
562
- - test/unit/slice_generator_test.rb
557
+ - test/controllers/reports_controller_test.rb
558
+ - test/controllers/uploads_controller_test.rb
559
+ - test/factories/inventory_upload_factories.rb
560
+ - test/factories/insights_factories.rb
561
+ - test/jobs/insights_full_sync_test.rb
562
+ - test/jobs/inventory_full_sync_test.rb
563
+ - test/jobs/upload_report_job_test.rb
564
+ - test/test_plugin_helper.rb
565
+ - test/unit/archived_report_generator_test.rb
563
566
  - test/unit/metadata_generator_test.rb
564
- - test/unit/rh_cloud_http_proxy_test.rb
565
567
  - test/unit/shell_process_job_test.rb
566
- - test/unit/insights_facet_test.rb
567
- - test/unit/archived_report_generator_test.rb
568
568
  - test/unit/fact_helpers_test.rb
569
- - test/jobs/inventory_full_sync_test.rb
570
- - test/jobs/insights_full_sync_test.rb
571
- - test/jobs/upload_report_job_test.rb
569
+ - test/unit/insights_facet_test.rb
570
+ - test/unit/slice_generator_test.rb
571
+ - test/unit/rh_cloud_http_proxy_test.rb