vagrant-vbguest 0.6.0.pre2 → 0.6.0.pre3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -21,6 +21,7 @@ module VagrantVbguest | |
| 21 21 |  | 
| 22 22 | 
             
                    opts.on("--do COMMAND", [:start, :rebuild, :install], "Manually `start`, `rebuild` or `install` GueastAdditions.") do |command|
         | 
| 23 23 | 
             
                      options[:_method] = command
         | 
| 24 | 
            +
                      options[:force] = true
         | 
| 24 25 | 
             
                    end
         | 
| 25 26 |  | 
| 26 27 | 
             
                    opts.on("--status", "Print current GuestAdditions status and exit.") do
         | 
| @@ -28,22 +29,7 @@ module VagrantVbguest | |
| 28 29 | 
             
                      options[:_rebootable] = false
         | 
| 29 30 | 
             
                    end
         | 
| 30 31 |  | 
| 31 | 
            -
                     | 
| 32 | 
            -
                    #   options[:_method] = :start
         | 
| 33 | 
            -
                    #   options[:_rebootable] = false
         | 
| 34 | 
            -
                    # end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                    # opts.on("--rebuild", "Rebuild the existing GuestAdditions.") do
         | 
| 37 | 
            -
                    #   options[:_method] = :rebuild
         | 
| 38 | 
            -
                    #   options[:force] = true
         | 
| 39 | 
            -
                    # end
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                    # opts.on("--install", "Install GuestAdditions matching your host system.") do
         | 
| 42 | 
            -
                    #   options[:_method] = :install
         | 
| 43 | 
            -
                    #   options[:force] = true
         | 
| 44 | 
            -
                    # end
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                    opts.on("-f", "--force", "Whether to force the installation. (Implied by --install and --rebuild)") do
         | 
| 32 | 
            +
                    opts.on("-f", "--force", "Whether to force the installation. (Implied by --do start|rebuild|install)") do
         | 
| 47 33 | 
             
                      options[:force] = true
         | 
| 48 34 | 
             
                    end
         | 
| 49 35 |  | 
| @@ -80,11 +66,14 @@ module VagrantVbguest | |
| 80 66 |  | 
| 81 67 | 
             
                # Executes a command on a specific VM.
         | 
| 82 68 | 
             
                def execute_on_vm(vm, options)
         | 
| 69 | 
            +
                  raise Vagrant::Errors::VMNotCreatedError if !vm.created?
         | 
| 70 | 
            +
                  raise Vagrant::Errors::VMInaccessible if !vm.state == :inaccessible
         | 
| 71 | 
            +
                  raise Vagrant::Errors::VMNotRunningError if vm.state != :running
         | 
| 72 | 
            +
             | 
| 83 73 | 
             
                  options     = options.clone
         | 
| 84 74 | 
             
                  _method     = options.delete(:_method)
         | 
| 85 75 | 
             
                  _rebootable = options.delete(:_rebootable)
         | 
| 86 76 |  | 
| 87 | 
            -
             | 
| 88 77 | 
             
                  options = vm.config.vbguest.to_hash.merge(options)
         | 
| 89 78 | 
             
                  machine = VagrantVbguest::Machine.new(vm, options)
         | 
| 90 79 | 
             
                  status  = machine.state
         | 
| @@ -108,9 +108,6 @@ module VagrantVbguest | |
| 108 108 | 
             
                #
         | 
| 109 109 | 
             
                # @return [Installers::Base]
         | 
| 110 110 | 
             
                def guest_installer
         | 
| 111 | 
            -
                  raise Vagrant::Errors::VMNotCreatedError if !@vm.created?
         | 
| 112 | 
            -
                  raise Vagrant::Errors::VMInaccessible if !@vm.state == :inaccessible
         | 
| 113 | 
            -
                  raise Vagrant::Errors::VMNotRunningError if @vm.state != :running
         | 
| 114 111 |  | 
| 115 112 | 
             
                  @guest_installer ||= if @options[:installer].is_a? Class
         | 
| 116 113 | 
             
                    @options[:installer].new(@vm)
         | 
| @@ -6,6 +6,8 @@ module VagrantVbguest | |
| 6 6 | 
             
                attr_reader :installer, :vm, :options
         | 
| 7 7 |  | 
| 8 8 | 
             
                def initialize vm, options
         | 
| 9 | 
            +
                  @logger = Log4r::Logger.new("vagrant::plugins::vbguest-machine")
         | 
| 10 | 
            +
                  @logger.debug("initialize vbguest machine for VM '#{vm.name}' (#{vm.uuid})")
         | 
| 9 11 | 
             
                  @vm = vm
         | 
| 10 12 | 
             
                  @options = options
         | 
| 11 13 | 
             
                  @installer = Installer.new @vm, @options
         | 
| @@ -24,12 +26,18 @@ module VagrantVbguest | |
| 24 26 | 
             
                end
         | 
| 25 27 |  | 
| 26 28 | 
             
                def run
         | 
| 27 | 
            -
                  runlist = steps
         | 
| 28 29 | 
             
                  current_state = state
         | 
| 30 | 
            +
                  runlist = steps(current_state)
         | 
| 31 | 
            +
                  @logger.debug("Runlist for state #{current_state} is: #{runlist}")
         | 
| 29 32 | 
             
                  while (command = runlist.shift)
         | 
| 30 | 
            -
                     | 
| 33 | 
            +
                    @logger.debug("Running command #{command} from runlist")
         | 
| 34 | 
            +
                    if !self.send(command)
         | 
