foreman_inventory_upload 2.0.3 → 2.0.4.pre.1

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: 0ee366e2c29cdcebb956eea276f6fe8e4c3b61d92b28c9bf3fe7b796e8d9a736
4
- data.tar.gz: 1ce3d7dec276594d6f2051856c9b7fae0bb0fa0b46f21f84b09bf02f2bf59698
3
+ metadata.gz: df8943022dd75fcce3aadedde8db465bc7bfd3fd4f0d760a9c149e9d0e43446b
4
+ data.tar.gz: d5492c0003b1b27a619596569c5965e8850388b0cbd6e64400136d38e8acc856
5
5
  SHA512:
6
- metadata.gz: 74b2c3da2e3e7d75cb62fafdc768b37c3261b3debb06bcba4a70c73bc63e2cf0deb183ea13d4e041b58a77f6a9667f18e998130b70a5552127f9263c981c8af2
7
- data.tar.gz: 00aceb0db75ca118b656d20add514d7aa522f3e59c7983f740dffea0b134b7d77c2434be124d9d7ad9d5201d58459fc7a8b2b1f23d5c138f030ad4e7e363dc9c
6
+ metadata.gz: 58ed0e5819993091a3eef055b352243a13069d904f3b09d275107bab1c1537f57ac3e78f86ec60b72b9d3f3d7be5c2cd2eb871b46df861d68b85b6c0282f96b1
7
+ data.tar.gz: 1d6a234e673067962e5163e4ddca2315f4e904a91ced1c0ca3dc6aa393c35cac66b325d8bf98d67e0e7a46d4ec2f1b22d49dd0f38190f239aaa507833248b2c5
@@ -52,7 +52,7 @@ module ForemanInventoryUpload
52
52
  @stream.object_field('system_profile') do
53
53
  report_system_profile(host)
54
54
  end
55
- @stream.array_field('facts', :last) do
55
+ @stream.array_field('facts') do
56
56
  @stream.object do
57
57
  @stream.simple_field('namespace', 'satellite')
58
58
  @stream.object_field('facts', :last) do
@@ -60,7 +60,21 @@ module ForemanInventoryUpload
60
60
  end
61
61
  end
62
62
  end
63
+
64
+ @stream.array_field('tags', :last) do
65
+ report_tag('satellite', 'satellite_instance_id', Foreman.instance_id) if Foreman.respond_to?(:instance_id)
66
+ report_tag('satellite', 'organization_id', host.organization_id, :last)
67
+ end
68
+ end
69
+ end
70
+
71
+ def report_tag(namespace, key, value, last = nil)
72
+ @stream.object do
73
+ @stream.simple_field('namespace', namespace)
74
+ @stream.simple_field('key', key)
75
+ @stream.simple_field('value', value, :last)
63
76
  end
77
+ @stream.comma unless last
64
78
  end
65
79
 
66
80
  def report_system_profile(host)
@@ -1,3 +1,3 @@
1
1
  module ForemanInventoryUpload
2
- VERSION = '2.0.3'.freeze
2
+ VERSION = '2.0.4.pre.1'.freeze
3
3
  end
data/package.json CHANGED
@@ -26,13 +26,12 @@
26
26
  "devDependencies": {
27
27
  "@babel/core": "^7.7.0",
28
28
  "@theforeman/builder": "^4.0.2",
29
- "@theforeman/eslint-plugin-foreman": "^4.0.2",
30
29
  "@theforeman/stories": "^4.0.2",
31
30
  "@theforeman/test": "^4.0.2",
32
31
  "@theforeman/vendor-dev": "^4.0.2",
32
+ "@theforeman/eslint-plugin-foreman": "^4.0.2",
33
33
  "babel-eslint": "^10.0.0",
34
- "eslint": "^6.8.0",
35
- "jed": "^1.1.1",
34
+ "eslint": "^6.7.2",
36
35
  "prettier": "^1.13.5",
37
36
  "raf": "^3.4.0",
38
37
  "stylelint": "^9.3.0",
@@ -40,6 +39,7 @@
40
39
  "surge": "^0.20.3"
41
40
  },
42
41
  "dependencies": {
42
+ "jed": "^1.1.1",
43
43
  "react-intl": "^2.8.0"
44
44
  }
45
45
  }
@@ -59,7 +59,7 @@ class ReportGeneratorTest < ActiveSupport::TestCase
59
59
  end
60
60
 
61
61
  test 'generates a report with satellite facts' do
62
- Foreman.expects(:instance_id).returns('satellite-id')
62
+ Foreman.expects(:instance_id).twice.returns('satellite-id')
63
63
  batch = Host.where(id: @host.id).in_batches.first
64
64
  generator = ForemanInventoryUpload::Generators::Slice.new(batch, [], 'slice-123')
65
65
 
@@ -72,6 +72,14 @@ class ReportGeneratorTest < ActiveSupport::TestCase
72
72
  assert_equal 'satellite-id', satellite_facts['satellite_instance_id']
73
73
  assert_equal @host.organization_id, satellite_facts['organization_id']
74
74
 
75
+ instance_id_tag = actual['hosts'].first['tags'].find { |tag| tag['namespace'] == 'satellite' && tag['key'] == 'satellite_instance_id'}
76
+ assert_not_nil instance_id_tag
77
+ assert_equal 'satellite-id', instance_id_tag['value']
78
+
79
+ org_id_tag = actual['hosts'].first['tags'].find { |tag| tag['namespace'] == 'satellite' && tag['key'] == 'organization_id'}
80
+ assert_not_nil org_id_tag
81
+ assert_equal @host.organization_id, org_id_tag['value']
82
+
75
83
  version = satellite_facts['satellite_version']
76
84
  if defined?(ForemanThemeSatellite)
77
85
  assert_equal ForemanThemeSatellite::SATELLITE_VERSION, version
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.3
4
+ version: 2.0.4.pre.1
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-01-27 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: katello
@@ -318,21 +318,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
318
318
  version: '0'
319
319
  required_rubygems_version: !ruby/object:Gem::Requirement
320
320
  requirements:
321
- - - ">="
321
+ - - ">"
322
322
  - !ruby/object:Gem::Version
323
- version: '0'
323
+ version: 1.3.1
324
324
  requirements: []
325
325
  rubygems_version: 3.0.6
326
326
  signing_key:
327
327
  specification_version: 4
328
328
  summary: Summary of ForemanInventoryUpload.
329
329
  test_files:
330
- - test/controllers/accounts_controller_test.rb
330
+ - test/test_plugin_helper.rb
331
+ - test/factories/inventory_upload_factories.rb
331
332
  - test/controllers/reports_controller_test.rb
332
333
  - test/controllers/uploads_controller_test.rb
333
- - test/factories/inventory_upload_factories.rb
334
- - test/test_plugin_helper.rb
335
- - test/unit/archived_report_generator_test.rb
334
+ - test/controllers/accounts_controller_test.rb
335
+ - test/unit/slice_generator_test.rb
336
336
  - test/unit/metadata_generator_test.rb
337
337
  - test/unit/shell_process_job_test.rb
338
- - test/unit/slice_generator_test.rb
338
+ - test/unit/archived_report_generator_test.rb