From a7883a788880b623d53405dc660315698a58725b Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Mon, 22 Jan 2024 09:52:04 +0100 Subject: [PATCH] rubocop --auto-correct --- config/routes.rb | 2 +- db/seeds.d/179_ui_notifications.rb | 1 - db/seeds.d/50_job_templates.rb | 8 ++++---- foreman_rh_cloud.gemspec | 2 +- lib/tasks/hybrid_cloud.rake | 8 ++++---- lib/tasks/rh_cloud_inventory.rake | 10 +++++----- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index beb94510..93dc67a1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -41,7 +41,7 @@ end scope '/r/insights' do - match '(/*path)(/)', :constraints => lambda { |req| !req.path.include?('view/api') }, to: 'machine_telemetries#forward_request', via: [:get, :post, :delete,:put, :patch] + match '(/*path)(/)', constraints: ->(req) { !req.path.include?('view/api') }, to: 'machine_telemetries#forward_request', via: [:get, :post, :delete, :put, :patch] end end diff --git a/db/seeds.d/179_ui_notifications.rb b/db/seeds.d/179_ui_notifications.rb index eae233e6..28618b0b 100644 --- a/db/seeds.d/179_ui_notifications.rb +++ b/db/seeds.d/179_ui_notifications.rb @@ -8,4 +8,3 @@ ] blueprints.each { |blueprint| UINotifications::Seed.new(blueprint).configure } - diff --git a/db/seeds.d/50_job_templates.rb b/db/seeds.d/50_job_templates.rb index e36d88bf..018bbabf 100644 --- a/db/seeds.d/50_job_templates.rb +++ b/db/seeds.d/50_job_templates.rb @@ -4,11 +4,11 @@ JobTemplate.without_auditing do Dir[File.join("#{ForemanRhCloud::Engine.root}/app/views/job_templates/**/*.erb")].each do |template| template = JobTemplate.import_raw!(File.read(template), - :default => true, - :lock => true, - :update => true) + :default => true, + :lock => true, + :update => true) template.organizations = organizations if template.present? template.locations = locations if template.present? end end -end \ No newline at end of file +end diff --git a/foreman_rh_cloud.gemspec b/foreman_rh_cloud.gemspec index fef25bce..72bd81f9 100644 --- a/foreman_rh_cloud.gemspec +++ b/foreman_rh_cloud.gemspec @@ -18,9 +18,9 @@ Gem::Specification.new do |s| s.test_files = Dir['test/**/*'] s.test_files -= Dir['test/**/*.orig'] - s.add_dependency 'katello' s.add_dependency 'foreman_ansible' s.add_dependency 'foreman-tasks' + s.add_dependency 'katello' s.add_development_dependency 'rdoc' s.add_development_dependency 'rubocop' diff --git a/lib/tasks/hybrid_cloud.rake b/lib/tasks/hybrid_cloud.rake index 085b29ef..4f39b213 100644 --- a/lib/tasks/hybrid_cloud.rake +++ b/lib/tasks/hybrid_cloud.rake @@ -7,7 +7,7 @@ namespace :rh_cloud do |args| task hybridcloud_register: [:environment] do include ::ForemanRhCloud::CertAuth include ::InsightsCloud::CandlepinCache - + def logger @logger ||= Logger.new(STDOUT) end @@ -21,7 +21,7 @@ namespace :rh_cloud do |args| logger.error('ERROR: org_id needs to be specified.') exit(1) end - + @organization = Organization.find_by(id: ENV['org_id'].to_i) # saw this coming in as a string, so making sure it gets passed as an integer. @uid = cp_owner_id(@organization) @hostname = ForemanRhCloud.foreman_host_name @@ -33,14 +33,14 @@ namespace :rh_cloud do |args| def headers { - Authorization: "Bearer #{@token}" + Authorization: "Bearer #{@token}", } end def payload { "uid": @uid, - "display_name": "#{@hostname}+#{@organization.label}" + "display_name": "#{@hostname}+#{@organization.label}", } end diff --git a/lib/tasks/rh_cloud_inventory.rake b/lib/tasks/rh_cloud_inventory.rake index 3e018f74..6debd53e 100644 --- a/lib/tasks/rh_cloud_inventory.rake +++ b/lib/tasks/rh_cloud_inventory.rake @@ -4,10 +4,10 @@ namespace :rh_cloud_inventory do namespace :report do desc 'Generate inventory report and send it to Red Hat cloud' task generate_upload: [:environment, 'dynflow:client'] do - unless ENV['organization_id'].nil? - organizations = [ Organization.where(:id => ENV['organization_id']).first ] - else + if ENV['organization_id'].nil? organizations = Organization.unscoped.all + else + organizations = [Organization.where(:id => ENV['organization_id']).first] end User.as_anonymous_admin do @@ -55,8 +55,8 @@ namespace :rh_cloud_inventory do desc "Synchronize Hosts inventory" task sync: [:environment, 'dynflow:client'] do - if ! ENV['organization_id'].nil? - organizations = [ Organization.where(:id => ENV['organization_id']).first ] + if !ENV['organization_id'].nil? + organizations = [Organization.where(:id => ENV['organization_id']).first] else organizations = Organization.all end