Class: Puppet::Provider::Patronictl

Inherits:
Puppet::Provider
  • Object
show all
Defined in:
lib/puppet/provider/patronictl.rb

Overview

Parent class for patronictl providers

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



7
8
9
# File 'lib/puppet/provider/patronictl.rb', line 7

def config
  @config
end

.pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/puppet/provider/patronictl.rb', line 6

def path
  @path
end

Class Method Details

.flatten_hash(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/puppet/provider/patronictl.rb', line 29

def self.flatten_hash(hash)
  hash.each_with_object({}) do |(k, v), h|
    if v.is_a? Hash
      flatten_hash(v).map do |h_k, h_v|
        h["#{k}.#{h_k}"] = h_v
      end
    else
      h[k] = v
    end
  end
end

.patronictl(args, options = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/puppet/provider/patronictl.rb', line 10

def self.patronictl(args, options = {})
  cmd = [@path] + ['-c', @config] + args
  default_options = { combine: true, override_locale: false, custom_environment: { 'LC_ALL' => 'en_US.utf8' } }
  ret = execute(cmd, default_options.merge(options))
  ret
end

.type_propertiesObject



21
22
23
# File 'lib/puppet/provider/patronictl.rb', line 21

def self.type_properties
  resource_type.validproperties.reject { |p| p.to_sym == :ensure }
end

Instance Method Details

#patronictl(*args) ⇒ Object



17
18
19
# File 'lib/puppet/provider/patronictl.rb', line 17

def patronictl(*args)
  self.class.patronictl(*args)
end

#type_propertiesObject



25
26
27
# File 'lib/puppet/provider/patronictl.rb', line 25

def type_properties
  self.class.type_properties
end