foreman_rh_cloud 4.0.27 → 4.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/Gemfile.lock.gh_test +96 -77
- data/config/database.yml.example +2 -2
- data/lib/foreman_inventory_upload/generators/queries.rb +1 -0
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/inventory_sync/async/host_result.rb +0 -5
- data/lib/inventory_sync/async/inventory_full_sync.rb +14 -9
- data/lib/inventory_sync/async/inventory_hosts_sync.rb +2 -6
- data/package.json +1 -1
- data/test/factories/inventory_upload_factories.rb +14 -0
- data/test/jobs/inventory_full_sync_test.rb +28 -2
- data/test/jobs/inventory_hosts_sync_test.rb +15 -0
- data/test/unit/slice_generator_test.rb +36 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6f3f2a8162edb347dbd28899eb364a171d3ab4ddb4845e7f9286c35a71af1f1
|
4
|
+
data.tar.gz: d81d2f8dacd27f22b3ef7ab58641b38a16ce132669c3f3390fcf2f150afc72de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa7f0d5467ae1f4c2b1c451aeb2597244b4afd4ecaa2b010c113d6ff31725ec0115afdfbcf172c5e895f637c38b9690459488b4c4150531122783b6cfad7d96d
|
7
|
+
data.tar.gz: 5279557b8d3fad37db9bea492b95801175ceb0ffbe296fa17139ebffc48ebfb52558a72bffd7617ba20ff9a0cadf4c68b42252dfca6cb8ac8bb55f100ef6a6b5
|
data/config/Gemfile.lock.gh_test
CHANGED
@@ -1,35 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../foreman-tasks
|
3
|
+
specs:
|
4
|
+
foreman-tasks (4.1.5)
|
5
|
+
dynflow (>= 1.2.3)
|
6
|
+
foreman-tasks-core
|
7
|
+
get_process_mem
|
8
|
+
parse-cron (~> 0.1.4)
|
9
|
+
sinatra
|
10
|
+
foreman-tasks-core (0.3.6)
|
11
|
+
dynflow (>= 1.2.0)
|
12
|
+
|
1
13
|
PATH
|
2
14
|
remote: ../foreman_rh_cloud
|
3
15
|
specs:
|
4
|
-
foreman_rh_cloud (
|
16
|
+
foreman_rh_cloud (4.0.27)
|
17
|
+
foreman-tasks
|
5
18
|
foreman_ansible
|
6
19
|
katello
|
7
20
|
|
8
21
|
PATH
|
9
22
|
remote: ../katello
|
10
23
|
specs:
|
11
|
-
katello (
|
24
|
+
katello (4.1.4)
|
12
25
|
activerecord-import
|
13
26
|
anemone
|
14
27
|
angular-rails-templates (~> 1.1.0)
|
15
28
|
apipie-rails (>= 0.5.14)
|
16
29
|
deface (>= 1.0.2, < 2.0.0)
|
17
|
-
dynflow (
|
18
|
-
foreman-tasks (
|
30
|
+
dynflow (< 1.6.0)
|
31
|
+
foreman-tasks (~> 4.0)
|
32
|
+
foreman-tasks-core (< 0.4)
|
19
33
|
foreman_remote_execution (>= 3.0)
|
20
34
|
fx (< 1.0)
|
21
35
|
gettext_i18n_rails
|
22
36
|
json
|
23
37
|
oauth
|
24
38
|
pg
|
25
|
-
|
26
|
-
pulp_ansible_client (>= 0.2, < 0.5)
|
39
|
+
pulp_ansible_client (>= 0.8, < 0.9)
|
27
40
|
pulp_certguard_client (< 2.0)
|
28
|
-
pulp_container_client (>= 2.
|
29
|
-
pulp_deb_client (>= 2.
|
30
|
-
pulp_file_client (>= 1.
|
31
|
-
pulp_rpm_client (>= 3.
|
32
|
-
pulpcore_client (>= 3.
|
41
|
+
pulp_container_client (>= 2.7.0, < 2.8.0)
|
42
|
+
pulp_deb_client (>= 2.13.0, < 2.14.0)
|
43
|
+
pulp_file_client (>= 1.8.0, < 1.9.0)
|
44
|
+
pulp_rpm_client (>= 3.13.0, < 3.15.0)
|
45
|
+
pulpcore_client (>= 3.14.0, < 3.15.0)
|
46
|
+
qpid_proton
|
33
47
|
rabl
|
34
48
|
rails
|
35
49
|
rest-client
|
@@ -84,7 +98,7 @@ GEM
|
|
84
98
|
activerecord (6.0.3.6)
|
85
99
|
activemodel (= 6.0.3.6)
|
86
100
|
activesupport (= 6.0.3.6)
|
87
|
-
activerecord-import (1.0
|
101
|
+
activerecord-import (1.2.0)
|
88
102
|
activerecord (>= 3.2)
|
89
103
|
activerecord-nulldb-adapter (0.7.0)
|
90
104
|
activerecord (>= 5.2.0, < 6.3)
|
@@ -105,6 +119,8 @@ GEM
|
|
105
119
|
minitest (~> 5.1)
|
106
120
|
tzinfo (~> 1.1)
|
107
121
|
zeitwerk (~> 2.2, >= 2.2.2)
|
122
|
+
acts_as_list (1.0.4)
|
123
|
+
activerecord (>= 4.2)
|
108
124
|
addressable (2.7.0)
|
109
125
|
public_suffix (>= 2.0.2, < 5.0)
|
110
126
|
algebrick (0.7.5)
|
@@ -133,7 +149,7 @@ GEM
|
|
133
149
|
execjs
|
134
150
|
bcrypt (3.1.16)
|
135
151
|
benchmark-ips (2.8.4)
|
136
|
-
binding_of_caller (
|
152
|
+
binding_of_caller (0.8.0)
|
137
153
|
debug_inspector (>= 0.0.1)
|
138
154
|
bootsnap (1.7.3)
|
139
155
|
msgpack (~> 1.0)
|
@@ -189,7 +205,7 @@ GEM
|
|
189
205
|
polyglot
|
190
206
|
rails (>= 5.2)
|
191
207
|
rainbow (>= 2.1.0)
|
192
|
-
docile (1.
|
208
|
+
docile (1.4.0)
|
193
209
|
domain_name (0.5.20190701)
|
194
210
|
unf (>= 0.0.5, < 1.0.0)
|
195
211
|
dynflow (1.4.7)
|
@@ -246,12 +262,12 @@ GEM
|
|
246
262
|
fog-core (~> 2.1)
|
247
263
|
fog-json (>= 1.0)
|
248
264
|
ipaddress (>= 0.8)
|
249
|
-
fog-ovirt (
|
265
|
+
fog-ovirt (2.0.1)
|
266
|
+
activesupport
|
250
267
|
fog-core
|
251
268
|
fog-json
|
252
269
|
fog-xml
|
253
|
-
ovirt-engine-sdk (>= 4.1
|
254
|
-
rbovirt (~> 0.1.5)
|
270
|
+
ovirt-engine-sdk (>= 4.3.1)
|
255
271
|
fog-vsphere (3.5.0)
|
256
272
|
fog-core
|
257
273
|
rbvmomi (>= 1.9, < 3)
|
@@ -261,26 +277,19 @@ GEM
|
|
261
277
|
font-awesome-sass (4.6.2)
|
262
278
|
sass (>= 3.2)
|
263
279
|
foreman (0.87.2)
|
264
|
-
|
265
|
-
|
266
|
-
foreman-tasks-core
|
267
|
-
get_process_mem
|
268
|
-
parse-cron (~> 0.1.4)
|
269
|
-
sinatra
|
270
|
-
foreman-tasks-core (0.3.4)
|
271
|
-
dynflow (>= 1.2.0)
|
272
|
-
foreman_ansible (6.1.1)
|
280
|
+
foreman_ansible (6.4.1)
|
281
|
+
acts_as_list (~> 1.0.3)
|
273
282
|
deface (< 2.0)
|
274
|
-
foreman_remote_execution (>= 4.
|
283
|
+
foreman_remote_execution (>= 4.4.0)
|
275
284
|
ipaddress (>= 0.8.0, < 1.0)
|
276
285
|
foreman_ansible_core (4.0.0)
|
277
286
|
foreman-tasks-core (~> 0.3.2)
|
278
287
|
foreman_remote_execution_core (~> 1.1)
|
279
288
|
net-ssh
|
280
|
-
foreman_remote_execution (4.
|
289
|
+
foreman_remote_execution (4.5.6)
|
281
290
|
deface
|
282
291
|
dynflow (>= 1.0.2, < 2.0.0)
|
283
|
-
foreman-tasks (>=
|
292
|
+
foreman-tasks (>= 4.1.0)
|
284
293
|
foreman_remote_execution_core
|
285
294
|
foreman_remote_execution_core (1.4.0)
|
286
295
|
foreman-tasks-core (>= 0.3.1)
|
@@ -342,7 +351,6 @@ GEM
|
|
342
351
|
immigrant (0.3.6)
|
343
352
|
activerecord (>= 3.0)
|
344
353
|
ipaddress (0.8.3)
|
345
|
-
jaro_winkler (1.5.4)
|
346
354
|
journald-logger (3.0.1)
|
347
355
|
journald-native (~> 1.0)
|
348
356
|
journald-native (1.0.12)
|
@@ -408,14 +416,14 @@ GEM
|
|
408
416
|
oauth (0.5.5)
|
409
417
|
optimist (3.0.1)
|
410
418
|
os (1.1.1)
|
411
|
-
ovirt-engine-sdk (4.4.
|
419
|
+
ovirt-engine-sdk (4.4.1)
|
412
420
|
json (>= 1, < 3)
|
413
421
|
paint (2.2.1)
|
414
|
-
parallel (1.
|
422
|
+
parallel (1.21.0)
|
415
423
|
parallel_tests (3.6.0)
|
416
424
|
parallel
|
417
425
|
parse-cron (0.1.4)
|
418
|
-
parser (3.0.
|
426
|
+
parser (3.0.2.0)
|
419
427
|
ast (~> 2.4.1)
|
420
428
|
patternfly-sass (3.59.5)
|
421
429
|
bootstrap-sass (~> 3.4.0)
|
@@ -441,39 +449,34 @@ GEM
|
|
441
449
|
pry-remote (0.1.8)
|
442
450
|
pry (~> 0.9)
|
443
451
|
slop (~> 3.0)
|
444
|
-
pry-stack_explorer (0.
|
445
|
-
binding_of_caller (~>
|
452
|
+
pry-stack_explorer (0.4.13)
|
453
|
+
binding_of_caller (~> 0.7)
|
446
454
|
pry (~> 0.13)
|
447
455
|
public_suffix (4.0.6)
|
448
|
-
|
449
|
-
faraday (>= 0.14.0)
|
450
|
-
json (~> 2.1, >= 2.1.0)
|
451
|
-
pulp_ansible_client (0.4.3)
|
456
|
+
pulp_ansible_client (0.8.1)
|
452
457
|
faraday (>= 0.14.0)
|
453
458
|
json (~> 2.1, >= 2.1.0)
|
454
|
-
pulp_certguard_client (1.1
|
459
|
+
pulp_certguard_client (1.5.1)
|
455
460
|
faraday (>= 0.14.0)
|
456
461
|
json (~> 2.1, >= 2.1.0)
|
457
|
-
pulp_container_client (2.1
|
462
|
+
pulp_container_client (2.7.1)
|
458
463
|
faraday (>= 0.14.0)
|
459
464
|
json (~> 2.1, >= 2.1.0)
|
460
|
-
pulp_deb_client (2.
|
465
|
+
pulp_deb_client (2.13.1)
|
461
466
|
faraday (>= 0.14.0)
|
462
467
|
json (~> 2.1, >= 2.1.0)
|
463
|
-
pulp_file_client (1.
|
468
|
+
pulp_file_client (1.8.2)
|
464
469
|
faraday (>= 0.14.0)
|
465
470
|
json (~> 2.1, >= 2.1.0)
|
466
|
-
pulp_rpm_client (3.
|
471
|
+
pulp_rpm_client (3.14.6)
|
467
472
|
faraday (>= 0.14.0)
|
468
473
|
json (~> 2.1, >= 2.1.0)
|
469
|
-
pulpcore_client (3.
|
474
|
+
pulpcore_client (3.14.8)
|
470
475
|
faraday (>= 0.14.0)
|
471
476
|
json (~> 2.1, >= 2.1.0)
|
472
|
-
puma (
|
477
|
+
puma (5.5.2)
|
473
478
|
nio4r (~> 2.0)
|
474
|
-
|
475
|
-
json
|
476
|
-
puma (>= 3.6, < 5)
|
479
|
+
qpid_proton (0.33.0)
|
477
480
|
rabl (0.14.3)
|
478
481
|
activesupport (>= 2.3.14)
|
479
482
|
racc (1.5.2)
|
@@ -527,9 +530,6 @@ GEM
|
|
527
530
|
rb-fsevent (0.10.4)
|
528
531
|
rb-inotify (0.10.1)
|
529
532
|
ffi (~> 1.0)
|
530
|
-
rbovirt (0.1.7)
|
531
|
-
nokogiri
|
532
|
-
rest-client (> 1.7.0)
|
533
533
|
rbvmomi (2.4.1)
|
534
534
|
builder (~> 3.0)
|
535
535
|
json (>= 1.8)
|
@@ -553,7 +553,7 @@ GEM
|
|
553
553
|
mime-types (>= 1.16, < 4.0)
|
554
554
|
netrc (~> 0.8)
|
555
555
|
retriable (3.1.2)
|
556
|
-
rexml (3.2.
|
556
|
+
rexml (3.2.5)
|
557
557
|
rfauxfactory (0.1.5)
|
558
558
|
roadie (4.0.0)
|
559
559
|
css_parser (~> 1.4)
|
@@ -564,23 +564,30 @@ GEM
|
|
564
564
|
robotex (1.0.0)
|
565
565
|
robottelo_reporter (0.1.1)
|
566
566
|
builder (>= 2.1.2)
|
567
|
-
rubocop (0.
|
568
|
-
jaro_winkler (~> 1.5.1)
|
567
|
+
rubocop (0.89.1)
|
569
568
|
parallel (~> 1.10)
|
570
|
-
parser (>= 2.7.
|
569
|
+
parser (>= 2.7.1.1)
|
571
570
|
rainbow (>= 2.2.2, < 4.0)
|
571
|
+
regexp_parser (>= 1.7)
|
572
572
|
rexml
|
573
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
573
574
|
ruby-progressbar (~> 1.7)
|
574
|
-
unicode-display_width (>= 1.4.0, <
|
575
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
576
|
+
rubocop-ast (0.8.0)
|
577
|
+
parser (>= 2.7.1.5)
|
575
578
|
rubocop-checkstyle_formatter (0.4.0)
|
576
579
|
rubocop (>= 0.35.1)
|
577
|
-
rubocop-minitest (0.
|
578
|
-
rubocop (>= 0.
|
579
|
-
rubocop-performance (1.
|
580
|
-
rubocop (>= 0.
|
581
|
-
|
580
|
+
rubocop-minitest (0.10.3)
|
581
|
+
rubocop (>= 0.87, < 2.0)
|
582
|
+
rubocop-performance (1.8.1)
|
583
|
+
rubocop (>= 0.87.0)
|
584
|
+
rubocop-ast (>= 0.4.0)
|
585
|
+
rubocop-rails (2.8.1)
|
586
|
+
activesupport (>= 4.2.0)
|
582
587
|
rack (>= 1.1)
|
583
|
-
rubocop (>= 0.
|
588
|
+
rubocop (>= 0.87.0)
|
589
|
+
rubocop-rspec (1.43.2)
|
590
|
+
rubocop (~> 0.87)
|
584
591
|
ruby-libvirt (0.7.1)
|
585
592
|
ruby-openid (2.9.2)
|
586
593
|
ruby-progressbar (1.11.0)
|
@@ -647,7 +654,7 @@ GEM
|
|
647
654
|
simplecov-html (0.12.3)
|
648
655
|
simplecov-rcov (0.2.3)
|
649
656
|
simplecov (>= 0.4.1)
|
650
|
-
simplecov_json_formatter (0.1.
|
657
|
+
simplecov_json_formatter (0.1.3)
|
651
658
|
sinatra (2.1.0)
|
652
659
|
mustermann (~> 1.0)
|
653
660
|
rack (~> 2.2)
|
@@ -664,10 +671,18 @@ GEM
|
|
664
671
|
actionpack (>= 4.0)
|
665
672
|
activesupport (>= 4.0)
|
666
673
|
sprockets (>= 3.0.0)
|
674
|
+
sqlite3 (1.4.2)
|
667
675
|
sshkey (1.9.0)
|
668
676
|
statsd-instrument (2.9.2)
|
669
677
|
stomp (1.4.10)
|
670
678
|
text (1.3.1)
|
679
|
+
theforeman-rubocop (0.0.6)
|
680
|
+
rubocop (~> 0.89.0)
|
681
|
+
rubocop-checkstyle_formatter (~> 0.4.0)
|
682
|
+
rubocop-minitest (~> 0.10.1)
|
683
|
+
rubocop-performance (~> 1.8.1)
|
684
|
+
rubocop-rails (~> 2.8.1)
|
685
|
+
rubocop-rspec (~> 1.43.2)
|
671
686
|
thor (1.1.0)
|
672
687
|
thread_safe (0.3.6)
|
673
688
|
tilt (2.0.10)
|
@@ -679,7 +694,7 @@ GEM
|
|
679
694
|
unf (0.1.4)
|
680
695
|
unf_ext
|
681
696
|
unf_ext (0.0.7.7)
|
682
|
-
unicode-display_width (1.
|
697
|
+
unicode-display_width (1.8.0)
|
683
698
|
uniform_notifier (1.13.2)
|
684
699
|
validates_lengths_from_database (0.8.0)
|
685
700
|
activerecord (>= 4)
|
@@ -717,6 +732,7 @@ DEPENDENCIES
|
|
717
732
|
benchmark-ips (>= 2.8.2)
|
718
733
|
bootsnap
|
719
734
|
bullet (>= 6.1.0)
|
735
|
+
byebug
|
720
736
|
capybara (~> 3.0, < 3.32.1)
|
721
737
|
ci_reporter_minitest
|
722
738
|
coffee-rails (~> 5.0.0)
|
@@ -732,12 +748,14 @@ DEPENDENCIES
|
|
732
748
|
fog-aws (>= 3.6.2, < 4)
|
733
749
|
fog-core (= 2.1.0)
|
734
750
|
fog-google (~> 1.11.0)
|
735
|
-
fog-libvirt (>= 0.
|
751
|
+
fog-libvirt (>= 0.8.0)
|
736
752
|
fog-openstack (>= 1.0.8, < 2.0.0)
|
737
|
-
fog-ovirt (
|
738
|
-
fog-vsphere (>= 3.
|
753
|
+
fog-ovirt (>= 2.0.1, < 3)
|
754
|
+
fog-vsphere (>= 3.5.0, < 4.0)
|
739
755
|
foreman
|
756
|
+
foreman-tasks!
|
740
757
|
foreman_ansible_core
|
758
|
+
foreman_remote_execution (~> 4.5.6)
|
741
759
|
foreman_rh_cloud!
|
742
760
|
friendly_id (>= 5.3.0, < 5.4)
|
743
761
|
get_process_mem
|
@@ -751,10 +769,10 @@ DEPENDENCIES
|
|
751
769
|
i18n (~> 1.1)
|
752
770
|
immigrant (~> 0.1)
|
753
771
|
jquery-ui-rails (~> 6.0)
|
754
|
-
jwt (~> 2.2.
|
772
|
+
jwt (~> 2.2.2)
|
755
773
|
katello!
|
756
774
|
launchy (~> 2.4)
|
757
|
-
ldap_fluff (>= 0.
|
775
|
+
ldap_fluff (>= 0.5.0, < 1.0)
|
758
776
|
logging (>= 1.8.0, < 3.0.0)
|
759
777
|
logging-journald (~> 2.0)
|
760
778
|
mail (~> 2.7)
|
@@ -780,8 +798,8 @@ DEPENDENCIES
|
|
780
798
|
pry-rails
|
781
799
|
pry-remote
|
782
800
|
pry-stack_explorer
|
783
|
-
puma (
|
784
|
-
|
801
|
+
puma (~> 5.1)
|
802
|
+
qpid_proton (~> 0.33.0)
|
785
803
|
rabl (~> 0.14.2)
|
786
804
|
rack-cors (~> 1.0.2)
|
787
805
|
rack-jsonp
|
@@ -799,11 +817,10 @@ DEPENDENCIES
|
|
799
817
|
rfauxfactory (~> 0.1, >= 0.1.5)
|
800
818
|
roadie-rails (~> 2.0)
|
801
819
|
robottelo_reporter (~> 0.1)
|
802
|
-
rubocop
|
803
|
-
rubocop-checkstyle_formatter
|
804
|
-
rubocop-
|
805
|
-
rubocop-
|
806
|
-
rubocop-rails (~> 2.4.2)
|
820
|
+
rubocop
|
821
|
+
rubocop-checkstyle_formatter
|
822
|
+
rubocop-performance
|
823
|
+
rubocop-rails
|
807
824
|
ruby-libvirt (~> 0.5)
|
808
825
|
safemode (>= 1.3.5, < 2)
|
809
826
|
sass-rails (~> 6.0)
|
@@ -821,8 +838,10 @@ DEPENDENCIES
|
|
821
838
|
spring (>= 1.0, < 3)
|
822
839
|
sprockets (~> 4.0)
|
823
840
|
sprockets-rails (~> 3.0)
|
841
|
+
sqlite3
|
824
842
|
sshkey (~> 1.9)
|
825
843
|
statsd-instrument (< 3)
|
844
|
+
theforeman-rubocop (~> 0.0.6)
|
826
845
|
uglifier (>= 1.0.3)
|
827
846
|
validates_lengths_from_database (~> 0.5)
|
828
847
|
vcr (< 4.0.0)
|
data/config/database.yml.example
CHANGED
@@ -17,7 +17,6 @@ module InventorySync
|
|
17
17
|
@sub_ids.map do |sub_id|
|
18
18
|
host_id = host_id(sub_id)
|
19
19
|
if host_id
|
20
|
-
touched << host_id
|
21
20
|
{
|
22
21
|
host_id: host_id,
|
23
22
|
status: InventorySync::InventoryStatus::SYNC,
|
@@ -28,10 +27,6 @@ module InventorySync
|
|
28
27
|
end.compact
|
29
28
|
end
|
30
29
|
|
31
|
-
def touched
|
32
|
-
@touched ||= []
|
33
|
-
end
|
34
|
-
|
35
30
|
def host_id(sub_id)
|
36
31
|
hosts[sub_id]
|
37
32
|
end
|
@@ -14,11 +14,7 @@ module InventorySync
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def setup_statuses
|
17
|
-
@subscribed_hosts_ids = Set.new(
|
18
|
-
ForemanInventoryUpload::Generators::Queries.for_slice(
|
19
|
-
Host.unscoped.where(organization: input[:organization_id])
|
20
|
-
).pluck(:id)
|
21
|
-
)
|
17
|
+
@subscribed_hosts_ids = Set.new(affected_host_ids)
|
22
18
|
|
23
19
|
InventorySync::InventoryStatus.transaction do
|
24
20
|
InventorySync::InventoryStatus.where(host_id: @subscribed_hosts_ids).delete_all
|
@@ -35,8 +31,10 @@ module InventorySync
|
|
35
31
|
def update_statuses_batch
|
36
32
|
results = yield
|
37
33
|
|
38
|
-
|
39
|
-
|
34
|
+
existing_hosts = results.status_hashes.select { |hash| @subscribed_hosts_ids.include?(hash[:host_id]) }
|
35
|
+
|
36
|
+
update_hosts_status(existing_hosts)
|
37
|
+
host_statuses[:sync] += existing_hosts.size
|
40
38
|
end
|
41
39
|
|
42
40
|
def rescue_strategy_for_self
|
@@ -45,9 +43,10 @@ module InventorySync
|
|
45
43
|
|
46
44
|
private
|
47
45
|
|
48
|
-
def update_hosts_status(status_hashes
|
46
|
+
def update_hosts_status(status_hashes)
|
49
47
|
InventorySync::InventoryStatus.create(status_hashes)
|
50
|
-
|
48
|
+
updated_ids = status_hashes.map { |hash| hash[:host_id] }
|
49
|
+
@subscribed_hosts_ids.subtract(updated_ids)
|
51
50
|
end
|
52
51
|
|
53
52
|
def add_missing_hosts_statuses(hosts_ids)
|
@@ -68,6 +67,12 @@ module InventorySync
|
|
68
67
|
disconnect: 0,
|
69
68
|
}
|
70
69
|
end
|
70
|
+
|
71
|
+
def affected_host_ids
|
72
|
+
ForemanInventoryUpload::Generators::Queries.for_slice(
|
73
|
+
Host.unscoped.where(organization: input[:organization_id])
|
74
|
+
).pluck(:id)
|
75
|
+
end
|
71
76
|
end
|
72
77
|
end
|
73
78
|
end
|
@@ -35,18 +35,14 @@ module InventorySync
|
|
35
35
|
private
|
36
36
|
|
37
37
|
def add_missing_insights_facets(uuids_hash)
|
38
|
-
|
39
|
-
missing_facets = uuids_hash.except(*existing_facets.map(&:first)).map do |host_id, uuid|
|
38
|
+
all_facets = uuids_hash.map do |host_id, uuid|
|
40
39
|
{
|
41
40
|
host_id: host_id,
|
42
41
|
uuid: uuid,
|
43
42
|
}
|
44
43
|
end
|
45
|
-
InsightsFacet.create(missing_facets)
|
46
44
|
|
47
|
-
|
48
|
-
InsightsFacet.where(host_id: host_id).update_all(uuid: uuids_hash[host_id])
|
49
|
-
end
|
45
|
+
InsightsFacet.upsert_all(all_facets, unique_by: :host_id) unless all_facets.empty?
|
50
46
|
end
|
51
47
|
|
52
48
|
def plan_self_host_sync
|
data/package.json
CHANGED
@@ -54,10 +54,24 @@ FactoryBot.define do
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
FactoryBot.define do
|
58
|
+
factory :katello_subscription, :class => Katello::Subscription do
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
57
62
|
FactoryBot.define do
|
58
63
|
factory :katello_pool, :class => Katello::Pool do
|
59
64
|
active { true }
|
60
65
|
end_date { Date.today + 1.year }
|
66
|
+
cp_id { 1 }
|
67
|
+
|
68
|
+
association :organization, :factory => :katello_organization
|
69
|
+
|
70
|
+
after(:build) do |pool, _evaluator|
|
71
|
+
pool.subscription.organization = pool.organization
|
72
|
+
end
|
73
|
+
|
74
|
+
association :subscription, :factory => :katello_subscription
|
61
75
|
end
|
62
76
|
end
|
63
77
|
|
@@ -37,6 +37,18 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
|
|
37
37
|
@host2.subscription_facet.pools << pool
|
38
38
|
@host2_inventory_id = '4536bf5c-ff03-4154-a8c9-32ff4b40e40c'
|
39
39
|
|
40
|
+
# this host would pass our plugin queries, so it could be uploaded to the cloud.
|
41
|
+
@host3 = FactoryBot.create(
|
42
|
+
:host,
|
43
|
+
:with_subscription,
|
44
|
+
:with_content,
|
45
|
+
content_view: cv.first,
|
46
|
+
lifecycle_environment: env,
|
47
|
+
organization: env.organization
|
48
|
+
)
|
49
|
+
|
50
|
+
@host3.subscription_facet.pools << pool
|
51
|
+
|
40
52
|
ForemanInventoryUpload::Generators::Queries.instance_variable_set(:@fact_names, nil)
|
41
53
|
|
42
54
|
inventory_json = <<-INVENTORY_JSON
|
@@ -151,7 +163,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
|
|
151
163
|
{
|
152
164
|
"insights_id": "b533848e-465f-4f1a-9b2b-b71cb2d5239d",
|
153
165
|
"rhel_machine_id": null,
|
154
|
-
"subscription_manager_id": "
|
166
|
+
"subscription_manager_id": "#{@host3.subscription_facet.uuid}",
|
155
167
|
"satellite_id": "d29bde40-348e-437c-8acf-8fa98320fc1b",
|
156
168
|
"bios_uuid": "3cd5d972-cfb5-451a-8314-fd2f56629d7c",
|
157
169
|
"ip_addresses": [
|
@@ -159,7 +171,7 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
|
|
159
171
|
"fd6e:2298:736e::857",
|
160
172
|
"fd6e:2298:736e:0:2c66:6101:9cc6:2b23"
|
161
173
|
],
|
162
|
-
"fqdn": "
|
174
|
+
"fqdn": "#{@host3.fqdn}",
|
163
175
|
"mac_addresses": [
|
164
176
|
"6e:66:a6:fe:fc:07",
|
165
177
|
"00:00:00:00:00:00"
|
@@ -271,4 +283,18 @@ class InventoryFullSyncTest < ActiveSupport::TestCase
|
|
271
283
|
|
272
284
|
ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host1.organization)
|
273
285
|
end
|
286
|
+
|
287
|
+
test 'Should skip hosts that are not returned in query' do
|
288
|
+
assert_nil InventorySync::InventoryStatus.where(host_id: @host3.id).first
|
289
|
+
|
290
|
+
Setting[:rh_cloud_token] = 'TEST TOKEN'
|
291
|
+
InventorySync::Async::InventoryFullSync.any_instance.expects(:query_inventory).returns(@inventory)
|
292
|
+
InventorySync::Async::InventoryFullSync.any_instance.expects(:affected_host_ids).returns([@host1.id, @host2.id])
|
293
|
+
FactoryBot.create(:fact_value, fact_name: fact_names['virt::uuid'], value: '1234', host: @host2)
|
294
|
+
|
295
|
+
ForemanTasks.sync_task(InventorySync::Async::InventoryFullSync, @host1.organization)
|
296
|
+
@host2.reload
|
297
|
+
|
298
|
+
assert_nil InventorySync::InventoryStatus.where(host_id: @host3.id).first
|
299
|
+
end
|
274
300
|
end
|
@@ -265,4 +265,19 @@ class InventoryHostsSyncTest < ActiveSupport::TestCase
|
|
265
265
|
|
266
266
|
assert_equal @host2_inventory_id, @host2.insights.uuid
|
267
267
|
end
|
268
|
+
|
269
|
+
test 'Inventory should sync empty facets list' do
|
270
|
+
empty_inventory = @inventory.deep_clone
|
271
|
+
empty_inventory['results'] = []
|
272
|
+
InventorySync::Async::InventoryHostsSync.any_instance.expects(:query_inventory).returns(empty_inventory)
|
273
|
+
InventorySync::Async::InventoryHostsSync.any_instance.expects(:plan_self_host_sync)
|
274
|
+
|
275
|
+
assert_nil @host2.insights
|
276
|
+
|
277
|
+
ForemanTasks.sync_task(InventorySync::Async::InventoryHostsSync)
|
278
|
+
|
279
|
+
@host2.reload
|
280
|
+
|
281
|
+
assert_nil @host2.insights
|
282
|
+
end
|
268
283
|
end
|
@@ -22,7 +22,13 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
22
22
|
location: location
|
23
23
|
)
|
24
24
|
|
25
|
-
@host.organization.pools << FactoryBot.create(
|
25
|
+
@host.organization.pools << FactoryBot.create(
|
26
|
+
:katello_pool,
|
27
|
+
account_number: '1234',
|
28
|
+
cp_id: 1,
|
29
|
+
organization: env.organization,
|
30
|
+
subscription: FactoryBot.create(:katello_subscription, organization_id: env.organization.id)
|
31
|
+
)
|
26
32
|
@host.interfaces.first.identifier = 'test_nic1'
|
27
33
|
@host.save!
|
28
34
|
|
@@ -441,6 +447,18 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
441
447
|
assert_equal 1, generator.hosts_count
|
442
448
|
end
|
443
449
|
|
450
|
+
test 'excludes hosts with host_registration_insights set to false' do
|
451
|
+
@host.host_parameters << HostParameter.create(
|
452
|
+
name: 'host_registration_insights',
|
453
|
+
value: "false",
|
454
|
+
parameter_type: 'boolean'
|
455
|
+
)
|
456
|
+
|
457
|
+
count = ForemanInventoryUpload::Generators::Queries.for_org(@host.organization_id).count
|
458
|
+
|
459
|
+
assert_equal 0, count
|
460
|
+
end
|
461
|
+
|
444
462
|
test 'shows system_memory_bytes in bytes' do
|
445
463
|
FactoryBot.create(:fact_value, fact_name: fact_names['memory::memtotal'], value: '1', host: @host)
|
446
464
|
|
@@ -457,9 +475,23 @@ class SliceGeneratorTest < ActiveSupport::TestCase
|
|
457
475
|
end
|
458
476
|
|
459
477
|
test 'reports an account for hosts with multiple pools' do
|
460
|
-
|
461
|
-
|
462
|
-
|
478
|
+
new_org = FactoryBot.create(:organization)
|
479
|
+
first_pool = FactoryBot.create(
|
480
|
+
:katello_pool,
|
481
|
+
account_number: '5678',
|
482
|
+
cp_id: 2,
|
483
|
+
organization: new_org,
|
484
|
+
subscription: FactoryBot.create(:katello_subscription, organization_id: new_org.id)
|
485
|
+
)
|
486
|
+
second_pool = FactoryBot.create(
|
487
|
+
:katello_pool,
|
488
|
+
account_number: '9012',
|
489
|
+
cp_id: 3,
|
490
|
+
organization: new_org,
|
491
|
+
subscription: FactoryBot.create(:katello_subscription, organization_id: new_org.id)
|
492
|
+
)
|
493
|
+
new_org.pools << first_pool
|
494
|
+
new_org.pools << second_pool
|
463
495
|
|
464
496
|
another_host = FactoryBot.create(
|
465
497
|
:host,
|
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: 4.0.
|
4
|
+
version: 4.0.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Red Hat Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katello
|