Class: VagrantBolt::Runner
- Inherits:
-
Object
- Object
- VagrantBolt::Runner
- Defined in:
- lib/vagrant-bolt/runner.rb
Instance Method Summary collapse
-
#initialize(env, machine, boltconfig = nil) ⇒ Runner
constructor
A new instance of Runner.
-
#run(command, name, **args) ⇒ Object
Run a bolt task or plan.
Constructor Details
#initialize(env, machine, boltconfig = nil) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 |
# File 'lib/vagrant-bolt/runner.rb', line 8 def initialize(env, machine, boltconfig = nil) @env = env @machine = machine @boltconfig = boltconfig.nil? ? VagrantBolt::Config::Bolt.new : boltconfig @inventory_path = VagrantBolt::Util::Bolt.inventory_file(@env) end |
Instance Method Details
#run(command, name, **args) ⇒ Object
Run a bolt task or plan
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-bolt/runner.rb', line 20 def run(command, name, **args) @boltconfig = setup_overrides(command, name, **args) # Don't run anything if there are targets to run it on # TODO: Gate this in a more efficient manner. It is possible to run plans without a target list. return if @boltconfig.target_list.nil? @inventory_path = VagrantBolt::Util::Bolt.update_inventory_file(@env) validate command = VagrantBolt::Util::Bolt.generate_bolt_command(@boltconfig, @inventory_path) VagrantBolt::Util::Machine.run_command(command, @machine.ui) end |