lib/testlab/providers/vagrant.rb in testlab-0.4.5 vs lib/testlab/providers/vagrant.rb in testlab-0.4.6

- old
+ new

@@ -7,10 +7,11 @@ # Vagrant Provider Class # # @author Zachary Patten <zachary AT jovelabs DOT com> class Vagrant + require 'zlib' # States which indicate the VM is running RUNNING_STATES = %w(running).map(&:to_sym) # States which indicate the VM is shut down @@ -136,12 +137,11 @@ def ip (@config[:vagrant][:ip] || "192.168.33.#{last_octet}") end def last_octet - hash = instance_id.hash - hash = (hash < 0 ? (hash * -1) : hash) - (hash.modulo(254) + 1) + crc32 = Zlib.crc32(self.instance_id) + (crc32.modulo(254) + 1) end def port (@config[:vagrant][:port] || 22) end