vagrant-parallels 1.7.8 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,121 @@
1
+ require "shellwords"
2
+ require "vagrant/util/retryable"
3
+
4
+ module VagrantPlugins
5
+ module Parallels
6
+ module Util
7
+ module UnixMountHelpers
8
+
9
+ def self.extended(klass)
10
+ if !klass.class_variable_defined?(:@@logger)
11
+ klass.class_variable_set(:@@logger, Log4r::Logger.new(klass.name.downcase))
12
+ end
13
+ klass.extend Vagrant::Util::Retryable
14
+ end
15
+
16
+ def detect_owner_group_ids(machine, guest_path, mount_options, options)
17
+ mount_uid = find_mount_options_id("uid", mount_options)
18
+ mount_gid = find_mount_options_id("gid", mount_options)
19
+
20
+ if mount_uid.nil?
21
+ if options[:owner].to_i.to_s == options[:owner].to_s
22
+ mount_uid = options[:owner]
23
+ self.class_variable_get(:@@logger).debug("Owner user ID (provided): #{mount_uid}")
24
+ else
25
+ output = {stdout: '', stderr: ''}
26
+ uid_command = "id -u #{options[:owner]}"
27
+ machine.communicate.execute(uid_command,
28
+ error_class: Errors::ParallelsMountFailed,
29
+ error_key: :parallels_mount_failed,
30
+ command: uid_command,
31
+ output: output[:stderr]
32
+ ) { |type, data| output[type] << data if output[type] }
33
+ mount_uid = output[:stdout].chomp
34
+ self.class_variable_get(:@@logger).debug("Owner user ID (lookup): #{options[:owner]} -> #{mount_uid}")
35
+ end
36
+ else
37
+ machine.ui.warn "Detected mount owner ID within mount options. (uid: #{mount_uid} guestpath: #{guest_path})"
38
+ end
39
+
40
+ if mount_gid.nil?
41
+ if options[:group].to_i.to_s == options[:group].to_s
42
+ mount_gid = options[:group]
43
+ self.class_variable_get(:@@logger).debug("Owner group ID (provided): #{mount_gid}")
44
+ else
45
+ begin
46
+ output = {stdout: '', stderr: ''}
47
+ gid_command = "getent group #{options[:group]}"
48
+ machine.communicate.execute(gid_command,
49
+ error_class: Errors::ParallelsMountFailed,
50
+ error_key: :parallels_mount_failed,
51
+ command: gid_command,
52
+ output: output[:stderr]
53
+ ) { |type, data| output[type] << data if output[type] }
54
+ mount_gid = output[:stdout].split(':').at(2).to_s.chomp
55
+ self.class_variable_get(:@@logger).debug("Owner group ID (lookup): #{options[:group]} -> #{mount_gid}")
56
+ rescue Vagrant::Errors::ParallelsMountFailed
57
+ if options[:owner] == options[:group]
58
+ self.class_variable_get(:@@logger).debug("Failed to locate group `#{options[:group]}`. Group name matches owner. Fetching effective group ID.")
59
+ output = {stdout: ''}
60
+ result = machine.communicate.execute("id -g #{options[:owner]}",
61
+ error_check: false
62
+ ) { |type, data| output[type] << data if output[type] }
63
+ mount_gid = output[:stdout].chomp if result == 0
64
+ self.class_variable_get(:@@logger).debug("Owner group ID (effective): #{mount_gid}")
65
+ end
66
+ raise unless mount_gid
67
+ end
68
+ end
69
+ else
70
+ machine.ui.warn "Detected mount group ID within mount options. (gid: #{mount_gid} guestpath: #{guest_path})"
71
+ end
72
+ {:gid => mount_gid, :uid => mount_uid}
73
+ end
74
+
75
+ def find_mount_options_id(id_name, mount_options)
76
+ id_line = mount_options.detect{|line| line.include?("#{id_name}=")}
77
+ if id_line
78
+ match = id_line.match(/,?#{Regexp.escape(id_name)}=(?<option_id>\d+),?/)
79
+ found_id = match["option_id"]
80
+ updated_id_line = [
81
+ match.pre_match,
82
+ match.post_match
83
+ ].find_all{|string| !string.empty?}.join(',')
84
+ if updated_id_line.empty?
85
+ mount_options.delete(id_line)
86
+ else
87
+ idx = mount_options.index(id_line)
88
+ mount_options.delete(idx)
89
+ mount_options.insert(idx, updated_id_line)
90
+ end
91
+ end
92
+ found_id
93
+ end
94
+
95
+ def emit_upstart_notification(machine, guest_path)
96
+ # Emit an upstart event if we can
97
+ machine.communicate.sudo <<-EOH.gsub(/^ {12}/, "")
98
+ if command -v /sbin/init && /sbin/init 2>/dev/null --version | grep upstart; then
99
+ /sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{guest_path}
100
+ fi
101
+ EOH
102
+ end
103
+
104
+ def merge_mount_options(base, overrides)
105
+ base = base.join(",").split(",")
106
+ overrides = overrides.join(",").split(",")
107
+ b_kv = Hash[base.map{|item| item.split("=", 2) }]
108
+ o_kv = Hash[overrides.map{|item| item.split("=", 2) }]
109
+ merged = {}.tap do |opts|
110
+ (b_kv.keys + o_kv.keys).uniq.each do |key|
111
+ opts[key] = o_kv.fetch(key, b_kv[key])
112
+ end
113
+ end
114
+ merged.map do |key, value|
115
+ [key, value].compact.join("=")
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = '1.7.8'
3
+ VERSION = '2.2.1'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -45,26 +45,26 @@ en:
45
45
  disk is inconsistent, please remove it from the VM configuration.
46
46
 
47
47
  Disk image path: %{path}
48
- linux_mount_failed: |-
49
- Failed to mount folders in Linux guest. This is usually because
50
- the "prl_fs" file system is not available. Please verify that
51
- Parallels Tools are properly installed in the guest and
52
- can work properly. If so, the VM reboot can solve a problem.
53
- The command attempted was:
54
-
55
- %{command}
56
48
  linux_prl_fs_invalid_options: |-
57
49
  Failed to mount folders in Linux guest. You've specified mount options
58
50
  which are not supported by "prl_fs" file system.
59
51
 
60
52
  Invalid mount options: %{options}
53
+ network_collision: |-
54
+ The specified host network collides with a non-hostonly network!
55
+ This will cause your specified IP to be inaccessible. Please change
56
+ the IP or name of your host only network so that it no longer matches that of
57
+ a bridged or non-hostonly network.
58
+
59
+ Host-only Network Address: '%{hostonly_netaddr}'
60
+ Bridged Network '%{bridge_interface}': '%{bridge_netaddr}'
61
61
  network_invalid_address: |-
62
62
  Network settings specified in your Vagrantfile are invalid:
63
63
 
64
64
  Network settings: %{options}
65
65
  Error: %{error}
66
66
  mac_os_x_required: |-
67
- Parallels provider works only on OS X (Mac OS X) systems.
67
+ Parallels provider works only on macOS (Mac OS X) systems.
68
68
  parallels_install_incomplete: |-
69
69
  Parallels Desktop is complaining that the installation is incomplete.
70
70
  Try to reinstall Parallels Desktop or contact Parallels support.
@@ -73,6 +73,19 @@ en:
73
73
  %{output}
74
74
 
75
75
  This is an internal error that should be reported as a bug.
76
+ parallels_mount_failed: |-
77
+ Vagrant was unable to mount Parallels Desktop shared folders. This is usually
78
+ because the filesystem "prl_fs" is not available. This filesystem is
79
+ made available via the Parallels Tools and kernel module.
80
+ Please verify that these guest tools are properly installed in the
81
+ guest. This is not a bug in Vagrant and is usually caused by a faulty
82
+ Vagrant box. For context, the command attempted was:
83
+
84
+ %{command}
85
+
86
+ The error output from the command was:
87
+
88
+ %{output}
76
89
  parallels_no_room_for_high_level_network: |-
77
90
  There is no available slots on the Parallels Desktop VM for the configured
78
91
  high-level network interfaces. "private_network" and "public_network"
@@ -101,12 +114,12 @@ en:
101
114
  only with Pro and Business editions of Parallels Desktop. Other editions
102
115
  do not have command line functionality and can not be used with Vagrant.
103
116
 
104
- Please upgrade your installation: http://parallels.com/desktop
117
+ Please upgrade your installation: https://parallels.com/desktop
105
118
  parallels_unsupported_version: |-
106
119
  Vagrant has detected that you have a version of Parallels Desktop for Mac
107
120
  installed that is not supported. Vagrant Parallels provider is compatible
108
- only with Parallels Desktop 10 or later.
109
- Please upgrade your installation: http://parallels.com/desktop
121
+ only with Parallels Desktop 11 or later.
122
+ Please upgrade your installation: https://parallels.com/desktop
110
123
 
111
124
  Note: Starting since Parallels Desktop 11 for Mac, Vagrant Parallels
112
125
  provider can be only used with Pro or Business edition of Parallels
@@ -205,8 +218,8 @@ en:
205
218
  check_shared_interface:
206
219
  connecting: Connecting host to Shared network...
207
220
  clone:
208
- full: Cloning new virtual machine...
209
- linked: Creating new virtual machine as a linked clone...
221
+ full: Creating new virtual machine as a full clone of the box image...
222
+ linked: Creating new virtual machine as a linked clone of the box image...
210
223
  handle_guest_tools:
211
224
  cant_install: |-
212
225
  Vagrant doesn't support installing Parallels Tools for the guest OS
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-parallels
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.8
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Zholobov
8
8
  - Youssef Shahin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-18 00:00:00.000000000 Z
12
+ date: 2021-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -31,14 +31,14 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 11.3.0
34
+ version: 12.3.3
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 11.3.0
41
+ version: 12.3.3
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 1.2.0
62
+ version: 1.3.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 1.2.0
69
+ version: 1.3.0
70
70
  description: Enables Vagrant to manage Parallels virtual machines.
71
71
  email:
72
72
  - mzholobov@parallels.com
@@ -98,6 +98,7 @@ files:
98
98
  - lib/vagrant-parallels/action/network.rb
99
99
  - lib/vagrant-parallels/action/package.rb
100
100
  - lib/vagrant-parallels/action/package_config_files.rb
101
+ - lib/vagrant-parallels/action/package_vagrantfile.rb
101
102
  - lib/vagrant-parallels/action/prepare_clone_snapshot.rb
102
103
  - lib/vagrant-parallels/action/prepare_forwarded_port_collision_params.rb
103
104
  - lib/vagrant-parallels/action/prepare_nfs_settings.rb
@@ -111,10 +112,10 @@ files:
111
112
  - lib/vagrant-parallels/action/snapshot_save.rb
112
113
  - lib/vagrant-parallels/action/suspend.rb
113
114
  - lib/vagrant-parallels/cap.rb
115
+ - lib/vagrant-parallels/cap/mount_options.rb
114
116
  - lib/vagrant-parallels/config.rb
115
117
  - lib/vagrant-parallels/driver/base.rb
116
118
  - lib/vagrant-parallels/driver/meta.rb
117
- - lib/vagrant-parallels/driver/pd_10.rb
118
119
  - lib/vagrant-parallels/driver/pd_11.rb
119
120
  - lib/vagrant-parallels/driver/pd_12.rb
120
121
  - lib/vagrant-parallels/errors.rb
@@ -128,13 +129,14 @@ files:
128
129
  - lib/vagrant-parallels/provider.rb
129
130
  - lib/vagrant-parallels/synced_folder.rb
130
131
  - lib/vagrant-parallels/util/compile_forwarded_ports.rb
132
+ - lib/vagrant-parallels/util/unix_mount_helpers.rb
131
133
  - lib/vagrant-parallels/version.rb
132
134
  - locales/en.yml
133
- homepage: http://github.com/Parallels/vagrant-parallels
135
+ homepage: https://github.com/Parallels/vagrant-parallels
134
136
  licenses:
135
137
  - MIT
136
138
  metadata: {}
137
- post_install_message:
139
+ post_install_message:
138
140
  rdoc_options: []
139
141
  require_paths:
140
142
  - lib
@@ -149,9 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
151
  - !ruby/object:Gem::Version
150
152
  version: 1.3.6
151
153
  requirements: []
152
- rubyforge_project: vagrant-parallels
153
- rubygems_version: 2.5.2
154
- signing_key:
154
+ rubygems_version: 3.0.3
155
+ signing_key:
155
156
  specification_version: 4
156
157
  summary: Parallels provider for Vagrant.
157
158
  test_files: []
@@ -1,20 +0,0 @@
1
- require 'log4r'
2
-
3
- require 'vagrant/util/platform'
4
-
5
- require_relative 'base'
6
-
7
- module VagrantPlugins
8
- module Parallels
9
- module Driver
10
- # Driver for Parallels Desktop 10.
11
- class PD_10 < Base
12
- def initialize(uuid)
13
- super(uuid)
14
-
15
- @logger = Log4r::Logger.new('vagrant_parallels::driver::pd_10')
16
- end
17
- end
18
- end
19
- end
20
- end