diff --git a/.rubocop.yml b/.rubocop.yml index fb7f978..4cdd7b8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,6 +2,9 @@ inherit_gem: theforeman-rubocop: - strict.yml +AllCops: + TargetRubyVersion: 2.7 + Layout/LineLength: Enabled: 111 # TODO: discuss and set this diff --git a/app/lib/foreman_google/google_compute_adapter.rb b/app/lib/foreman_google/google_compute_adapter.rb index dbf1526..41a1562 100644 --- a/app/lib/foreman_google/google_compute_adapter.rb +++ b/app/lib/foreman_google/google_compute_adapter.rb @@ -91,9 +91,9 @@ def set_disk_auto_delete(zone, instance_identity) instance = instance(zone, instance_identity) instance.disks.each do |disk| manage_instance :set_disk_auto_delete, zone: zone, - device_name: disk.device_name, - instance: instance_identity, - auto_delete: true + device_name: disk.device_name, + instance: instance_identity, + auto_delete: true end end diff --git a/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb b/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb index e281bf9..f74435e 100644 --- a/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb +++ b/db/migrate/20220331113745_foreman_gce_to_foreman_google_gce.rb @@ -10,7 +10,7 @@ def up # mechanism failed to locate the subclass: 'Foreman::Model::GCE' ComputeResource.unscoped.where(type: original_type).update_all(type: new_type) - ComputeResource.unscoped.where(type: new_type).each do |cr| + ComputeResource.unscoped.where(type: new_type).find_each do |cr| unless cr.attrs[:key_path] say("Compute resource [#{cr.name}] is missing path to JSON key file, can't load the data. Please update the resource manually.") next diff --git a/foreman_google.gemspec b/foreman_google.gemspec index d2fbc1d..9b56926 100644 --- a/foreman_google.gemspec +++ b/foreman_google.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.homepage = 'https://github.com/theforeman/foreman_google' s.summary = 'Google Compute Engine plugin for the Foreman' s.description = 'Google Compute Engine plugin for the Foreman' - s.required_ruby_version = '>= 2.5' + s.required_ruby_version = '>= 2.7', '< 4' s.files = Dir['{app,config,db,lib,locale,webpack}/**/*'] + ['LICENSE', 'Rakefile', 'README.md', 'package.json'] s.test_files = Dir['test/**/*'] + Dir['webpack/**/__tests__/*.js'] diff --git a/test/test_google_helper.rb b/test/test_google_helper.rb index 30b59e3..2081b69 100644 --- a/test/test_google_helper.rb +++ b/test/test_google_helper.rb @@ -16,7 +16,7 @@ class GoogleTestCase < ActiveSupport::TestCase let(:google_access_token) { 'ya29.c.stubbed_token' } let(:gce_cr) { FactoryBot.create(:compute_resource, :google_gce) } let(:google_project_id) { gce_cr.google_project_id } - let(:gauth_json) { (ENV['VCR'] == '1' ? ENV['GCE_AUTH'] : nil) || gce_cr.password } + let(:gauth_json) { ((ENV['VCR'] == '1') ? ENV['GCE_AUTH'] : nil) || gce_cr.password } setup do ::Signet::OAuth2::Client.any_instance.stubs(fetch_access_token!: google_access_token) unless ENV['VCR'] == '1'