| 35 | 
            +
                      vm.ui.error('vagrant.plugins.vbguest.machine_loop_gard', :command => command, :state => current_state)
         | 
| 36 | 
            +
                      return false
         | 
| 37 | 
            +
                    end
         | 
| 31 38 | 
             
                    return run if current_state != state
         | 
| 32 39 | 
             
                  end
         | 
| 40 | 
            +
                  true
         | 
| 33 41 | 
             
                end
         | 
| 34 42 |  | 
| 35 43 | 
             
                def install
         | 
| @@ -53,7 +61,7 @@ module VagrantVbguest | |
| 53 61 | 
             
                def reboot;  @box_machine.trigger :reboot end
         | 
| 54 62 | 
             
                def reboot?; @box_machine.state == :rebooted end
         | 
| 55 63 |  | 
| 56 | 
            -
                def steps
         | 
| 64 | 
            +
                def steps(state)
         | 
| 57 65 | 
             
                  case state
         | 
| 58 66 | 
             
                  when :clean, :unmatched
         | 
| 59 67 | 
             
                    [:install]
         | 
| @@ -66,10 +74,13 @@ module VagrantVbguest | |
| 66 74 |  | 
| 67 75 | 
             
                def state
         | 
| 68 76 | 
             
                  guest_version = installer.guest_version(true)
         | 
| 77 | 
            +
                  host_version  = installer.host_version
         | 
| 78 | 
            +
                  running = installer.running?
         | 
| 79 | 
            +
                  @logger.debug("Current states for VM '#{vm.name}' are : guest_version=#{guest_version} : host_version=#{host_version} : running=#{running}")
         | 
| 69 80 |  | 
| 70 81 | 
             
                  return :clean       if !guest_version
         | 
| 71 | 
            -
                  return :unmatched   if  | 
| 72 | 
            -
                  return :not_running if ! | 
| 82 | 
            +
                  return :unmatched   if host_version != guest_version
         | 
| 83 | 
            +
                  return :not_running if !running
         | 
| 73 84 | 
             
                  return :ok
         | 
| 74 85 | 
             
                end
         | 
| 75 86 |  | 
    
        data/locales/en.yml
    CHANGED
    
    | @@ -12,6 +12,7 @@ en: | |
| 12 12 | 
             
                    restart_vm: "Restarting VM to apply changes..."
         | 
| 13 13 | 
             
                    suggest_restart: "Guest Additions got installed. However, they seem not be loaded correctly. Please restart the box runing `vagrant reload %{name}`"
         | 
| 14 14 | 
             
                    restart_loop_guard_activated: "Guest Additions will not load, even after reboot."
         | 
| 15 | 
            +
                    machine_loop_gard: "Could not execute %{command} from current state %{state}. To prevent running in circles, we'll stop."
         | 
| 15 16 | 
             
                    guest_version_reports_differ: |-
         | 
| 16 17 | 
             
                      Got different reports about installed GuestAdditions version:
         | 
| 17 18 | 
             
                      Virtualbox on your host claims:   %{driver}
         | 
    
        data/vagrant-vbguest.gemspec
    CHANGED
    
    | @@ -19,7 +19,8 @@ Gem::Specification.new do |s| | |
| 19 19 | 
             
              # specify any dependencies here; for example:
         | 
| 20 20 | 
             
              # s.add_development_dependency "rspec"
         | 
| 21 21 | 
             
              # s.add_runtime_dependency "rest-client"
         | 
| 22 | 
            -
              s. | 
| 22 | 
            +
              s.add_dependency "micromachine", "~> 1.0.4"
         | 
| 23 | 
            +
              s.add_dependency "log4r", "~> 1.1.9"
         | 
| 23 24 |  | 
| 24 25 | 
             
              s.add_development_dependency "bundler", ">= 1.2.0"
         | 
| 25 26 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: vagrant-vbguest
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.6.0. | 
| 4 | 
            +
              version: 0.6.0.pre3
         | 
| 5 5 | 
             
              prerelease: 6
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,24 +9,40 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-12- | 
| 12 | 
            +
            date: 2012-12-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: micromachine
         | 
| 16 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 | 
            -
                - -  | 
| 19 | 
            +
                - - ~>
         | 
| 20 20 | 
             
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            -
                    version:  | 
| 21 | 
            +
                    version: 1.0.4
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 24 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 25 | 
             
                none: false
         | 
| 26 26 | 
             
                requirements:
         | 
| 27 | 
            -
                - -  | 
| 27 | 
            +
                - - ~>
         | 
| 28 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            +
                    version: 1.0.4
         | 
| 30 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 31 | 
            +
              name: log4r
         | 
| 32 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 33 | 
            +
                none: false
         | 
| 34 | 
            +
                requirements:
         | 
| 35 | 
            +
                - - ~>
         | 
| 36 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                    version: 1.1.9
         | 
| 38 | 
            +
              type: :runtime
         | 
| 39 | 
            +
              prerelease: false
         | 
| 40 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 41 | 
            +
                none: false
         | 
| 42 | 
            +
                requirements:
         | 
| 43 | 
            +
                - - ~>
         | 
| 28 44 | 
             
                  - !ruby/object:Gem::Version
         | 
| 29 | 
            -
                    version:  | 
| 45 | 
            +
                    version: 1.1.9
         | 
| 30 46 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 31 47 | 
             
              name: bundler
         | 
| 32 48 | 
             
              requirement: !ruby/object:Gem::Requirement
         |