Class: Puppet::Provider::Etcdctl
- Inherits:
-
Puppet::Provider
- Object
- Puppet::Provider
- Puppet::Provider::Etcdctl
- Defined in:
- lib/puppet/provider/etcdctl.rb
Overview
Helper class for common actions
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cfg_file ⇒ Object
10 11 12 13 14 |
# File 'lib/puppet/provider/etcdctl.rb', line 10 def self.cfg_file file = '/etc/puppetlabs/puppet/etcdctl.yaml' confine exists: file file end |
.etcdctl(args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/puppet/provider/etcdctl.rb', line 18 def self.etcdctl(args) cfg = YAML.load_file(cfg_file) cfg['env'].each do |key, value| ENV[key] = value end ENV['ETCDCTL_WRITE_OUT'] = 'json' out = cmd_etcdctl(args) begin JSON.parse(out) rescue JSON::ParserError out end end |
Instance Method Details
#etcdctl(args) ⇒ Object
32 33 34 |
# File 'lib/puppet/provider/etcdctl.rb', line 32 def etcdctl(args) self.class.etcdctl(args) end |