ManageIQ / inventory_refresh

Apache License 2.0
1 stars 23 forks source link

Flatten subcollections and enhance sweep scope to work with them #68

Closed Ladas closed 5 years ago

Ladas commented 5 years ago

Subcollections as concept are being ditched, everything will be flat now.

If we want to archive e.g. container_groups with their 'subcollections' containers, after we save them all we'll send scope:

sweep_scope: ["container_groups", "containers"]

If we want to archive it targeted way, so we've saved container_groups X and Y and all their containers we'll send scope:

:sweep_scope => {
        :container_groups  => [
          {:ems_ref => "container_group_ems_ref_1"},
          {:ems_ref => "container_group_ems_ref_2"},
        ],
        :containers => [
          {:container_group => persister.container_groups.lazy_find("container_group_ems_ref_1")},
          {:container_group => persister.container_groups.lazy_find("container_group_ems_ref_2")},
        ]
      }

The scope provided can contain any attributes on IC.

Depends on:

Ladas commented 5 years ago

cc @slemrmartin

miq-bot commented 5 years ago

Checked commits https://github.com/Ladas/inventory_refresh/compare/9d60f6ec863011fdbeb7ad6c3359cdec938e1699~...e3ca0fac409a0e15851c0854c19a97d81da41e99 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 23 files checked, 7 offenses detected

lib/inventory_refresh/inventory_collection/builder.rb

lib/inventory_refresh/inventory_object.rb

lib/inventory_refresh/save_collection/sweeper.rb

spec/persister/sweep_inactive_records_spec.rb