Class: Knife::Clc::Bootstrap::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/knife-clc/bootstrap/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Validator

Returns a new instance of Validator.



9
10
11
12
13
# File 'lib/knife-clc/bootstrap/validator.rb', line 9

def initialize(params)
  @connection = params.fetch(:connection)
  @config = params.fetch(:config)
  @errors = params.fetch(:errors)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/knife-clc/bootstrap/validator.rb', line 7

def config
  @config
end

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/knife-clc/bootstrap/validator.rb', line 7

def connection
  @connection
end

#errorsObject (readonly)

Returns the value of attribute errors.



7
8
9
# File 'lib/knife-clc/bootstrap/validator.rb', line 7

def errors
  @errors
end

Instance Method Details

#validateObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/knife-clc/bootstrap/validator.rb', line 15

def validate
  return unless config[:clc_bootstrap]

  check_chef_server_connectivity

  if config[:clc_bootstrap_platform]
    validate_bootstrap_platform
  else
    check_server_platform
  end

  check_server_platform
  if config[:clc_wait]
    check_bootstrap_connectivity_params
  else
    check_bootstrap_node_connectivity_params
  end
end