Module: ConfigCheck

Defined in:
lib/wf_node_api/config_check.rb

Overview

__ _ _ _ _ __ __ __ \ \ / / |__ (_) |_ _| _| _ _ _ / _| / |

\ \ /\ / /| '_ \| | __/ _ \ |_ | | | / __|/ _ \ |   | |\/| |
 \ V  V / | | | | | ||  __/  _|| |_| \__ \  __/ |___| |  | |
  \_/\_/  |_| |_|_|\__\___|_|   \__,_|___/\___|\____|_|  |_|
                                           Container Manager

Copyright © 2015 David Prandzioch <[email protected]>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Class Method Summary collapse

Class Method Details

.runObject

Runs the configuration check

Raises:

  • (RuntimeError)


31
32
33
34
35
# File 'lib/wf_node_api/config_check.rb', line 31

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

.valid_container_type?(container_type) ⇒ Boolean

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



44
45
46
47
48
49
# File 'lib/wf_node_api/config_check.rb', line 44

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