Sha256: e945aafae36a750de9867aa0a1aaa02e088d43d9d6ba079f2882cf8954714061

Contents?: true

Size: 1.87 KB

Versions: 5

Compression:

Stored size: 1.87 KB

Contents

module Coral
  module Vagrant
    module SubCommand
      class CoralUpdate < ::Vagrant.plugin('2', :command)
      
        #-----------------------------------------------------------------------
        # Execution
  
        def execute
          options = {}
          success = true
        
          opts = OptionParser.new do |opts|
            opts.banner = 'Usage: coral init -h [ {server_name} ... ]'
            opts.separator ''
          
            options[:min] = 1
            opts.on('-m', '--min TRIES', 'Minimum number of provision runs (1)') do |m|
              options[:min] = m
            end
          
            options[:tries] = 1       
            opts.on('-t', '--tries TRIES', 'Number of provision attempts before stopping with an error (1)') 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_DIR,...', '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 unless servers       
        
          with_target_vms(servers) do |vm|
            @env.ui.info("Starting update run for: #{vm.name}")
          
            success = 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

5 entries across 5 versions & 1 rubygems

Version Path
coral_vagrant-0.2.8 lib/coral_vagrant/commands/coral/update.rb
coral_vagrant-0.2.5 lib/coral_vagrant/commands/coral/update.rb
coral_vagrant-0.2.4 lib/coral_vagrant/commands/coral/update.rb
coral_vagrant-0.2.3 lib/coral_vagrant/commands/coral/update.rb
coral_vagrant-0.2.2 lib/coral_vagrant/commands/coral/update.rb