Module: ForemanAcd::HostManagedExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/foreman_acd/host_managed_extensions.rb

Overview

Extends the Host Managed

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/concerns/foreman_acd/host_managed_extensions.rb', line 8

def self.prepended(base)
  base.instance_eval do
    before_provision :initiate_acd_app_configurator_after_host_deployment, :if => :deployed_via_acd?
    before_destroy :check_deletable, :prepend => true, :if => :deployed_via_acd?

    has_many :app_instances, :through => :foreman_hosts, :class_name => 'ForemanAcd::AppInstance'

    scoped_search :relation => :app_instances,
      :on => :name,
      :rename => :acd_app_instance,
      :only_explicit => true,
      :complete_value => true,
      :operators => ['= '],
      :ext_method => :find_by_acd_app_instance_name
  end

  base.singleton_class.prepend ClassMethods
end

Instance Method Details

#deployed_via_acd?Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'app/models/concerns/foreman_acd/host_managed_extensions.rb', line 40

def deployed_via_acd?
  find_foreman_host
  @foreman_host.present?
end