lib/clusterfuck/machine.rb in vagrant-clusterfuck-0.0.1 vs lib/clusterfuck/machine.rb in vagrant-clusterfuck-0.0.2

- old
+ new

@@ -1,20 +1,20 @@ module Clusterfuck class Machine - attr_reader :name, :ssh_port, :routes, :gateway - attr_accessor :subnets, :provisioners, :network + attr_reader :name, :ssh_port + attr_accessor :ips, :gateway, :routes, :cluster def initialize(name, **args) @name = name - @subnets = [] + @ips = [] @ssh_port = args[:ssh_port] || PortFactory.next @gateway = args[:gateway] @routes = args[:routes] end - def overlapping_subnets(other) - network.overlapping_subnets(self, other) + def ip_in_same_subnet(other) + cluster.ip_in_same_subnet(self, other) end def build(config) config.vm.define(name) do |box| box.vm.hostname = name @@ -24,14 +24,14 @@ box.vm.network :forwarded_port, guest: 22, host: ssh_port, id: "ssh" - subnets.each do |subnet| + ips.each do |ip| box.vm.network :private_network, - ip: subnet.to_s, + ip: ip.addr, # TODO Troll Rubby people by using a refinement - netmask: subnet.netmask, + netmask: ip.netmask, # TODO Vagrant already provides an abstraction for declaring networks # so we should not need to duplicate this abstraction by creating # subclasses for each provider. This bullshit needs to be gone for # AWS/CI support. virtualbox__intnet: true