1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-08 21:17:43 +03:00

M #-: Add prefix method to older IPAddr (#1049)

* Revert "M #-: Update Gemfile.locks (#1040)"

This reverts commit 0dcde4b04b.

* M #-: Add prefix method to older IPAddr
This commit is contained in:
Jan Orel 2021-03-31 14:39:17 +02:00 committed by GitHub
parent fe2eb12883
commit 1187d77ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 29 additions and 35 deletions

View File

@ -10,7 +10,7 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
augeas (0.6.4)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -73,7 +73,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -170,7 +169,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -10,7 +10,7 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
augeas (0.6.4)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -73,7 +73,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -180,7 +179,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -153,7 +153,3 @@ group :vmware do
gem 'rbvmomi', '~> 2.2.0'
end
end
group :oneprovision do
gem 'ipaddr', '>= 1.2.2'
end

View File

@ -10,7 +10,7 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
augeas (0.6.4)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -73,7 +73,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -180,7 +179,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -12,7 +12,7 @@ GEM
augeas (0.6.4)
awrence (1.2.1)
aws-eventstream (1.1.1)
aws-partitions (1.436.0)
aws-partitions (1.434.0)
aws-sdk-cloudwatch (1.50.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
@ -80,7 +80,6 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
inflection (1.0.0)
ipaddr (1.2.2)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
@ -212,7 +211,6 @@ DEPENDENCIES
gnuplot
highline (~> 1.7)
i18n (~> 0.9)
ipaddr (>= 1.2.2)
ipaddress (~> 0.8.3)
json (>= 2.0)
memcache-client

View File

@ -103,13 +103,31 @@ IP_TYPE = %w[public_ipv4 global_ipv4]
DEFAULT_PRIVATE_CIDR = "172.16.0.0/12"
# Add ^ operator to the IPAddr class
class IPAddr
# Add ^ operator to the IPAddr class
def ^(other)
clone.set(@addr ^ other.to_i)
end
# Add prefix method, to work with older ipadddr & ruby
def prefix
case @family
when Socket::AF_INET
n = IN4MASK ^ @mask_addr
i = 32
when Socket::AF_INET6
n = IN6MASK ^ @mask_addr
i = 128
else
raise AddressFamilyError, "unsupported address family"
end
while n>0
n >>= 1
i -= 1
end
i
end
end
begin