Sha256: 963e8b286bcb23bb9646ef3cfaa53f2f305f61dfc9b41b4558e921a1ef410456

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

module ForemanAzureRM
  class Engine < ::Rails::Engine
    engine_name 'foreman_azure_rm'

    #autoloading all files inside lib dir
    config.autoload_paths += Dir["#{config.root}/lib"]
    config.autoload_paths += Dir["#{config.root}/app/models/concerns"]

    initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do
      Foreman::Plugin.register :foreman_azure_rm do
        requires_foreman '>= 1.17'
        compute_resource ForemanAzureRM::AzureRM
        parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id
      end
    end

    initializer 'foreman_azure_rm.register_gettext', after: :load_config_initializers do
      locale_dir    = File.join(File.expand_path('../../../', __FILE__), 'locale')
      locale_domain = 'foreman_azure_rm'
      Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
    end

    config.to_prepare do
      require 'azure_mgmt_resources'
      require 'azure_mgmt_network'
      require 'azure_mgmt_storage'
      require 'azure_mgmt_compute'

      # Use excon as default so that HTTP Proxy settings of foreman works
      Faraday::default_adapter=:excon

      ::HostsController.send(:include, ForemanAzureRM::Concerns::HostsControllerExtensions)

      Api::V2::ComputeResourcesController.send(:include, ForemanAzureRM::Concerns::ComputeResourcesControllerExtensions)
    end

    rake_tasks do
      load "foreman_azure_rm.rake"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
foreman_azure_rm-2.0.0.pre1 lib/foreman_azure_rm/engine.rb