specinfra 2.82.19 → 2.82.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0977a93ebe817fca71a2a1d98a37e0bf9db280913e86fe6817ac87a84e804435'
4
- data.tar.gz: 5a9c576204f65744b2c276bb9238bd2d7c15ee1111be3ff7aa7b4301035c5947
3
+ metadata.gz: 596a60daf7e5fa95bdc0a961afebd91b23e67f76047ce1df0aba7bb1e059e896
4
+ data.tar.gz: 4fc1cbf1cc54559eb1d9fd9149a9a6ec83403a6800171b3ffb44c4932ac81075
5
5
  SHA512:
6
- metadata.gz: 712afed966c8dfc740ac94c0bf5c0c825a35fbd9b1e622ada62f46bcec34efcc0a8cb0b3fc370c7b2548af83ad888b883f30b2c8032df9558fd5b31c5fdc90fa
7
- data.tar.gz: 826c184a2ab8e072bfcc1f371d8a34834cb016bf5a123f16a529ad363fd25fbee33d7aea45d852870cde28b2d0ffb3ef1effe0fe89c5123b7fef06a377f9d7c6
6
+ metadata.gz: c0691a838b1686c4159b41b4594a433cc57b6e530b85d34e4d7299241a9426451bcc31ddd9bbf90ce2b59177acd3eb2b9e2416d073a74c3a83b556be36c2fa4e
7
+ data.tar.gz: c46185b12504e1ef60c1a161a51902b01ef6a917c010b35cb5a83f64707522243fe498f6c2260e0f403f54730cf3972a412da2ec425d56e47042726f16dbf1c8
@@ -2,10 +2,11 @@ function FindInstalledGem
2
2
  {
3
3
  param($gemName, $gemVersion)
4
4
 
5
- $nameVer = $(Invoke-Expression "gem list --local" | Select-String "$gemName").Line
5
+ $nameVer = $(Invoke-Expression "gem list --local" | Select-String "^$gemName").Line
6
6
  if ($nameVer.StartsWith($gemName)) {
7
7
  if ($gemVersion) {
8
- if ($nameVer.EndsWith("$gemVersion)")) {
8
+ $versions = ($nameVer -split { $_ -eq "(" -or $_ -eq ")"})[1].split(", ")
9
+ if ($versions.Contains($gemVersion)) {
9
10
  $true
10
11
  } else {
11
12
  $false
@@ -6,9 +6,10 @@ function IsPortListening
6
6
  [array] $networkIPs += "0.0.0.0"
7
7
  [array] $networkIPs += "127.0.0.1"
8
8
  [array] $networkIPs += "[::1]"
9
+ [array] $networkIPs += "[::]"
9
10
  foreach ($ipaddress in $networkIPs)
10
11
  {
11
- $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*LISTENING")
12
+ $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*(LISTENING|\*:\*)")
12
13
  if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") }
13
14
  if ($netstatOutput -match $matchExpression) { return $true }
14
15
  }
@@ -4,8 +4,16 @@ class Specinfra::Command::Darwin::Base::Service < Specinfra::Command::Base::Serv
4
4
  "launchctl list | grep #{escape(service)}"
5
5
  end
6
6
 
7
+ def check_is_enabled_under_homebrew(service)
8
+ "brew services list | grep #{escape(service)}"
9
+ end
10
+
7
11
  def check_is_running(service)
8
12
  "launchctl list | grep #{escape(service)} | grep -E '^[0-9]+'"
9
13
  end
14
+
15
+ def check_is_running_under_homebrew(service)
16
+ "brew services list | grep #{escape(service)} | grep 'started'"
17
+ end
10
18
  end
11
19
  end
@@ -1,10 +1,11 @@
1
1
  class Specinfra::Command::Debian::Base::Port < Specinfra::Command::Linux::Base::Port
2
2
  class << self
3
3
  def create(os_info=nil)
4
- if (os_info || os)[:release].to_i < 8
5
- self
6
- else
4
+ release = (os_info || os)[:release]
5
+ if ["testing", "unstable"].include?(release) || release.to_i >= 8
7
6
  Specinfra::Command::Debian::V8::Port
7
+ else
8
+ self
8
9
  end
9
10
  end
10
11
  end
@@ -1,10 +1,11 @@
1
1
  class Specinfra::Command::Debian::Base::Service < Specinfra::Command::Linux::Base::Service
2
2
  class << self
3
3
  def create(os_info=nil)
4
- if (os_info || os)[:release].to_i < 8
5
- self
6
- else
4
+ release = (os_info || os)[:release]
5
+ if ["testing", "unstable"].include?(release) || release.to_i >= 8
7
6
  Specinfra::Command::Debian::V8::Service
7
+ else
8
+ self
8
9
  end
9
10
  end
10
11
 
@@ -22,7 +22,15 @@ module Specinfra
22
22
  if local_address == '0.0.0.0'
23
23
  [ '\*' , '0\.0\.0\.0' ]
24
24
  else
25
- [ local_address ]
25
+ [ fix_format_if_ipv6(local_address) ]
26
+ end
27
+ end
28
+
29
+ def fix_format_if_ipv6(local_address)
30
+ if local_address =~ /.*:.*/
31
+ "\\[#{local_address}\\]"
32
+ else
33
+ local_address
26
34
  end
27
35
  end
28
36
 
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.82.19"
2
+ VERSION = "2.82.24"
3
3
  end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian', :release => 'testing'
5
+
6
+ describe get_command(:check_port_is_listening, '80') do
7
+ it { should eq 'ss -tunl | grep -E -- :80\ ' }
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian', :release => 'testing'
5
+
6
+ describe get_command(:check_service_is_enabled, 'apache') do
7
+ it { should eq 'systemctl --quiet is-enabled apache||ls /etc/rc[S5].d/S??apache >/dev/null 2>/dev/null' }
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian', :release => 'unstable'
5
+
6
+ describe get_command(:check_port_is_listening, '80') do
7
+ it { should eq 'ss -tunl | grep -E -- :80\ ' }
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'debian', :release => 'unstable'
5
+
6
+ describe get_command(:check_service_is_enabled, 'apache') do
7
+ it { should eq 'systemctl --quiet is-enabled apache||ls /etc/rc[S5].d/S??apache >/dev/null 2>/dev/null' }
8
+ end
@@ -14,15 +14,15 @@ describe Specinfra::Command::Module::Ss do
14
14
 
15
15
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0'})).to eq 'ss -tunl | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
16
16
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
17
- it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
17
+ it { expect(klass.check_is_listening('80', options={:local_address => '::', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\\[::\\\\\\]:80\ ' }
18
18
  it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
19
- it { expect(klass.check_is_listening('80', options={:local_address => '0.0.0.0', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\*:80\ \\|\\ 0\\\\.0\\\\.0\\\\.0:80\\ ' }
19
+ it { expect(klass.check_is_listening('80', options={:local_address => '::', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\\[::\\\\\\]:80\ ' }
20
20
 
21
21
  it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4'})).to eq 'ss -tunl | grep -E -- \ 1.2.3.4:80\ ' }
22
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \ 1.2.3.4:80\ ' }
23
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ 1.2.3.4:80\ ' }
22
+ it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'tcp'})).to eq 'ss -tnl4 | grep -E -- \\ 1.2.3.4:80\ ' }
23
+ it { expect(klass.check_is_listening('80', options={:local_address => '2001:db8:dead:beef::1', :protocol => 'tcp6'})).to eq 'ss -tnl6 | grep -E -- \ \\\\\\[2001:db8:dead:beef::1\\\\\\]:80\ ' }
24
24
  it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp'})).to eq 'ss -unl4 | grep -E -- \ 1.2.3.4:80\ ' }
25
- it { expect(klass.check_is_listening('80', options={:local_address => '1.2.3.4', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ 1.2.3.4:80\ ' }
25
+ it { expect(klass.check_is_listening('80', options={:local_address => '2001:db8:dead:beef::1', :protocol => 'udp6'})).to eq 'ss -unl6 | grep -E -- \ \\\\\\[2001:db8:dead:beef::1\\\\\\]:80\ ' }
26
26
 
27
27
  it { expect{klass.check_is_listening('80', options={:protocol => 'bad_proto'})}.to raise_error(ArgumentError, 'Unknown protocol [bad_proto]') }
28
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.82.19
4
+ version: 2.82.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-24 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -537,6 +537,10 @@ files:
537
537
  - spec/command/debian8/port_spec.rb
538
538
  - spec/command/debian9/port_spec.rb
539
539
  - spec/command/debian9/service_spec.rb
540
+ - spec/command/debiantesting/port_spec.rb
541
+ - spec/command/debiantesting/service_spec.rb
542
+ - spec/command/debianunstable/port_spec.rb
543
+ - spec/command/debianunstable/service_spec.rb
540
544
  - spec/command/esxi/package_spec.rb
541
545
  - spec/command/factory_spec.rb
542
546
  - spec/command/freebsd/file_spec.rb
@@ -674,6 +678,10 @@ test_files:
674
678
  - spec/command/debian8/port_spec.rb
675
679
  - spec/command/debian9/port_spec.rb
676
680
  - spec/command/debian9/service_spec.rb
681
+ - spec/command/debiantesting/port_spec.rb
682
+ - spec/command/debiantesting/service_spec.rb
683
+ - spec/command/debianunstable/port_spec.rb
684
+ - spec/command/debianunstable/service_spec.rb
677
685
  - spec/command/esxi/package_spec.rb
678
686
  - spec/command/factory_spec.rb
679
687
  - spec/command/freebsd/file_spec.rb