Class: Pec::Handler::Networks::IpAddress

Inherits:
Object
  • Object
show all
Extended by:
Core
Defined in:
lib/pec/handler/networks/ip_address.rb

Instance Attribute Summary

Attributes included from Core

#kind

Class Method Summary collapse

Methods included from Core

build, post_build, recover

Class Method Details

.build(network) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pec/handler/networks/ip_address.rb', line 7

def build(network)
  ip = IP.new(network[1]['ip_address'])
  subnet = Yao::Subnet.list.find {|s|s.cidr == ip.network.to_s}
  if ip.to_s != subnet.cidr
    {
      fixed_ips: [
        { subnet_id: subnet.id, ip_address: ip.to_addr}
      ]
    }
  end
end