Sha256: 9d1eb754043bdf20ee8af1eb9459dd7099762a8498961b7b3af605270b05ec35

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

module Vagrant
module Command
module Coral
class Update < Base
      
  #-----------------------------------------------------------------------------
  # Execution
  
  def execute
    options = {}
    success = true
        
    opts = OptionParser.new do |opts|
      opts.banner = "Usage: vagrant coral update [server-name]... [-h] ..."
      opts.separator ""
          
      options[:min] = 1
      opts.on("-m", "--min TRIES", "Minimum number of provision runs") do |m|
        options[:min] = m
      end
          
      options[:tries] = 5        
      opts.on("-t", "--tries TRIES", "Number of provision attempts before stopping with an error.") do |t|
        options[:tries] = t
      end
          
      options[:exit] = ''
      opts.on("-e", "--exit CONDITIONS", "Conditions on which to exit in the format (separated by comma): 'User[git]:ensure:created'") do |e|
        options[:exit] = e
      end
        
      options[:repos] = ''        
      opts.on("-r", "--repos REPO_DIRS,...'", "Local directories of repositories to push (relative to the Vagrantfile root)") do |r|
        options[:repos] = r
      end
    end
        
    options[:auth] = true

    #---
        
    servers = parse_options(opts)
    return if ! servers       
        
    with_target_vms(servers) do |vm|
      @env.ui.info("Starting update run for: #{vm.name}")
          
      success = ::Coral::Cloud::Server.new({
        :cloud   => ::Coral.vagrant,
        :machine => vm,
        :logger  => @logger,
        :ui      => @env.ui,
      }).update(options) if success
    end        
    exit success ? 0 : 1
  end
end
end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coral_vagrant-0.1.4 lib/coral_vagrant/commands/coral_update.rb