class Retrospec::Puppet::SpecObject
this object is passed to the templates for erb template rendering you can use data contained in this object in your templates
Attributes
Public Class Methods
@param mod_path [String] - the path to the module @param instance_data [Hash] @param config_data [Hash] - retrospec config data from config file and cli
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 13 def initialize(mod_path, instance_data, config_data) @instance = instance_data @config = config_data @module_path = mod_path all_hiera_data end
Public Instance Methods
@return [Hash] - return a hash of all the params found in provided hostclass only @param [String] - the name of the hostclass does not search for manual lookups using the hiera or lookup function
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 34 def class_hiera_data(classname) data = {} found_type = host_classes.find { |t| t.name == classname } return data unless found_type found_type.arguments.each do |k, _v| key = "#{found_type.name}::#{k}" data[key] = nil end data end
@return [Boolean] - true if the user wants to enable beaker tests
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 68 def enable_beaker_tests? config[:enable_beaker_tests] end
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 80 def fact_name instance[:name] end
@return [Array] - an array of all the hostclasses
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 46 def host_classes types.find_all { |t| t.type == :hostclass } end
allows the user to use the variable store to resolve the variable if it exists looks up the varible name in the variable store @param [String] - the name of the variable @return [String] - the value of the variable if found other returns variable
# File lib/retrospec/plugins/v1/plugin/spec_object.rb, line 76 def variable_value(variable_name) VariableStore.resolve(variable_name) end