Module: PuppetX::Eos::EapiProviderMixin
- Defined in:
- lib/puppet_x/eos/provider.rb
Overview
EapiProviderMixin module
Instance Method Summary collapse
-
#conf ⇒ Object
conf loads a YAML file from ‘/mnt/flash/eapi.conf’ if it exists.
- #eapi ⇒ Object
- #prefetch(resources) ⇒ Object
Instance Method Details
#conf ⇒ Object
conf loads a YAML file from ‘/mnt/flash/eapi.conf’ if it exists. If it does not exist an empty hash is returned.
57 58 59 60 61 62 63 64 |
# File 'lib/puppet_x/eos/provider.rb', line 57 def conf config_file = Pathname.new('/mnt/flash/eapi.conf') if config_file.exist? YAML.load_file(config_file.to_s) else Hash.new end end |
#eapi ⇒ Object
66 67 68 |
# File 'lib/puppet_x/eos/provider.rb', line 66 def eapi @eapi ||= PuppetX::Eos::Eapi.new(conf) end |
#prefetch(resources) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/puppet_x/eos/provider.rb', line 44 def prefetch(resources) provider_hash = instances.each_with_object({}) do |provider, hsh| hsh[provider.name] = provider end resources.each_pair do |name, resource| resource.provider = provider_hash[name] if provider_hash[name] end end |