foreman_inventory_upload 2.0.4.pre.1 → 2.0.4.pre.2

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: df8943022dd75fcce3aadedde8db465bc7bfd3fd4f0d760a9c149e9d0e43446b
4
- data.tar.gz: d5492c0003b1b27a619596569c5965e8850388b0cbd6e64400136d38e8acc856
3
+ metadata.gz: ba74f8d573fad2cdf133a05696a71d38e3d064dc2c52b4c28ea581b13d8814ea
4
+ data.tar.gz: 88d78a11ca435a6f4d081d71d4d6b93aa179b5792529aa81b99a363daa556714
5
5
  SHA512:
6
- metadata.gz: 58ed0e5819993091a3eef055b352243a13069d904f3b09d275107bab1c1537f57ac3e78f86ec60b72b9d3f3d7be5c2cd2eb871b46df861d68b85b6c0282f96b1
7
- data.tar.gz: 1d6a234e673067962e5163e4ddca2315f4e904a91ced1c0ca3dc6aa393c35cac66b325d8bf98d67e0e7a46d4ec2f1b22d49dd0f38190f239aaa507833248b2c5
6
+ metadata.gz: 35a87dd2c4b17ddf1a8f344e97624a11f7c4d87c27ecd845a1ec60882594da557318eab2a83ab5ccd8d6b78c83dc9278b50fd2d193133e87d312c55fa3728a88
7
+ data.tar.gz: 1a6e0ff8bf53354ab1e44b56a2a190237d11a330f32b8439a8900f3e1a4bf13b1f3048c9d5942a815654f1573b4a671a94c41508ded8e8cb773e3cb31cb5e591
@@ -22,6 +22,7 @@ module ForemanInventoryUpload
22
22
  @stream.array_field('hosts', :last) do
23
23
  first = true
24
24
  hosts_batch.each do |host|
25
+ next unless host&.subscription_facet&.pools&.first
25
26
  @stream.comma unless first
26
27
  first = false if report_host(host)
27
28
  end
@@ -30,7 +31,6 @@ module ForemanInventoryUpload
30
31
  end
31
32
 
32
33
  def report_host(host)
33
- return nil unless host&.subscription_facet&.pools&.first
34
34
  @stream.object do
35
35
  @stream.simple_field('display_name', host.name)
36
36
  @stream.simple_field('fqdn', host.fqdn)
@@ -1,3 +1,3 @@
1
1
  module ForemanInventoryUpload
2
- VERSION = '2.0.4.pre.1'.freeze
2
+ VERSION = '2.0.4.pre.2'.freeze
3
3
  end
@@ -139,4 +139,24 @@ class ReportGeneratorTest < ActiveSupport::TestCase
139
139
  assert_equal 'test_usage', fact_values['system_purpose_usage']
140
140
  assert_equal 'test_role', fact_values['system_purpose_role']
141
141
  end
142
+
143
+ test 'skips hosts without subscription' do
144
+ a_host = FactoryBot.create(
145
+ :host,
146
+ organization: @host.organization
147
+ )
148
+
149
+ # make a_host last
150
+ batch = Host.where(id: [@host.id, a_host.id]).order(:name).in_batches.first
151
+ generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice_123')
152
+
153
+ json_str = generator.render
154
+ actual = JSON.parse(json_str.join("\n"))
155
+
156
+ assert_equal 'slice_123', actual['report_slice_id']
157
+ assert_not_nil(actual_host = actual['hosts'].first)
158
+ assert_equal @host.name, actual_host['display_name']
159
+ assert_equal @host.fqdn, actual_host['fqdn']
160
+ assert_equal '1234', actual_host['account']
161
+ end
142
162
  end
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Grid, Spinner } from 'patternfly-react';
4
- import isEqual from 'lodash/isEqual';
4
+ import { isEqual } from 'lodash';
5
5
  import './terminal.scss';
6
6
  import { isTerminalScrolledDown } from './TerminalHelper';
7
7
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_inventory_upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4.pre.1
4
+ version: 2.0.4.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inventory upload team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-05 00:00:00.000000000 Z
11
+ date: 2020-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -327,12 +327,12 @@ signing_key:
327
327
  specification_version: 4
328
328
  summary: Summary of ForemanInventoryUpload.
329
329
  test_files:
330
- - test/test_plugin_helper.rb
331
- - test/factories/inventory_upload_factories.rb
330
+ - test/controllers/accounts_controller_test.rb
332
331
  - test/controllers/reports_controller_test.rb
333
332
  - test/controllers/uploads_controller_test.rb
334
- - test/controllers/accounts_controller_test.rb
335
- - test/unit/slice_generator_test.rb
333
+ - test/factories/inventory_upload_factories.rb
334
+ - test/test_plugin_helper.rb
335
+ - test/unit/archived_report_generator_test.rb
336
336
  - test/unit/metadata_generator_test.rb
337
337
  - test/unit/shell_process_job_test.rb
338
- - test/unit/archived_report_generator_test.rb
338
+ - test/unit/slice_generator_test.rb