Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add driver for Parallels Desktop 12, drop EOL versions and deprecated options #271

Merged
merged 4 commits into from
Aug 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ virtual machines on OS X hosts.

### Requirements
- [Vagrant v1.8](http://www.vagrantup.com) or higher
- [Parallels Desktop 8 for Mac](http://www.parallels.com/products/desktop/) or higher
- [Parallels Desktop 10 for Mac](http://www.parallels.com/products/desktop/) or higher

*Note:* In [**Parallels Desktop 11 for Mac**](http://www.parallels.com/products/desktop/),
only **Pro** and **Business** editions are compatible with this Vagrant provider.
*Note:* Only **Pro** and **Business** editions of **Parallels Desktop for Mac**
are compatible with this Vagrant provider.
Standard edition doesn't have a command line functionality and can not be used
with Vagrant.

Expand Down
1 change: 0 additions & 1 deletion lib/vagrant-parallels/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ def self.action_sync_folders
autoload :BoxRegister, File.expand_path('../action/box_register', __FILE__)
autoload :BoxUnregister, File.expand_path('../action/box_unregister', __FILE__)
autoload :HandleGuestTools, File.expand_path('../action/handle_guest_tools', __FILE__)
autoload :HandleForwardedPortCollisions, File.expand_path('../action/handle_forwarded_port_collisions.rb', __FILE__)
autoload :CheckSharedInterface, File.expand_path('../action/check_shared_interface', __FILE__)
autoload :ClearNetworkInterfaces, File.expand_path('../action/clear_network_interfaces', __FILE__)
autoload :ClearForwardedPorts, File.expand_path('../action/clear_forwarded_ports', __FILE__)
Expand Down
8 changes: 3 additions & 5 deletions lib/vagrant-parallels/action/box_register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ def register_box(env)
f.write(env[:clone_id])
end

if env[:machine].provider.pd_version_satisfies?('>= 10')
# Convert template to VM (compatibility with old-styled boxes)
env[:machine].provider.driver.execute_prlctl(
'set', env[:clone_id], '--template', 'off')
end
# Convert template to VM (compatibility with old-styled boxes)
env[:machine].provider.driver.execute_prlctl(
'set', env[:clone_id], '--template', 'off')
end
end
end
Expand Down
5 changes: 0 additions & 5 deletions lib/vagrant-parallels/action/clear_forwarded_ports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ def initialize(app, env)
end

def call(env)
# Port Forwarding feature is available only with PD >= 10
if !env[:machine].provider.pd_version_satisfies?('>= 10')
return @app.call(env)
end

ports = env[:machine].provider.driver.read_forwarded_ports
if !ports.empty?
env[:ui].info I18n.t('vagrant.actions.vm.clear_forward_ports.deleting')
Expand Down
8 changes: 2 additions & 6 deletions lib/vagrant-parallels/action/destroy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ def initialize(app, env)
end

def call(env)
# Disable requiring password for delete action [GH-67].
# It is available only since PD 10.
if env[:machine].provider.pd_version_satisfies?('>= 10')
@logger.info('Disabling password restrictions: remove-vm')
env[:machine].provider.driver.disable_password_restrictions(['remove-vm'])
end
@logger.info('Disabling password restrictions: remove-vm')
env[:machine].provider.driver.disable_password_restrictions(['remove-vm'])

env[:ui].info I18n.t('vagrant.actions.vm.destroy.destroying')
env[:machine].provider.driver.delete
Expand Down
5 changes: 0 additions & 5 deletions lib/vagrant-parallels/action/forward_ports.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ def initialize(app, env)
# Execution
#--------------------------------------------------------------
def call(env)
# Port Forwarding feature is available only with PD >= 10
if !env[:machine].provider.pd_version_satisfies?('>= 10')
return @app.call(env)
end

@env = env

# Get the ports we're forwarding
Expand Down
30 changes: 0 additions & 30 deletions lib/vagrant-parallels/action/handle_forwarded_port_collisions.rb

This file was deleted.

9 changes: 3 additions & 6 deletions lib/vagrant-parallels/action/import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ def call(env)
options = {}

# Disable requiring password for register and clone actions [GH-67].
# It is available only since PD 10.
if env[:machine].provider.pd_version_satisfies?('>= 10')
acts = ['clone-vm']
@logger.info("Disabling password restrictions: #{acts.join(', ')}")
env[:machine].provider.driver.disable_password_restrictions(acts)
end
acts = ['clone-vm']
@logger.info("Disabling password restrictions: #{acts.join(', ')}")
env[:machine].provider.driver.disable_password_restrictions(acts)

if env[:machine].provider_config.regen_src_uuid \
&& env[:machine].provider.pd_version_satisfies?('>= 10.1.2')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ def initialize(app, env)
end

def call(env)
# Port Forwarding feature is available only with PD >= 10
if !env[:machine].provider.pd_version_satisfies?('>= 10')
return @app.call(env)
end

# Get the forwarded ports used by other virtual machines and
# consider those in use as well.
env[:port_collision_extra_in_use] =
Expand Down
12 changes: 2 additions & 10 deletions lib/vagrant-parallels/action/sane_defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,14 @@ def call(env)
private

def default_settings
settings = {}

return settings if @env[:machine].provider.pd_version_satisfies?('< 9')
settings.merge!(
settings = {
startup_view: 'same',
on_shutdown: 'close',
on_window_close: 'keep-running',
auto_share_camera: 'off',
smart_guard: 'off',
longer_battery_life: 'on'
)

# Check the legacy option
if !@env[:machine].provider_config.optimize_power_consumption
settings[:longer_battery_life] = 'off'
end
}

return settings if @env[:machine].provider.pd_version_satisfies?('< 10.1.2')
settings.merge!(
Expand Down
19 changes: 0 additions & 19 deletions lib/vagrant-parallels/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@ def initialize
@linked_clone_snapshot = UNSET_VALUE
@network_adapters = {}
@name = UNSET_VALUE
@optimize_power_consumption = UNSET_VALUE
@regen_src_uuid = UNSET_VALUE
@update_guest_tools = UNSET_VALUE

network_adapter(0, :shared)

# Deprecated options
@regen_box_uuid = UNSET_VALUE
@use_linked_clone = UNSET_VALUE
end

def customize(*command)
Expand Down Expand Up @@ -68,16 +63,6 @@ def merge(other)
end

def finalize!
if @regen_box_uuid != UNSET_VALUE
puts "Parallels provider: Vagrantfile option 'regen_box_uuid' is deprecated and will be removed. Please, use 'regen_src_uuid' instead"
@regen_src_uuid = @regen_box_uuid if @regen_src_uuid == UNSET_VALUE
end

if @use_linked_clone != UNSET_VALUE
puts "Parallels provider: Vagrantfile option 'use_linked_clone' is deprecated and will be removed. Please, use 'linked_clone' instead"
@linked_clone = @use_linked_clone if @linked_clone == UNSET_VALUE
end

if @check_guest_tools == UNSET_VALUE
@check_guest_tools = true
end
Expand Down Expand Up @@ -118,10 +103,6 @@ def validate(machine)
end
end

if @optimize_power_consumption != UNSET_VALUE
machine.env.ui.warn I18n.t('vagrant_parallels.config.deprecate_power_consumption')
end

{ 'Parallels Provider' => errors }
end
end
Expand Down
Loading