From 6c877d214f5f69a08efb91c979c3f5c6208fc47c Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 10 Sep 2024 15:36:03 +0200 Subject: [PATCH 1/2] Refs #37625 - Minor style fixes --- .../concerns/foreman_azure_rm/vm_extensions/managed_vm.rb | 2 +- foreman_azure_rm.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb b/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb index 114d046..3ffb3b3 100644 --- a/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb +++ b/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb @@ -182,7 +182,7 @@ def initialize_vm(vm_hash) arr.each do |item| kv = item.split('=') vm.tags[kv[0].strip] = kv[1].strip - end + end end unless vm_hash[:availability_set_id].nil? sub_resource = MsRestAzure::SubResource.new diff --git a/foreman_azure_rm.gemspec b/foreman_azure_rm.gemspec index 405b2ba..f658f23 100644 --- a/foreman_azure_rm.gemspec +++ b/foreman_azure_rm.gemspec @@ -1,4 +1,4 @@ -require File.expand_path('../lib/foreman_azure_rm/version', __FILE__) +require File.expand_path('lib/foreman_azure_rm/version', __dir__) require 'date' Gem::Specification.new do |s| From 2bb74a1f7ff18d3ad05e65fe0c63c0f3ccf2fa1a Mon Sep 17 00:00:00 2001 From: Shim Shtein Date: Thu, 4 Jul 2024 17:14:07 +0300 Subject: [PATCH 2/2] Fixes #37625 - Fix the plugin to support zeitwerk --- lib/foreman_azure_rm/engine.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/foreman_azure_rm/engine.rb b/lib/foreman_azure_rm/engine.rb index caf5cef..3792fcc 100644 --- a/lib/foreman_azure_rm/engine.rb +++ b/lib/foreman_azure_rm/engine.rb @@ -4,12 +4,12 @@ class Engine < ::Rails::Engine #autoloading all files inside lib dir config.eager_load_paths += Dir["#{config.root}/lib"] - config.eager_load_paths += Dir["#{config.root}/app/models/concerns/foreman_azure_rm/vm_extensions/"] + config.eager_load_paths += Dir["#{config.root}/app/models/concerns/"] config.eager_load_paths += Dir["#{config.root}/app/helpers/"] initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do Foreman::Plugin.register :foreman_azure_rm do - requires_foreman '>= 3.7' + requires_foreman '>= 3.13' register_gettext compute_resource ForemanAzureRm::AzureRm parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id, :region, :cloud @@ -29,6 +29,14 @@ class Engine < ::Rails::Engine end end + initializer "foreman_azure_rm.zeitwerk" do + Rails.autoloaders.each do |loader| + loader.ignore( + ForemanAzureRm::Engine.root.join('lib/foreman_azure_rm/version.rb') + ) + end + end + config.to_prepare do require 'azure_mgmt_resources' require 'azure_mgmt_network'