From 0b7e075ef6484ee491c3577ac4646bcec56a8219 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Wed, 27 Sep 2017 17:25:30 -0400 Subject: [PATCH 1/2] unconditionally seed all standard reports. Sometimes date of build for patch on new version could be older that build date of older version, and skipping file based on timestamp will lead to keeping records from old version https://bugzilla.redhat.com/show_bug.cgi?id=1494819 --- app/models/miq_report/seeding.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/miq_report/seeding.rb b/app/models/miq_report/seeding.rb index d443fe79cb6..8e4782306fb 100644 --- a/app/models/miq_report/seeding.rb +++ b/app/models/miq_report/seeding.rb @@ -62,8 +62,8 @@ def sync_from_file(filename, dir, typ) rec = find_by_filename(rpt[:filename]) if rec - if rec.filename && (rec.file_mtime.nil? || rec.file_mtime.utc < rpt[:file_mtime]) - _log.info("#{typ.titleize}: [#{rec.name}] file has been updated on disk, synchronizing with model") + if rec.filename + _log.info("#{typ.titleize}: [#{rec.name}] file exists, synchronizing with model") rec.update_attributes(rpt) rec.save end From ce79a8a2ca62c72820c5f38efd78f82ea644dd45 Mon Sep 17 00:00:00 2001 From: Yuri Rudman Date: Thu, 28 Sep 2017 16:47:51 -0400 Subject: [PATCH 2/2] unconditionally seed widgets, skeeping seed based on file's timestamp may lead to keep recotrds from older version (when timestamp on yaml file from older version is more resent) https://bugzilla.redhat.com/show_bug.cgi?id=1494819 --- app/models/miq_widget.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/miq_widget.rb b/app/models/miq_widget.rb index 04495f01cac..861e0fe948d 100644 --- a/app/models/miq_widget.rb +++ b/app/models/miq_widget.rb @@ -472,7 +472,7 @@ def self.sync_from_hash(attrs) widget = find_by(:description => attrs["description"]) if widget - if filename && widget.updated_at.utc < File.mtime(filename).utc + if filename $log.info("Widget: [#{widget.description}] file has been updated on disk, synchronizing with model") ["enabled", "visibility"].each { |a| attrs.delete(a) } # Don't updates these because they may have been modofoed by the end user. widget.updated_at = Time.now.utc