Sha256: d650a4446fab10a4608d25ec77916907c30c3b34cf41d94621325f1985bbecc9

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

module Vagrant
module Command
module Coral
class Run < Base
      
  #-----------------------------------------------------------------------------
  # Execution
  
  def execute
    options = {}
    success = true
        
    opts = OptionParser.new do |opts|
      opts.banner = "Usage: vagrant cloud run [plan-name]... [-h] ..."
      opts.separator ""          
          
      options[:repo] = 'config'        
      opts.on("-r", "--repo REPO_DIR", "Local directories of repositories (relative to the Vagrantfile root)") do |r|
        options[:repo] = r
      end     
          
      options[:directory] = 'plans'
      opts.on("-d", "--directory DIR", "Local directory that contains the plan(s) being executed") do |d|
        options[:directory] = d
      end         
    end
        
    #---
        
    plans = parse_options(opts)
    return if ! plans
        
    plans.each do |plan_name|
      @logger.debug("Running plan: #{plan_name}")
                   
      success = ::Coral.create_plan(plan_name, {
        :home        => ::Coral.vagrant, 
        :submodule   => options[:repo], 
        :config_file => "#{options[:directory]}/#{plan_name}.json",
        :logger      => @logger,
        :ui          => @env.ui,
      }).run(options)
          
      break unless success
    end
             
    exit success ? 0 : 1
  end
end
end
end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coral_vagrant-0.2.1 lib/coral_vagrant/commands/coral_run.rb
coral_vagrant-0.2.0 lib/coral_vagrant/commands/coral_run.rb
coral_vagrant-0.1.5 lib/coral_vagrant/commands/coral_run.rb
coral_vagrant-0.1.4 lib/coral_vagrant/commands/coral_run.rb