Module: VagrantPlugins::Orchestrate::Command::CommandMixins

Included in:
Push, Status
Defined in:
lib/vagrant-orchestrate/command/command_mixins.rb

Instance Method Summary collapse

Instance Method Details

#filter_unmanaged(argv) ⇒ Object

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.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vagrant-orchestrate/command/command_mixins.rb', line 7

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

#super_delete(filepath) ⇒ Object

Delete a file in a way that works on windows



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-orchestrate/command/command_mixins.rb', line 25

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