Merge "Remove unused netmask_to_cider function"
This commit is contained in:
commit
ccc6719a73
|
@ -1,15 +0,0 @@
|
|||
# Custom function to transform netmask from IP notation to
|
||||
# CIDR format. Input is an IP address, output a CIDR:
|
||||
# 255.255.255.0 = 24
|
||||
# The CIDR formated netmask is needed for some
|
||||
# Contrail configuration files
|
||||
require 'ipaddr'
|
||||
Puppet::Functions.create_function(:netmask_to_cidr) do
|
||||
dispatch :netmask_to_cidr do
|
||||
param 'String', :netmask
|
||||
end
|
||||
|
||||
def netmask_to_cidr(netmask)
|
||||
IPAddr.new(netmask).to_i.to_s(2).count("1")
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'spec_helper'
|
||||
require 'puppet'
|
||||
|
||||
describe 'netmask_to_cidr' do
|
||||
it { should run.with_params('255.255.255.0').and_return(24) }
|
||||
end
|
Loading…
Reference in New Issue