foreman_rh_cloud 2.0.13.1 → 2.0.14

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aef13982f858bea42312ee1495b628b86c789e54d81ad939853f0657dbd0d5ad
4
- data.tar.gz: 0e9e278c013651e9407d56cc0a85d3c923e28718b91d40a626cb395de572c702
3
+ metadata.gz: 778b0d71a8930862a9ea89c96b28024ef830b62bfe09c393da68200884bf1581
4
+ data.tar.gz: '01600923d9766697d70c1739a1e8a2257357804c01200b5571f8b63464401f8e'
5
5
  SHA512:
6
- metadata.gz: c923cf6e37a14a608601f343dfed4184b8d22a4356372a65bfd3b94fc6aa451848d50952b54adad6cada51af4a7452af3554b9f2ccd325f6b530b51f2fa3b272
7
- data.tar.gz: 28b1eb1031ce920dfe66e379c52f0ea7c4799114b6d84104df47b005d722caa08b5ae930fed87de0762ac0fe9a25a83c1fc40c7abc1147ed0da36723ce4eed76
6
+ metadata.gz: e48907c9626cbf815b00bc257a45801f5a55d0f5f6e797cf7d11fadd549e822580d420e60004efa8e92aabb75c1c3b799ecda447c06fa53a6cc7a36a72160747
7
+ data.tar.gz: 853e77b02847333267442716d2c4909cd9738cd1dbdcfa7a063b0a09859b90832f73f75cd2db78565ffaffba000aa0fdd8ea6924ad98d74f554a998f17cd5964
@@ -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 = '2.0.13.1'.freeze
2
+ VERSION = '2.0.14'.freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "2.0.13.1",
3
+ "version": "2.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,29 @@ 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
110
+ batch = Host.where(id: @host.id).in_batches.first
111
+ generator = create_generator(batch)
112
+
113
+ json_str = generator.render
114
+ actual = JSON.parse(json_str.join("\n"))
115
+
116
+ assert_equal 'slice_123', actual['report_slice_id']
117
+ assert_not_nil(actual_host = actual['hosts'].first)
118
+ assert_equal @host.interfaces.where.not(ip: nil).first.ip, actual_host['ip_addresses'].first
119
+ assert_equal @host.interfaces.where.not(mac: nil).first.mac, actual_host['mac_addresses'].first
120
+ assert_equal @host.fqdn, actual_host['fqdn']
121
+ assert_equal '1234', actual_host['account']
122
+ assert_equal 1, generator.hosts_count
123
+ end
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
103
130
  batch = Host.where(id: @host.id).in_batches.first
104
131
  generator = create_generator(batch)
105
132
 
@@ -110,6 +137,14 @@ class SliceGeneratorTest < ActiveSupport::TestCase
110
137
  assert_not_nil(actual_host = actual['hosts'].first)
111
138
  assert_equal @host.interfaces.where.not(ip: nil).first.ip, actual_host['ip_addresses'].first
112
139
  assert_equal @host.interfaces.where.not(mac: nil).first.mac, actual_host['mac_addresses'].first
140
+ assert_not_nil(actual_system_profile = actual_host['system_profile'])
141
+ assert_not_nil(actual_network_interfaces = actual_system_profile['network_interfaces'])
142
+ assert_not_nil(actual_nic = actual_network_interfaces.first)
143
+ assert_equal nic.ip, actual_nic['ipv4_addresses'].first
144
+ assert_equal nic.ip6, actual_nic['ipv6_addresses'].first
145
+ assert_equal 1500, actual_nic['mtu']
146
+ assert_equal nic.mac, actual_nic['mac_address']
147
+ assert_equal nic.identifier, actual_nic['name']
113
148
  assert_equal @host.fqdn, actual_host['fqdn']
114
149
  assert_equal '1234', actual_host['account']
115
150
  assert_equal 1, generator.hosts_count
@@ -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 = ({ 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: 2.0.13.1
4
+ version: 2.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
@@ -525,7 +525,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
525
525
  licenses:
526
526
  - GPL-3.0
527
527
  metadata: {}
528
- post_install_message:
528
+ post_install_message:
529
529
  rdoc_options: []
530
530
  require_paths:
531
531
  - lib
@@ -540,25 +540,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
540
540
  - !ruby/object:Gem::Version
541
541
  version: '0'
542
542
  requirements: []
543
- rubygems_version: 3.0.8
544
- signing_key:
543
+ rubygems_version: 3.1.4
544
+ signing_key:
545
545
  specification_version: 4
546
546
  summary: Summary of ForemanRhCloud.
547
547
  test_files:
548
- - test/test_plugin_helper.rb
549
- - test/factories/inventory_upload_factories.rb
550
- - test/factories/insights_factories.rb
551
- - test/controllers/reports_controller_test.rb
552
- - test/controllers/uploads_controller_test.rb
553
548
  - test/controllers/accounts_controller_test.rb
554
549
  - test/controllers/insights_sync/settings_controller_test.rb
555
- - test/unit/slice_generator_test.rb
550
+ - test/controllers/reports_controller_test.rb
551
+ - test/controllers/uploads_controller_test.rb
552
+ - test/factories/insights_factories.rb
553
+ - test/factories/inventory_upload_factories.rb
554
+ - test/jobs/insights_full_sync_test.rb
555
+ - test/jobs/inventory_full_sync_test.rb
556
+ - test/jobs/upload_report_job_test.rb
557
+ - test/test_plugin_helper.rb
558
+ - test/unit/archived_report_generator_test.rb
556
559
  - test/unit/metadata_generator_test.rb
557
- - test/unit/rh_cloud_http_proxy_test.rb
558
560
  - test/unit/shell_process_job_test.rb
559
- - test/unit/insights_facet_test.rb
560
- - test/unit/archived_report_generator_test.rb
561
561
  - test/unit/fact_helpers_test.rb
562
- - test/jobs/inventory_full_sync_test.rb
563
- - test/jobs/insights_full_sync_test.rb
564
- - test/jobs/upload_report_job_test.rb
562
+ - test/unit/insights_facet_test.rb
563
+ - test/unit/rh_cloud_http_proxy_test.rb
564
+ - test/unit/slice_generator_test.rb