Module: ForemanSalt::Concerns::HostgroupExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/foreman_salt/concerns/hostgroup_extensions.rb

Instance Method Summary collapse

Instance Method Details

#all_salt_modulesObject



21
22
23
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 21

def all_salt_modules
  ForemanSalt::SaltModule.in_environment(salt_environment).where(id: salt_module_ids + inherited_salt_module_ids)
end

#inherited_salt_environment_idObject



53
54
55
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 53

def inherited_salt_environment_id
  self[:salt_environment_id] || nested(:salt_environment_id)
end

#inherited_salt_module_idsObject



29
30
31
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 29

def inherited_salt_module_ids
  ancestors.map(&:salt_module_ids).flatten.uniq
end

#inherited_salt_modulesObject



25
26
27
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 25

def inherited_salt_modules
  ForemanSalt::SaltModule.where(id: inherited_salt_module_ids)
end

#inherited_salt_proxy_idObject



41
42
43
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 41

def inherited_salt_proxy_id
  self[:salt_proxy_id] || nested(:salt_proxy_id)
end

#salt_environmentObject



45
46
47
48
49
50
51
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 45

def salt_environment
  if ancestry.present?
    ForemanSalt::SaltEnvironment.find_by(id: inherited_salt_environment_id)
  else
    super
  end
end

#salt_masterObject



57
58
59
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 57

def salt_master
  salt_proxy.to_s
end

#salt_proxyObject



33
34
35
36
37
38
39
# File 'app/models/foreman_salt/concerns/hostgroup_extensions.rb', line 33

def salt_proxy
  if ancestry.present?
    SmartProxy.with_features('Salt').find_by(id: inherited_salt_proxy_id)
  else
    super
  end
end