-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
action: Check the host is connected to Shared network
With PD 11.2.1 and higher it will be automatically fixed by connecting host to Shared network. For older versions the exception will be raised.
- Loading branch information
Showing
8 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module VagrantPlugins | ||
module Parallels | ||
module Action | ||
class CheckSharedInterface | ||
def initialize(app, env) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
shared_iface = env[:machine].provider.driver.read_shared_interface | ||
|
||
# Shared interface is connected. Just exit | ||
return @app.call(env) if shared_iface[:status] == 'Up' | ||
|
||
# Since PD 11.2.1 Vagrant can fix this automatically | ||
if !env[:machine].provider.pd_version_satisfies?('>= 11.2.1') | ||
raise Errors::SharedInterfaceDisconnected | ||
end | ||
|
||
env[:ui].info I18n.t('vagrant_parallels.actions.vm.check_shared_interface.connecting') | ||
iface_name = env[:machine].provider.driver.read_shared_network_id | ||
env[:machine].provider.driver.connect_network_interface(iface_name) | ||
|
||
@app.call(env) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters