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| 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'