Class: VagrantPlugins::PuppetFactGenerator::Action::GenerateFacts
- Inherits:
-
Object
- Object
- VagrantPlugins::PuppetFactGenerator::Action::GenerateFacts
- Defined in:
- lib/vagrant-puppet-fact-generator/actions/generate_facts.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ GenerateFacts
constructor
A new instance of GenerateFacts.
Constructor Details
#initialize(app, env) ⇒ GenerateFacts
Returns a new instance of GenerateFacts.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/vagrant-puppet-fact-generator/actions/generate_facts.rb', line 6 def initialize(app, env) @app = app @env = env @puppet_fact_generator = @env[:machine].config.puppet_fact_generator provisioner = nil @env[:machine].config.vm.provisioners.each do |p| if p.name == :puppet provisioner = p break end end @puppet_config = provisioner ? provisioner.config: nil end |
Instance Method Details
#call(env) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/vagrant-puppet-fact-generator/actions/generate_facts.rb', line 21 def call(env) if @puppet_config and @puppet_fact_generator.facts @puppet_fact_generator.facts.each_pair { |k, v| @env[:ui].success "Creating fact #{k} => #{v}" } @puppet_config.facter = @puppet_config.facter.merge(@puppet_fact_generator.facts) end @app.call(env) end |