Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37625 - Fix the plugin to support zeitwerk #189

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion foreman_azure_rm.gemspec
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
12 changes: 10 additions & 2 deletions lib/foreman_azure_rm/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down