Sha256: b7eefd5f5f10bd880f2861790ed57d6ea23ec9f423b0eaa6e382a3130a2fee11
Contents?: true
Size: 1.36 KB
Versions: 5
Compression:
Stored size: 1.36 KB
Contents
module VagrantPlugins module Invade module InvadeModule module Network class Private < InvadeModule require 'ipaddr' attr_reader :result attr_accessor :machine_name, :private_network_data def initialize(machine_name, private_network_data, result: nil) @machine_name = machine_name @private_network_data = private_network_data @result = result end def build b = binding # Delete all nil keys @private_network_data.delete_blank ip = @private_network_data['ip'] # Handle IP address exceptions if ip @private_network_data.delete('type') # Netmask only makes sense if IP is ipv6 if @private_network_data['netmask'] && !IPAddr.new(ip).ipv6? @private_network_data.delete('netmask') end end begin # Get machine name machine_name = @machine_name network_data = @private_network_data eruby = Erubis::Eruby.new(File.read(self.get_template_path(__FILE__))) @result = eruby.result b rescue TypeError, SyntaxError, SystemCallError => e raise(e) end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems