specinfra 2.40.0 → 2.40.1
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 +4 -4
- data/lib/specinfra/command/freebsd/base/interface.rb +23 -3
- data/lib/specinfra/command/linux/base/interface.rb +2 -2
- data/lib/specinfra/command/openbsd/base/interface.rb +23 -2
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/freebsd/interface_spec.rb +28 -0
- data/spec/command/linux/interface_spec.rb +13 -1
- data/spec/command/openbsd/interface_spec.rb +28 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf6b02a4663c031ba89a9a46f3b40272d0d3c7b
|
4
|
+
data.tar.gz: 5ac48f5f97382998f0810693fa149fd6dc75c6ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac723709ba251e0bd24aea998fc92ae050099efd08fcb6ebfa98e3ac0217081e61a89fde05cd0e16b9567d90328a59cc9dbc1f7ccf967c573bd6b6b91c01df9
|
7
|
+
data.tar.gz: a8b2d03196e2b6685ff2e31da51dcc790b5cfb3e387cfa35e94854a91a73bae440fd563fc67aa49b39010d46d0f4e073998038bfc3dea7cad94d4e944aab9786
|
@@ -5,11 +5,31 @@ class Specinfra::Command::Freebsd::Base::Interface < Specinfra::Command::Base::I
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def check_has_ipv4_address(interface, ip_address)
|
8
|
-
|
8
|
+
ip_address = ip_address.dup
|
9
|
+
if ip_address =~ /\/\d+$/
|
10
|
+
# remove the prefix - better would be to calculate the netmask
|
11
|
+
ip_address.gsub!(/\/\d+$/, "")
|
12
|
+
end
|
13
|
+
ip_address << " "
|
14
|
+
ip_address.gsub!(".", "\\.")
|
15
|
+
"ifconfig #{interface} inet | grep 'inet #{ip_address}'"
|
9
16
|
end
|
10
17
|
|
11
18
|
def check_has_ipv6_address(interface, ip_address)
|
12
|
-
|
19
|
+
ip_address = ip_address.dup
|
20
|
+
(ip_address, prefixlen) = ip_address.split(/\//)
|
21
|
+
ip_address.downcase!
|
22
|
+
if ip_address =~ /^fe80::/i
|
23
|
+
# link local needs the scope (interface) appended
|
24
|
+
ip_address << "%#{interface}"
|
25
|
+
end
|
26
|
+
unless prefixlen.to_s.empty?
|
27
|
+
# append prefixlen
|
28
|
+
ip_address << " prefixlen #{prefixlen}"
|
29
|
+
else
|
30
|
+
ip_address << " "
|
31
|
+
end
|
32
|
+
"ifconfig #{interface} inet6 | grep 'inet6 #{ip_address}'"
|
13
33
|
end
|
14
34
|
end
|
15
|
-
end
|
35
|
+
end
|
@@ -16,7 +16,7 @@ class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Int
|
|
16
16
|
ip_address << "/"
|
17
17
|
end
|
18
18
|
ip_address.gsub!(".", "\\.")
|
19
|
-
"ip addr show #{interface} | grep 'inet #{ip_address}'"
|
19
|
+
"ip -4 addr show #{interface} | grep 'inet #{ip_address}'"
|
20
20
|
end
|
21
21
|
|
22
22
|
def check_has_ipv6_address(interface, ip_address)
|
@@ -27,7 +27,7 @@ class Specinfra::Command::Linux::Base::Interface < Specinfra::Command::Base::Int
|
|
27
27
|
ip_address << "/"
|
28
28
|
end
|
29
29
|
ip_address.downcase!
|
30
|
-
"ip addr show #{interface} | grep 'inet6 #{ip_address}'"
|
30
|
+
"ip -6 addr show #{interface} | grep 'inet6 #{ip_address}'"
|
31
31
|
end
|
32
32
|
|
33
33
|
def get_link_state(name)
|
@@ -9,11 +9,32 @@ class Specinfra::Command::Openbsd::Base::Interface < Specinfra::Command::Base::I
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def check_has_ipv4_address(interface, ip_address)
|
12
|
-
|
12
|
+
ip_address = ip_address.dup
|
13
|
+
if ip_address =~ /\/\d+$/
|
14
|
+
# remove the prefix - better would be to calculate the netmask
|
15
|
+
ip_address.gsub!(/\/\d+$/, "")
|
16
|
+
end
|
17
|
+
ip_address << " "
|
18
|
+
ip_address.gsub!(".", "\\.")
|
19
|
+
"ifconfig #{interface} inet | grep 'inet #{ip_address}'"
|
13
20
|
end
|
14
21
|
|
15
22
|
def check_has_ipv6_address(interface, ip_address)
|
16
|
-
|
23
|
+
ip_address = ip_address.dup
|
24
|
+
(ip_address, prefixlen) = ip_address.split(/\//)
|
25
|
+
ip_address.downcase!
|
26
|
+
if ip_address =~ /^fe80::/i
|
27
|
+
# link local needs the scope (interface) appended
|
28
|
+
ip_address << "%#{interface}"
|
29
|
+
end
|
30
|
+
unless prefixlen.to_s.empty?
|
31
|
+
# append prefixlen
|
32
|
+
ip_address << " prefixlen #{prefixlen}"
|
33
|
+
else
|
34
|
+
ip_address << " "
|
35
|
+
end
|
36
|
+
"ifconfig #{interface} inet6 | grep 'inet6 #{ip_address}'"
|
17
37
|
end
|
38
|
+
|
18
39
|
end
|
19
40
|
end
|
data/lib/specinfra/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'freebsd'
|
5
|
+
|
6
|
+
describe get_command(:check_interface_has_ipv6_address, 'vtnet0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
|
7
|
+
it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee '" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_interface_has_ipv6_address, 'vtnet0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
|
11
|
+
it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee prefixlen 64'" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_interface_has_ipv6_address, 'vtnet0', 'fe80::5054:ff:fe01:10ee/64') do
|
15
|
+
it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vtnet0 prefixlen 64'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:check_interface_has_ipv6_address, 'vtnet0', 'fe80::5054:ff:fe01:10ee') do
|
19
|
+
it { should eq "ifconfig vtnet0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vtnet0 '" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:check_interface_has_ipv4_address, 'vtnet0', '192.168.0.123') do
|
23
|
+
it { should eq "ifconfig vtnet0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:check_interface_has_ipv4_address, 'vtnet0', '192.168.0.123/24') do
|
27
|
+
it { should eq "ifconfig vtnet0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
28
|
+
end
|
@@ -4,7 +4,19 @@ property[:os] = nil
|
|
4
4
|
set :os, :family => 'linux'
|
5
5
|
|
6
6
|
describe get_command(:check_interface_has_ipv6_address, 'eth0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
|
7
|
-
it { should eq "ip addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/'" }
|
7
|
+
it { should eq "ip -6 addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/'" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_interface_has_ipv6_address, 'eth0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
|
11
|
+
it { should eq "ip -6 addr show eth0 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64 '" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_interface_has_ipv4_address, 'eth0', '192.168.0.123') do
|
15
|
+
it { should eq "ip -4 addr show eth0 | grep 'inet 192\\.168\\.0\\.123/'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:check_interface_has_ipv4_address, 'eth0', '192.168.0.123/24') do
|
19
|
+
it { should eq "ip -4 addr show eth0 | grep 'inet 192\\.168\\.0\\.123/24 '" }
|
8
20
|
end
|
9
21
|
|
10
22
|
describe get_command(:get_interface_link_state, 'eth0') do
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'openbsd'
|
5
|
+
|
6
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee') do
|
7
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee '" }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', '2001:0db8:bd05:01d2:288a:1fc0:0001:10ee/64') do
|
11
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 2001:0db8:bd05:01d2:288a:1fc0:0001:10ee prefixlen 64'" }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', 'fe80::5054:ff:fe01:10ee/64') do
|
15
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vio0 prefixlen 64'" }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:check_interface_has_ipv6_address, 'vio0', 'fe80::5054:ff:fe01:10ee') do
|
19
|
+
it { should eq "ifconfig vio0 inet6 | grep 'inet6 fe80::5054:ff:fe01:10ee%vio0 '" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:check_interface_has_ipv4_address, 'vio0', '192.168.0.123') do
|
23
|
+
it { should eq "ifconfig vio0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:check_interface_has_ipv4_address, 'vio0', '192.168.0.123/24') do
|
27
|
+
it { should eq "ifconfig vio0 inet | grep 'inet 192\\.168\\.0\\.123 '" }
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.40.
|
4
|
+
version: 2.40.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -459,6 +459,7 @@ files:
|
|
459
459
|
- spec/command/esxi/package_spec.rb
|
460
460
|
- spec/command/factory_spec.rb
|
461
461
|
- spec/command/freebsd/file_spec.rb
|
462
|
+
- spec/command/freebsd/interface_spec.rb
|
462
463
|
- spec/command/linux/bond_spec.rb
|
463
464
|
- spec/command/linux/bridge_spec.rb
|
464
465
|
- spec/command/linux/file_spec.rb
|
@@ -474,6 +475,7 @@ files:
|
|
474
475
|
- spec/command/module/systemd_spec.rb
|
475
476
|
- spec/command/module/zfs_spec.rb
|
476
477
|
- spec/command/openbsd/file_spec.rb
|
478
|
+
- spec/command/openbsd/interface_spec.rb
|
477
479
|
- spec/command/redhat/package_spec.rb
|
478
480
|
- spec/command/redhat/service_spec.rb
|
479
481
|
- spec/command/redhat7/host_spec.rb
|
@@ -549,6 +551,7 @@ test_files:
|
|
549
551
|
- spec/command/esxi/package_spec.rb
|
550
552
|
- spec/command/factory_spec.rb
|
551
553
|
- spec/command/freebsd/file_spec.rb
|
554
|
+
- spec/command/freebsd/interface_spec.rb
|
552
555
|
- spec/command/linux/bond_spec.rb
|
553
556
|
- spec/command/linux/bridge_spec.rb
|
554
557
|
- spec/command/linux/file_spec.rb
|
@@ -564,6 +567,7 @@ test_files:
|
|
564
567
|
- spec/command/module/systemd_spec.rb
|
565
568
|
- spec/command/module/zfs_spec.rb
|
566
569
|
- spec/command/openbsd/file_spec.rb
|
570
|
+
- spec/command/openbsd/interface_spec.rb
|
567
571
|
- spec/command/redhat/package_spec.rb
|
568
572
|
- spec/command/redhat/service_spec.rb
|
569
573
|
- spec/command/redhat7/host_spec.rb
|