vagrant-parallels 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 357deec9b5427708e14fc8d7bafc0df42ef06b4d
4
- data.tar.gz: d997bba5f56330d1bc7a69c0602aa613e0be08cb
3
+ metadata.gz: c7311b4684314d58491eeb5ca36fe1bb1c465b4f
4
+ data.tar.gz: 1c5d0a4d8b58826bde63c5ecb438203020435aa4
5
5
  SHA512:
6
- metadata.gz: b5c9089a4c56fa43631d1ca66284e112898e374709ddcea08c3931c641cefdabe5a542279ab853880435052fe423d7cc03780f9341b170c9405f8602ce361835
7
- data.tar.gz: eb0c5ed9cfad34c70225c60cac47131c3458549a64ae958eafb49b55379e499199f12d852057158002368378671e77ec0dd6de4845644bc69d516c4d1691a6a4
6
+ metadata.gz: 6e59b47ef130c503f23c5a1d5e16d25b632eaf88a73c5ae4cd3643af1ab882003f178c5d00e4b4f5a3c07c9d468eb89753987e03f18a8b1614ac5c14c8b228a9
7
+ data.tar.gz: b739a112420e6804379d01f97791f3cd02117d8d4fe67ef510f9d347ecd438d26a0926debd43b8613928c4344ae29f71b25b624dececbf0850a55e4112814233
data/.gitignore CHANGED
@@ -4,16 +4,16 @@
4
4
  # Vagrant stuff
5
5
  acceptance_config.yml
6
6
  boxes/*
7
- /Vagrantfile
8
- /.vagrant
9
- /vagrant-spec.config.rb
7
+ Vagrantfile
8
+ .vagrant
9
+ vagrant-spec.config.rb
10
10
 
11
11
  # Bundler/Rubygems
12
12
  *.gem
13
13
  .bundle
14
14
  pkg/*
15
15
  tags
16
- /Gemfile.lock
16
+ Gemfile.lock
17
17
  test/tmp/
18
18
 
19
19
  # Python
@@ -48,7 +48,7 @@ module VagrantPlugins
48
48
  @machine.provider.driver.read_network_interfaces.each do |adapter, opts|
49
49
  if opts[:type] == :hostonly
50
50
  @machine.provider.driver.read_host_only_interfaces.each do |interface|
51
- if interface[:bound_to] == opts[:hostonly]
51
+ if interface[:name] == opts[:hostonly]
52
52
  return adapter, interface[:ip]
53
53
  end
54
54
  end
@@ -45,7 +45,7 @@ module VagrantPlugins
45
45
  #
46
46
  # @param [Hash] options Options to create the host only network.
47
47
  # @return [Hash] The details of the host only network, including
48
- # keys `:name`, `:bound_to`, `:ip`, `:netmask` and `:dhcp`
48
+ # keys `:name`, `:ip`, `:netmask` and `:dhcp`
49
49
  def create_host_only_network(options)
50
50
  end
51
51
 
@@ -68,7 +68,7 @@ module VagrantPlugins
68
68
  # {
69
69
  # :type => :hostonly,
70
70
  # :hostonly => "vagrant-vnet0",
71
- # :bound_to => "vnic2",
71
+ # :name => "vnic2",
72
72
  # :nic_type => "virtio"
73
73
  # }
74
74
  #
@@ -219,10 +219,13 @@ module VagrantPlugins
219
219
 
220
220
  def read_guest_ip
221
221
  mac_addr = read_mac_address.downcase
222
- File.foreach("/Library/Preferences/Parallels/parallels_dhcp_leases") do |line|
223
- if line.include? mac_addr
222
+ leases_file = "/Library/Preferences/Parallels/parallels_dhcp_leases"
223
+ begin
224
+ File.open(leases_file).grep(/#{mac_addr}/) do |line|
224
225
  return line[/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/]
225
226
  end
227
+ rescue Errno::EACCES
228
+ raise Errors::DhcpLeasesNotAccessible, :leases_file => leases_file.to_s
226
229
  end
227
230
 
228
231
  nil
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
@@ -146,6 +146,26 @@ shared_examples "parallels desktop driver" do |options|
146
146
  end
147
147
  end
148
148
 
149
+ describe "read_guest_ip" do
150
+ let(:content) {'10.200.0.99="1394547632,1800,001c420000ff,01001c420000ff"'}
151
+
152
+ it "returns an IP address assigned to the specified MAC" do
153
+ driver.should_receive(:read_mac_address).and_return("001C420000FF")
154
+ File.should_receive(:open).with(an_instance_of(String)).
155
+ and_return(StringIO.new(content))
156
+
157
+ subject.read_guest_ip.should == "10.200.0.99"
158
+ end
159
+
160
+ it "rises DhcpLeasesNotAccessible exception when file is not accessible" do
161
+ File.stub(:open).and_call_original
162
+ File.should_receive(:open).with(an_instance_of(String)).
163
+ and_raise(Errno::EACCES)
164
+ expect { subject.read_guest_ip }.
165
+ to raise_error(VagrantPlugins::Parallels::Errors::DhcpLeasesNotAccessible)
166
+ end
167
+ end
168
+
149
169
  describe "read_settings" do
150
170
  it "returns a hash with detailed info about the VM" do
151
171
  subject.read_settings.should be_kind_of(Hash)
@@ -230,7 +250,7 @@ shared_examples "parallels desktop driver" do |options|
230
250
  subject.version.should match(/(#{parallels_version}[\d\.]+)/)
231
251
  end
232
252
 
233
- it "rises ParallelsInstallIncomplete exception when output is invalid" do
253
+ it "rises ParallelsInvalidVersion exception when output is invalid" do
234
254
  subprocess.should_receive(:execute).
235
255
  with("prlctl", "--version", an_instance_of(Hash)).
236
256
  and_return(subprocess_result(exit_code: 0))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-parallels
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Zholobov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-11 00:00:00.000000000 Z
12
+ date: 2014-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -77,7 +77,6 @@ extra_rdoc_files: []
77
77
  files:
78
78
  - config/i18n-tasks.yml.erb
79
79
  - Gemfile
80
- - Gemfile.lock
81
80
  - lib/vagrant-parallels/action/boot.rb
82
81
  - lib/vagrant-parallels/action/check_accessible.rb
83
82
  - lib/vagrant-parallels/action/check_created.rb
@@ -138,8 +137,6 @@ files:
138
137
  - test/unit/support/shared/pd_driver_examples.rb
139
138
  - test/unit/synced_folder_test.rb
140
139
  - vagrant-parallels.gemspec
141
- - vagrant-spec.config.rb
142
- - Vagrantfile
143
140
  - .gitignore
144
141
  - .travis.yml
145
142
  homepage: http://github.com/Parallels/vagrant-parallels