smart_proxy_ipam 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99081e6b65f047761521c0baaff029fc1ce40e8a1e1b399be9ee88deb106479d
4
- data.tar.gz: 9446d90c2358ad5e6759a2e3a25c720c00e926177f55278dd9f624ce098df7ab
3
+ metadata.gz: e010cf0ea2091a880899f37aef589b272ced50d132c67794b916609194a13865
4
+ data.tar.gz: 4551dc45e2357c13cb080e76794fa8ed8546fa9bcf4da2236b003ab7a52d18ee
5
5
  SHA512:
6
- metadata.gz: 90416855e0de74c52d21787390029503640ebbe0b60854d6bc74265f8a3643bd2bd78c952fcfaa6548672715b4c635162ae6e799c210ec2d4589365d5f19921a
7
- data.tar.gz: 4ab2f315c3722487d673ce0398d49a1cf2a9dace859e9eba900dc830c2042cd09d93ff0a49feed9fb6c0833a3c45933062a2c509ceb20ccb03659f62f1b123de
6
+ metadata.gz: ff9fd209a2e8f4a6ff345a6e19cdb8ddd9abef20bc6d95f9e9f97f5e6187d67f6bc0197768bff4e131dbe51670d917c845912cd45379f58e11fd9025a11c47bf
7
+ data.tar.gz: 4d5800bfe4c2c7705d652c9f589b7f90feeaf3203f3b540c755acfd1525d134e05b9035ab727fffdd0b1dadaf56f41ca2b9eceaddaca053a136b2a93ef5afeee
@@ -44,9 +44,10 @@ module Proxy::Ipam
44
44
  content_type :json
45
45
 
46
46
  begin
47
- validate_required_params!([:address, :prefix, :mac], params)
47
+ validate_required_params!([:address, :prefix], params)
48
48
 
49
- mac = validate_mac!(params[:mac])
49
+ mac_param = params[:mac]
50
+ mac = validate_mac!(params[:mac]) unless mac_param.nil? || mac_param.empty?
50
51
  cidr = validate_cidr!(params[:address], params[:prefix])
51
52
  group_name = get_request_group(params)
52
53
 
@@ -72,7 +72,7 @@ module Proxy::Ipam::IpamHelper
72
72
  subnet_hash = ip_cache.get_cidr(group, cidr)
73
73
  next_ip = nil
74
74
 
75
- if subnet_hash&.key?(mac.to_sym)
75
+ if mac && subnet_hash&.key?(mac.to_sym)
76
76
  next_ip = ip_cache.get_ip(group, cidr, mac)
77
77
  else
78
78
  new_ip = ip
@@ -39,7 +39,6 @@ module Proxy::Ipam::IpamValidator
39
39
  end
40
40
 
41
41
  def validate_mac!(mac)
42
- raise Proxy::Validations::Error.new, ERRORS[:mac] if mac.nil? || mac.empty?
43
42
  unless mac.match(/^([0-9a-fA-F]{2}[:]){5}[0-9a-fA-F]{2}$/i)
44
43
  raise Proxy::Validations::Error.new, ERRORS[:bad_mac]
45
44
  end
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module Ipam
3
- VERSION = '0.1.3'.freeze
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_ipam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2021-01-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Smart proxy plugin for integration with various External IPAM providers
14
14
  email: chrisjsmith001@gmail.com