foreman_rh_cloud 0.9.13.1 → 0.9.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: 902648ff2a981c136aeb9aae9deee2fbff323851b170b2039d9aa13584bfc7d0
4
- data.tar.gz: 7fe6bdd6d23146885ed33863cc6afa8572ec2a7668852bb950c7a9aec1c6d472
3
+ metadata.gz: fe75c278cf52883a7bcee035572f067596fd937a416f05cb81de06303f453374
4
+ data.tar.gz: 2b7e5cd1a64dd7b9715aae01123c6e76f8e55d7bc51b076b678d831ecd839d1b
5
5
  SHA512:
6
- metadata.gz: f6f1d3b789c4f94982f9370f69f96c1c63a90ab6d7eb1e2d137ff450c9db4086a489c1e6b1ba8f7e1c866534c128cbc86d04cd3dabc4d95d9810a0321e00751a
7
- data.tar.gz: a242e6f2378b61c563ae5c3c5bae481d51761f93379119122424f1261eebd76217929baf25128f7fca0e8129773de744320f710ad2717940e91301eae84fdc3b
6
+ metadata.gz: f8c1124e35166fc6eaef477bb10f98a311009fe040d7c546aa7501120dba4e04af2494f95f5fc3506b5499fc5094314087bd1d6d9d7cd00e541ec09878506433
7
+ data.tar.gz: 1e39cc7174482aeaba29833e03b5a298e0b1f2d292b9866648a3ee7e3f73ccfb5210d4e98f33380e43a52f3042feefedff6d6541f05793a56fea26c1fe533884
@@ -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 = '0.9.13.1'.freeze
2
+ VERSION = '0.9.14'.freeze
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foreman_rh_cloud",
3
- "version": "0.9.13.1",
3
+ "version": "0.9.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: 0.9.13.1
4
+ version: 0.9.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
@@ -504,7 +504,7 @@ homepage: https://github.com/theforeman/foreman_rh_cloud
504
504
  licenses:
505
505
  - GPL-3.0
506
506
  metadata: {}
507
- post_install_message:
507
+ post_install_message:
508
508
  rdoc_options: []
509
509
  require_paths:
510
510
  - lib
@@ -519,25 +519,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
519
519
  - !ruby/object:Gem::Version
520
520
  version: '0'
521
521
  requirements: []
522
- rubygems_version: 3.0.8
523
- signing_key:
522
+ rubygems_version: 3.1.4
523
+ signing_key:
524
524
  specification_version: 4
525
525
  summary: Summary of ForemanRhCloud.
526
526
  test_files:
527
- - test/test_plugin_helper.rb
528
- - test/factories/inventory_upload_factories.rb
529
- - test/factories/insights_factories.rb
530
- - test/controllers/reports_controller_test.rb
531
- - test/controllers/uploads_controller_test.rb
532
527
  - test/controllers/accounts_controller_test.rb
533
528
  - test/controllers/insights_sync/settings_controller_test.rb
534
- - test/unit/slice_generator_test.rb
529
+ - test/controllers/reports_controller_test.rb
530
+ - test/controllers/uploads_controller_test.rb
531
+ - test/factories/insights_factories.rb
532
+ - test/factories/inventory_upload_factories.rb
533
+ - test/jobs/insights_full_sync_test.rb
534
+ - test/jobs/inventory_full_sync_test.rb
535
+ - test/jobs/upload_report_job_test.rb
536
+ - test/test_plugin_helper.rb
537
+ - test/unit/archived_report_generator_test.rb
535
538
  - test/unit/metadata_generator_test.rb
536
- - test/unit/rh_cloud_http_proxy_test.rb
537
539
  - test/unit/shell_process_job_test.rb
538
- - test/unit/insights_facet_test.rb
539
- - test/unit/archived_report_generator_test.rb
540
540
  - test/unit/fact_helpers_test.rb
541
- - test/jobs/inventory_full_sync_test.rb
542
- - test/jobs/insights_full_sync_test.rb
543
- - test/jobs/upload_report_job_test.rb
541
+ - test/unit/insights_facet_test.rb
542
+ - test/unit/rh_cloud_http_proxy_test.rb
543
+ - test/unit/slice_generator_test.rb