topological_inventory-core 1.1.7 → 1.1.8

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: d30dee988592e3a42eb583950140e28c84acc4b2a63d0cf6a37bbc582636be6f
4
- data.tar.gz: 49f5130373e785f030006a2bb498e3e4496f3537aa828dae137951e629d2a4d1
3
+ metadata.gz: e695f0361b4d66ec73f345609275c5184d882b283471b963a802502a3f474bfb
4
+ data.tar.gz: d3b514bb133871100ec4003041c1605ec203498c9fe995df50260e520324e037
5
5
  SHA512:
6
- metadata.gz: bef32c25295035fd93eeef616a0419b487da930a8815db4b9228469ec5c8b5df83de0927935e537175c451b7183dc0e11e45369759095c87a4431bc41105826d
7
- data.tar.gz: ff4d8355ac873dd466d54043d37030b16baa679fc5884f0026ea0ebf3f70865f14c96cf59c22c5793431006a8705173beec9d8f1a374b3664e8b9b06567fa24c
6
+ metadata.gz: bfe84074032bf678982d41a3c86c6db7e97981035930a65c533944e8d7fe1a1409e7db7adb6aa2e6045f6f3fc4451ac817c0491b7a17a3810156f702f479fe2e
7
+ data.tar.gz: f794a8cae67dc978d1b1e538734243421c23b6e39497347fed8f785a61252cb5aa5b82f93bfb4ea7a56b95d35db289eb156c00c345500907af1fbc48070a4ec4
@@ -1,5 +1,5 @@
1
1
  module TopologicalInventory
2
2
  module Core
3
- VERSION = '1.1.7'
3
+ VERSION = '1.1.8'
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.7
4
+ version: 1.1.8
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-09-11 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_tenant