topological_inventory-core 1.1.5 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc2335e206b9eba3ab955c62d29422156bb4053e737cd9aece9a5b91748b76ea
4
- data.tar.gz: 163c7d564a74402c23b5001b885c2e83795263547592f83032c7514f771300a0
3
+ metadata.gz: ecf54fde41844a8514ee76d28e48f00c320db19dd611deae8558651d1eb8a00f
4
+ data.tar.gz: 3cd41ad2eba32e8cf42ef78739078e85c7092bd52ee9b732a8366e618668bc2b
5
5
  SHA512:
6
- metadata.gz: c16a6361df474d38fc189a159f27a33ee3dd4b21d17cc0ae256128ae8ac6db0eb67d64b4e4103fff64fc8905169b7b86e1448e84df6d3ebf1391960fa721b8e0
7
- data.tar.gz: 35e182d151981fa96c604c630c87686d3c0a1a65fc061789be277602c0b1b91e73d74e2fc3f5171b3754af0bf2cfba81a45bba20cbc6b9bd01579a222744fca2
6
+ metadata.gz: 6ff09bf2432c59e6120cd285d31e780d738f0e4efef355a0d04adcf31d9a5f40826bd3517327bee505d1b896a93954f0c9bb0d0ead24369d7ef8d7892a30b8cc
7
+ data.tar.gz: 4c4287841a0ea473368029963f8630d269cdffce00f848503c67bfb69a1824c37452533fb8fb269b8fbf352287dac6fbe76bed832f61843388c9b4d5618eacf9
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Topological Inventory Core
2
2
 
