Class: CemAcpt::Provision::OsData

Inherits:
Object
  • Object
show all
Extended by:
Logging
Includes:
Logging
Defined in:
lib/cem_acpt/provision/terraform/os_data.rb

Overview

Base class for OS-specific provisioning data

Direct Known Subclasses

Linux, Windows

Constant Summary

Constants included from Logging

Logging::LEVEL_MAP

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

current_log_config, current_log_config, current_log_format, current_log_format, current_log_level, current_log_level, included, logger, logger, new_log_config, new_log_config, new_log_formatter, new_log_formatter, new_log_level, new_log_level, new_logger, new_logger, verbose?, verbose?

Constructor Details

#initialize(config, provision_data) ⇒ OsData

Returns a new instance of OsData.



33
34
35
36
37
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 33

def initialize(config, provision_data)
  @config = config
  @provision_data = provision_data
  @base_provision_directory = @config.get('terraform.dir')
end

Instance Attribute Details

#base_provision_directoryObject

Returns the value of attribute base_provision_directory.



31
32
33
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 31

def base_provision_directory
  @base_provision_directory
end

Class Method Details

.use_for?(test_name) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
21
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 12

def self.use_for?(test_name)
  name_ver = test_name.match(%r{^\w+_(\w+)-(\d+).*})
  return false unless name_ver && name_ver.length == 3

  if valid_versions.include?(name_ver[2]) || valid_versions.include?(name_ver[2].to_s)
    return true if valid_names.include?(name_ver[1])
  end

  false
end

.valid_namesObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 23

def self.valid_names
  raise NotImplementedError
end

.valid_versionsObject

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 27

def self.valid_versions
  raise NotImplementedError
end

Instance Method Details

#destination_provision_directoryObject

Raises:

  • (NotImplementedError)


59
60
61
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 59

def destination_provision_directory
  raise NotImplementedError
end

#goss_filesObject



67
68
69
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 67

def goss_files
  Dir.glob(File.join(provision_directory, 'goss', '*.yaml')).map { |f| File.basename(f) }
end

#implementation_nameObject



51
52
53
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 51

def implementation_name
  self.class.to_s.downcase.split('::').last
end

#provision_commandsObject

Raises:

  • (NotImplementedError)


63
64
65
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 63

def provision_commands
  raise NotImplementedError
end

#provision_directoryObject



55
56
57
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 55

def provision_directory
  File.join(base_provision_directory, implementation_name)
end

#puppet_bin_pathObject

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 39

def puppet_bin_path
  raise NotImplementedError
end

#puppet_manifest_fileObject



43
44
45
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 43

def puppet_manifest_file
  'manifest.pp'
end

#remote_module_package_nameObject



47
48
49
# File 'lib/cem_acpt/provision/terraform/os_data.rb', line 47

def remote_module_package_name
  'puppet-module.tar.gz'
end