Module: Config::Check

Defined in:
lib/wf_node_api/config/check.rb

Class Method Summary (collapse)

Class Method Details

+ (Object) run

Runs the configuration check

Raises:

  • (RuntimeError)


7
8
9
10
11
# File 'lib/wf_node_api/config/check.rb', line 7

def self.run
  if self.valid_container_type?($container_type) == false
    raise RuntimeError, 'container_type is invalid'
  end
end

+ (Boolean) valid_container_type?(container_type)

Checks if the submitted container type is registered and valid

Parameters:

  • container_type (String)

    The container type to check

Returns:

  • (Boolean)

    Result of the validation

Raises:

  • (ArgumentError)

    If the container type is not set



20
21
22
23
24
25
# File 'lib/wf_node_api/config/check.rb', line 20

def self.valid_container_type?(container_type)
  raise ArgumentError 'container_type not set' if container_type.nil?
  valid_types = ['lxc', 'vserver']

  valid_types.include?(container_type)
end