3
- [![Build Status](https://travis-ci.org/RedHatInsights/topological_inventory-core.svg)](https://travis-ci.org/RedHatInsights/topological_inventory-core)
3
+ [![Build Status](https://travis-ci.com/RedHatInsights/topological_inventory-core.svg)](https://travis-ci.com/RedHatInsights/topological_inventory-core)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/34f9bd9412e35c1a36fd/maintainability)](https://codeclimate.com/github/RedHatInsights/topological_inventory-core/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/34f9bd9412e35c1a36fd/test_coverage)](https://codeclimate.com/github/RedHatInsights/topological_inventory-core/test_coverage)
6
6
  [![Security](https://hakiri.io/github/RedHatInsights/topological_inventory-core/master.svg)](https://hakiri.io/github/RedHatInsights/topological_inventory-core/master)
@@ -1,4 +1,6 @@
1
1
  class RefreshState < ActiveRecord::Base
2
+ require 'acts_as_tenant'
3
+
2
4
  belongs_to :source
3
5
  belongs_to :tenant
4
6
  has_many :refresh_state_parts
@@ -1,4 +1,6 @@
1
1
  class RefreshStatePart < ActiveRecord::Base
2
+ require 'acts_as_tenant'
3
+
2
4
  belongs_to :refresh_state
3
5
  belongs_to :tenant
4
6
 
@@ -0,0 +1,6 @@
1
+ class AddIndexToRefreshStateParts < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_index :refresh_state_parts, :uuid
4
+ add_index :refresh_states, :uuid
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddGuestInfoToVms < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :vms, :guest_info, :string
4
+ end
5
+ end
@@ -10,7 +10,7 @@
10
10
  #
11
11
  # It's strongly recommended that you check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(version: 2020_05_05_101547) do
13
+ ActiveRecord::Schema.define(version: 2021_01_06_143551) do
14
14
 
15
15
  # These are extensions that must be enabled in order to support this database
16
16
  enable_extension "plpgsql"
@@ -622,6 +622,7 @@ ActiveRecord::Schema.define(version: 2020_05_05_101547) do
622
622
  t.datetime "updated_at", null: false
623
623
  t.index ["refresh_state_id", "uuid"], name: "index_refresh_state_parts_on_refresh_state_id_and_uuid", unique: true
624
624
  t.index ["tenant_id"], name: "index_refresh_state_parts_on_tenant_id"
625
+ t.index ["uuid"], name: "index_refresh_state_parts_on_uuid"
625
626
  end
626
627
 
627
628
  create_table "refresh_states", force: :cascade do |t|
@@ -639,6 +640,7 @@ ActiveRecord::Schema.define(version: 2020_05_05_101547) do
639
640
  t.datetime "finished_at"
640
641
  t.index ["source_id", "uuid"], name: "index_refresh_states_on_source_id_and_uuid", unique: true
641
642
  t.index ["tenant_id"], name: "index_refresh_states_on_tenant_id"
643
+ t.index ["uuid"], name: "index_refresh_states_on_uuid"
642
644
  end
643
645
 
644
646
  create_table "reservation_tags", id: :serial, force: :cascade do |t|
@@ -1258,6 +1260,7 @@ ActiveRecord::Schema.define(version: 2020_05_05_101547) do
1258
1260
  t.bigint "subscription_id"
1259
1261
  t.bigint "host_id"
1260
1262
  t.bigint "refresh_state_part_id"
1263
+ t.string "guest_info"
1261
1264
  t.index ["archived_at"], name: "index_vms_on_archived_at"
1262
1265
  t.index ["flavor_id"], name: "index_vms_on_flavor_id"
1263
1266
  t.index ["host_id"], name: "index_vms_on_host_id"
@@ -1,5 +1,5 @@
1
1
  module TopologicalInventory
2
2
  module Core
3
- VERSION = '1.1.5'
3
+ VERSION = '1.2.1'
4
4
  end
5
5
  end
@@ -151,14 +151,15 @@ module TopologicalInventory
151
151
  service_instance_tasks_update_by_activerecord(tasks_collection, source, src_refs)
152
152
  end
153
153
 
154
- def task_update_values(svc_instance_id, source_ref, external_url, status, task_status, finished_timestamp, source_id)
154
+ def task_update_values(svc_instance_id, source_ref, external_url, status, artifacts, task_status, finished_timestamp, archived_timestamp, source_id)
155
155
  {
156
- :state => finished_timestamp.blank? ? 'running' : 'completed',
157
- :status => task_status,
156
+ :state => finished_timestamp.blank? && archived_timestamp.blank? ? 'running' : 'completed',
157
+ :status => task_status,
158
158
  :context => {
159
159
  :service_instance => {
160
160
  :id => svc_instance_id,
161
161
  :job_status => status,
162
+ :artifacts => artifacts,
162
163
  :source_id => source_id,
163
164
  :source_ref => source_ref,
164
165
  :url => external_url
@@ -172,12 +173,12 @@ module TopologicalInventory
172
173
  service_instances = ServiceInstance.where(:source_id => source.id, :source_ref => svc_instances_source_ref)
173
174
  tasks_by_source_ref = Task.where(:state => 'running', :target_type => 'ServiceInstance', :source_id => source.id, :target_source_ref => service_instances.pluck(:source_ref)).index_by(&:target_source_ref)
174
175
 
175
- service_instances.select(:id, :external_url, :source_ref, :extra).find_in_batches do |group|
176
+ service_instances.select(:id, :archived_at, :external_url, :source_ref, :extra).find_in_batches do |group|
176
177
  ActiveRecord::Base.transaction do
177
178
  group.each do |svc_instance|
178
179
  next if (task = tasks_by_source_ref[svc_instance.source_ref]).nil?
179
180
 
180
- values = task_update_values(svc_instance.id, svc_instance.source_ref, svc_instance.external_url, svc_instance.extra['status'], svc_instance.extra['task_status'], svc_instance.extra['finished'], source.id)
181
+ values = task_update_values(svc_instance.id, svc_instance.source_ref, svc_instance.external_url, svc_instance.extra['status'], svc_instance.extra['artifacts'], svc_instance.extra['task_status'], svc_instance.extra['finished'], svc_instance.archived_at, source.id)
181
182
  # 1) Updating Task
182
183
  task.update(values)
183
184
 
@@ -198,19 +199,20 @@ module TopologicalInventory
198
199
 
199
200
  # Load saved service instances (IDs needed)
200
201
  svc_instances_values = ServiceInstance.where(:source_ref => tasks_source_ref)
201
- .pluck(:id, :external_url, :source_ref,
202
- Arel.sql("extra->'finished'"),
203
- Arel.sql("extra->'status'"),
204
- Arel.sql("extra->'task_status'"))
202
+ .pluck(:id, :archived_at, :external_url, :source_ref,
203
+ Arel.sql("extra->'finished'"),
204
+ Arel.sql("extra->'status'"),
205
+ Arel.sql("extra->'task_status'"),
206
+ Arel.sql("extra->'artifacts'"))
205
207
  return if svc_instances_values.blank?
206
208
 
207
209
  sql_update_values = []
208
210
 
209
211
  # Preparing SQL update values from loaded ServiceInstances
210
212
  svc_instances_values.each do |attrs|
211
- id, external_url, source_ref, finished_timestamp, status, task_status = attrs[0], attrs[1], attrs[2], attrs[3], attrs[4], attrs[5]
213
+ id, archived_at, external_url, source_ref, finished_timestamp, status, task_status, artifacts = attrs[0], attrs[1], attrs[2], attrs[3], attrs[4], attrs[5], attrs[6], attrs[7]
212
214
 
213
- values = task_update_values(id, external_url, status, task_status, finished_timestamp)
215
+ values = task_update_values(id, source_ref, external_url, status, artifacts, task_status, finished_timestamp, archived_at, source.id)
214
216
  sql_update_values << "('#{source_ref}', '#{values[:state]}', '#{values[:status]}', '#{values[:context].to_json}'::json)"
215
217
  end
216
218
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topological_inventory-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Grare
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_tenant
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.1.0
47
+ version: 1.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.0
54
+ version: 1.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: manageiq-password
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,42 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.69.0
145
+ version: 1.0.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.69.0
152
+ version: 1.0.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.3'
159
+ version: '1.8'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.3'
166
+ version: '1.8'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-rails
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '2.8'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '2.8'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: simplecov
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -202,13 +216,6 @@ files:
202
216
  - LICENSE.txt
203
217
  - README.md
204
218
  - Rakefile
205
- - app/assets/config/topological_inventory_manifest.js
206
- - app/assets/javascripts/topological_inventory/application.js
207
- - app/assets/stylesheets/topological_inventory/application.css
208
- - app/controllers/topological_inventory/application_controller.rb
209
- - app/helpers/topological_inventory/application_helper.rb
210
- - app/jobs/topological_inventory/application_job.rb
211
- - app/mailers/topological_inventory/application_mailer.rb
212
219
  - app/models/application_record.rb
213
220
  - app/models/availability.rb
214
221
  - app/models/cluster.rb
@@ -275,9 +282,7 @@ files:
275
282
  - app/models/volume.rb
276
283
  - app/models/volume_attachment.rb
277
284
  - app/models/volume_type.rb
278
- - app/views/layouts/topological_inventory/application.html.erb
279
285
  - config/database.dev.yml
280
- - config/database.yml
281
286
  - db/migrate/20180919170553_add_sources_and_endpoints.rb
282
287
  - db/migrate/20180927171624_add_container_models.rb
283
288
  - db/migrate/20180927205317_add_service_catalog_models.rb
@@ -385,6 +390,8 @@ files:
385
390
  - db/migrate/20200421141934_add_source_updated_at.rb
386
391
  - db/migrate/20200428090420_add_request_id_to_task.rb
387
392
  - db/migrate/20200505101547_add_forwardable_headers_remove_request_id_on_task.rb
393
+ - db/migrate/20200811154716_add_index_to_refresh_state_parts.rb
394
+ - db/migrate/20210106143551_add_guest_info_to_vms.rb
388
395
  - db/schema.rb
389
396
  - db/seeds.rb
390
397
  - lib/tasks/topological_inventory_tasks.rake
@@ -1,2 +0,0 @@
1
- //= link_directory ../javascripts/topological_inventory .js
2
- //= link_directory ../stylesheets/topological_inventory .css
@@ -1,13 +0,0 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,5 +0,0 @@
1
- module TopologicalInventory
2
- class ApplicationController < ActionController::Base
3
- protect_from_forgery with: :exception
4
- end
5
- end
@@ -1,4 +0,0 @@
1
- module TopologicalInventory
2
- module ApplicationHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module TopologicalInventory
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module TopologicalInventory
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: 'from@example.com'
4
- layout 'mailer'
5
- end
6
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Topological inventory</title>
5
- <%= stylesheet_link_tag "topological_inventory/application", media: "all" %>
6
- <%= javascript_include_tag "topological_inventory/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
@@ -1,22 +0,0 @@
1
- default: &default
2
- adapter: postgresql
3
- encoding: utf8
4
- host: localhost
5
- port: 5432
6
- username: root
7
- pool: 5
8
- wait_timeout: 5
9
- min_messages: warning
10
-
11
- development:
12
- <<: *default
13
- database: topological_inventory_development
14
- min_messages: notice
15
-
16
- test:
17
- <<: *default
18
- database: topological_inventory_test
19
-
20
- production:
21
- <<: *default
22
- database: topological_inventory_production