Class: Kitchen::Provisioner::DscLcm::LcmBase
- Inherits:
-
Object
- Object
- Kitchen::Provisioner::DscLcm::LcmBase
show all
- Defined in:
- lib/kitchen/provisioner/dsc_lcm/lcm_base.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config = {}) ⇒ LcmBase
Returns a new instance of LcmBase.
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 29
def initialize(config = {})
@certificate_id = nil
lcm_properties.each do |setting, value|
send(setting, value)
end
config.each do |setting, value|
send(setting, value)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 40
def method_missing(name, *args)
return super unless lcm_properties.keys.include?(name)
if args.length == 1
instance_variable_set("@#{name}", args.first)
else
instance_variable_get("@#{name}")
end
end
|
Instance Method Details
#certificate_id(value = nil) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 50
def certificate_id(value = nil)
if value.nil?
@certificate_id.nil? ? "$null" : "'#{@certificate_id}'"
else
@certificate_id = value
end
end
|
#lcm_config ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 58
def lcm_config
hash = {}
lcm_properties.keys.each do |key|
hash[key] = send(key)
end
hash
end
|
#lcm_configuration_script ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 66
def lcm_configuration_script
<<-LCMSETUP
configuration SetupLCM
{
LocalConfigurationManager
{
AllowModuleOverwrite = [bool]::Parse('#{allow_module_overwrite}')
CertificateID = #{certificate_id}
ConfigurationMode = '#{configuration_mode}'
ConfigurationModeFrequencyMins = #{configuration_mode_frequency_mins}
RebootNodeIfNeeded = [bool]::Parse('#{reboot_if_needed}')
RefreshFrequencyMins = #{refresh_frequency_mins}
RefreshMode = '#{refresh_mode}'
}
}
LCMSETUP
end
|
#lcm_properties ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/kitchen/provisioner/dsc_lcm/lcm_base.rb', line 17
def lcm_properties
{
allow_module_overwrite: false,
certificate_id: nil,
configuration_mode: "ApplyAndAutoCorrect",
configuration_mode_frequency_mins: 30,
reboot_if_needed: false,
refresh_mode: "PUSH",
refresh_frequency_mins: 15,
}
end
|