Sha256: adc1da8f6eac13b14c820e4f17a619af37ac36e987061085e3602387f42cb005

Contents?: true

Size: 1.18 KB

Versions: 23

Compression:

Stored size: 1.18 KB

Contents

module VagrantPlugins
  module Orchestrate
    module Command
      module CommandMixins
        # Given an array of vagrant command line args (e.g. the result of calling
        # parse_options), filter out unmanaged servers and provide the resulting list.
        def filter_unmanaged(argv)
          machines = []
          with_target_vms(argv) do |machine|
            if machine.provider_name.to_sym == :managed
              machines << machine
            else
              @logger.debug("Skipping #{machine.name} because it doesn't use the :managed provider")
            end
          end

          if machines.empty?
            @env.ui.info("No servers with :managed provider found. Exiting.")
          end

          machines
        end

        # Delete a file in a way that works on windows
        def super_delete(filepath)
          # Thanks, Windows. http://alx.github.io/2009/01/27/ruby-wundows-unlink.html
          10.times do
            begin
              File.delete(filepath)
              break
            rescue
              @logger.warn("Unable to delete file #{filepath}")
              sleep 0.05
            end
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
vagrant-orchestrate-0.5.2 lib/vagrant-orchestrate/command/command_mixins.rb
vagrant-orchestrate-0.5.1 lib/vagrant-orchestrate/command/command_mixins.rb
vagrant-orchestrate-0.5.0 lib/vagrant-orchestrate/command/command_mixins.rb