From f26b6098f915af18648753a8baa92b0740c42964 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sat, 11 Mar 2017 22:17:46 +0100 Subject: [PATCH 1/5] Make `start` action run provisioners if VM is running That is a port of the upstream Vagrant commit: https://github.com/mitchellh/vagrant/commit/e42f346b1d5891b5bd3651564894b95ed3b8b6cc Previously, there was no one gesture that would start a VM if it was not running and run the appropriate provisioners regardless of its original state. `vagrant up` did nothing if the VM was running, while `vagrant provision` did nothing if the VM was not running. Change the semantics of `vagrant up`, via the start actions of the providers, to go through the provisioning logic even if the VM is already running. The semantics of `run: "once"` vs `run: "always"` are respected. --- lib/vagrant-parallels/action.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-parallels/action.rb b/lib/vagrant-parallels/action.rb index dfb85608..9048dabc 100644 --- a/lib/vagrant-parallels/action.rb +++ b/lib/vagrant-parallels/action.rb @@ -277,9 +277,10 @@ def self.action_start Vagrant::Action::Builder.new.tap do |b| b.use BoxCheckOutdated b.use Call, IsState, :running do |env1, b1| - # If the VM is running, then our work here is done, exit + # If the VM is running, run the necessary provisioners if env1[:result] b1.use Message, I18n.t('vagrant_parallels.commands.common.vm_already_running') + action_provision next end From c66fea5658a622fda9c2de597fe2a32107f207b0 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sat, 25 Mar 2017 20:12:25 +0100 Subject: [PATCH 2/5] Handle "paused" VM state for up and halt actions --- lib/vagrant-parallels/action.rb | 23 ++++++++++++++--------- lib/vagrant-parallels/action/resume.rb | 4 ++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/vagrant-parallels/action.rb b/lib/vagrant-parallels/action.rb index dfb85608..a45a1a92 100644 --- a/lib/vagrant-parallels/action.rb +++ b/lib/vagrant-parallels/action.rb @@ -82,11 +82,8 @@ def self.action_halt next end - b1.use Call, IsState, :suspended do |env2, b2| - if env2[:result] - b2.use Resume - end - end + # Resume/Unpause the VM if needed. + b1.use Resume b1.use Call, GracefulHalt, :stopped, :running do |env2, b2| if !env2[:result] @@ -285,14 +282,22 @@ def self.action_start b1.use Call, IsState, :suspended do |env2, b2| if env2[:result] - # The VM is suspended, so just resume it + # The VM is suspended, go to resume b2.use action_resume next end - # The VM is not saved, so we must have to boot it up - # like normal. Boot! - b2.use action_boot + b2.use Call, IsState, :paused do |env3, b3| + if env3[:result] + # The VM is paused, just run the Resume action to unpause it + b3.use Resume + next + end + + # The VM is not suspended or paused, so we must have to + # boot it up like normal. Boot! + b3.use action_boot + end end end end diff --git a/lib/vagrant-parallels/action/resume.rb b/lib/vagrant-parallels/action/resume.rb index fcd40e20..b8e977f1 100644 --- a/lib/vagrant-parallels/action/resume.rb +++ b/lib/vagrant-parallels/action/resume.rb @@ -9,9 +9,13 @@ def initialize(app, env) def call(env) current_state = env[:machine].state.id + # Driver method "resume" works for suspended and paused state as well if current_state == :suspended env[:ui].info I18n.t('vagrant.actions.vm.resume.resuming') env[:machine].provider.driver.resume + elsif current_state == :paused + env[:ui].info I18n.t('vagrant.actions.vm.resume.unpausing') + env[:machine].provider.driver.resume end @app.call(env) From 766b97c47990516f78509769decda206e41fcb51 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Sun, 2 Apr 2017 13:17:46 +0200 Subject: [PATCH 3/5] Replace special characters in synced folder id That fixes invalid share names in Windows guests, where backward slash character is used as a path separator. --- lib/vagrant-parallels/synced_folder.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/vagrant-parallels/synced_folder.rb b/lib/vagrant-parallels/synced_folder.rb index 938f0a97..6bb784b1 100644 --- a/lib/vagrant-parallels/synced_folder.rb +++ b/lib/vagrant-parallels/synced_folder.rb @@ -105,7 +105,8 @@ def driver(machine) end def os_friendly_id(id) - id.gsub(/[\/:]/,'_').sub(/^_/, '') + # Replace chars *, ", :, <, >, ?, |, /, \ + id.gsub(/[*":<>?|\/\\]/,'_').sub(/^_/, '') end end end From 6b30822560622880a23e498359049a4170112af6 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Thu, 20 Apr 2017 21:57:24 +0200 Subject: [PATCH 4/5] Update changelog --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd49419..ba15d47b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,28 @@ +## 1.7.4 (April 20, 2017) +IMPROVEMENTS: + - Make start action (`"vagrant up"`) run provisioners if VM is running. + [[GH-294](https://github.com/Parallels/vagrant-parallels/pull/294)] + +BUG FIXES: + - Properly handle `"paused"` VM state for up and halt actions. + [[GH-295](https://github.com/Parallels/vagrant-parallels/pull/295)] + - synced_folder: Escape special characters in Windows-specific guest paths. + [[GH-296](https://github.com/Parallels/vagrant-parallels/pull/296)] + + ## 1.7.3 (February 28, 2017) BUG FIXES: - Fix exceptions related to `nokogiri` gem. [[GH-291](https://github.com/Parallels/vagrant-parallels/issues/291)], [[GH-292](https://github.com/Parallels/vagrant-parallels/issues/292)] + ## 1.7.2 (December 16, 2016) BUG FIXES: - Fix Parallels Tools update in Linux guests. Call `ptiagent-cmd` with `--install`, not `--info`. [[GH-286](https://github.com/Parallels/vagrant-parallels/pull/286)] + ## 1.7.1 (December 7, 2016) FEATURES: - **Guest capability for installing Parallels Tools in Windows.** Now it is @@ -84,7 +98,6 @@ BUG FIXES: ## 1.6.0 (December 24, 2015) - BREAKING CHANGES: - The required Vagrant version is **1.8** or higher. It is caused by changes From dcd1f783d3e74d877f46326e9e294dc558885e74 Mon Sep 17 00:00:00 2001 From: Mikhail Zholobov Date: Thu, 20 Apr 2017 21:57:58 +0200 Subject: [PATCH 5/5] Bump version to 1.7.4 --- lib/vagrant-parallels/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vagrant-parallels/version.rb b/lib/vagrant-parallels/version.rb index baed1e1f..44b52cea 100644 --- a/lib/vagrant-parallels/version.rb +++ b/lib/vagrant-parallels/version.rb @@ -1,5 +1,5 @@ module VagrantPlugins module Parallels - VERSION = '1.7.3' + VERSION = '1.7.4' end end