Module: PuppetX::SLURM::Type

Defined in:
lib/puppet_x/slurm/type.rb

Overview

Module for shared type configs

Instance Method Summary collapse

Instance Method Details

#add_autorequires(cluster = true, slurmdbd = true, slurmctld = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/puppet_x/slurm/type.rb', line 5

def add_autorequires(cluster = true, slurmdbd = true, slurmctld = false)
  if cluster
    autorequire(:slurm_cluster) do
      requires = []
      catalog.resources.each do |resource|
        if resource.class.to_s == 'Puppet::Type::Slurm_cluster'
          requires << resource.name
        end
      end
      requires
    end
  end

  autorequire(:service) do
    ['slurmctld', 'slurmdbd']
  end

  if slurmdbd
    autorequire(:slurmdbd_conn_validator) do
      requires = []
      catalog.resources.each do |resource|
        if resource.class.to_s == 'Puppet::Type::Slurmdbd_conn_validator'
          requires << resource.name
        end
      end
      requires
    end
  end

  if slurmctld # rubocop:disable Style/GuardClause
    autorequire(:slurmctld_conn_validator) do
      requires = []
      catalog.resources.each do |resource|
        if resource.class.to_s == 'Puppet::Type::Slurmctld_conn_validator'
          requires << resource.name
        end
      end
      requires
    end
  end
end