Sha256: 89da9d00a665e08a1472c102f2c362592874ea5825f714acf414ffec369fdea2

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

Bookmark.without_auditing do
  [
    { :name => 'failed', :query => 'status = failed', :controller => 'job_invocations' },
    { :name => 'succeeded', :query => 'status = succeeded', :controller => 'job_invocations'},
    { :name => 'running', :query => 'status = running', :controller => 'job_invocations'},
    { :name => 'pending', :query => 'status = queued or status = running', :controller => 'job_invocations'},
    { :name => 'recurring', :query => 'recurring = true', :controller => 'job_invocations'},
    { :name => 'recent', :query => 'started_at > "24 hours ago"', :controller => 'job_invocations'},
  ].each do |input|
    next if Bookmark.where(:controller => 'job_invocations').find_by(name: input[:name])
    # TODO audit should be fixed once core #13109 gets merged
    next if audit_modified? Bookmark, input[:name]
    attributes = { :public => true }.merge(input)
    b = Bookmark.where(:name => input[:name], :controller => input[:controller]).first || Bookmark.new
    b.attributes = attributes
    b.save
    raise "Unable to create bookmark: #{format_errors b}" if b.errors.any?
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.7 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.6 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.4.1 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.5 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.4 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.3 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.2 db/seeds.d/90-bookmarks.rb
foreman_remote_execution-1.3.1 db/seeds.d/90-bookmarks.rb