Module: Ridley::BootstrapBinding

Included in:
UnixTemplateBinding, WindowsTemplateBinding
Defined in:
lib/ridley/mixin/bootstrap_binding.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



46
47
48
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 46

def attributes
  @attributes
end

#bootstrap_proxyObject (readonly)

Returns the value of attribute bootstrap_proxy.



38
39
40
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 38

def bootstrap_proxy
  @bootstrap_proxy
end

#chef_versionObject (readonly)

Returns the value of attribute chef_version.



39
40
41
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 39

def chef_version
  @chef_version
end

#default_optionsObject (readonly)

Returns the value of attribute default_options.



40
41
42
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 40

def default_options
  @default_options
end

#encrypted_data_bag_secretObject (readonly)

Returns the value of attribute encrypted_data_bag_secret.



42
43
44
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 42

def encrypted_data_bag_secret
  @encrypted_data_bag_secret
end

#environmentObject (readonly)

Returns the value of attribute environment.



48
49
50
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 48

def environment
  @environment
end

#node_nameObject (readonly)

Returns the value of attribute node_name.



45
46
47
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 45

def node_name
  @node_name
end

#run_listObject (readonly)

Returns the value of attribute run_list.



47
48
49
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 47

def run_list
  @run_list
end

#server_urlObject (readonly)

Returns the value of attribute server_url.



43
44
45
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 43

def server_url
  @server_url
end

#template_fileObject (readonly)

Returns the value of attribute template_file.



37
38
39
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 37

def template_file
  @template_file
end

#validator_clientObject (readonly)

Returns the value of attribute validator_client.



44
45
46
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 44

def validator_client
  @validator_client
end

#validator_pathObject (readonly)

Returns the value of attribute validator_path.



41
42
43
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 41

def validator_path
  @validator_path
end

Class Method Details

.included(base) ⇒ Object



32
33
34
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 32

def included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#first_bootString

Returns:

  • (String)


56
57
58
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 56

def first_boot
  JSON.fast_generate(attributes.merge(run_list: run_list))
end

#templateErubis::Eruby

Returns:

  • (Erubis::Eruby)


72
73
74
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 72

def template
  Erubis::Eruby.new(IO.read(template_file).chomp)
end

#templates_pathPathname

Returns:

  • (Pathname)


51
52
53
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 51

def templates_path
  Ridley.root.join('bootstrappers')
end

#validation_keyString

The validation key to create a new client for the node

Returns:

  • (String)

Raises:



65
66
67
68
69
# File 'lib/ridley/mixin/bootstrap_binding.rb', line 65

def validation_key
  IO.read(File.expand_path(validator_path)).chomp
rescue Errno::ENOENT
  raise Errors::ValidatorNotFound, "Error bootstrapping: Validator not found at '#{validator_path}'"
end