specinfra 2.82.15 → 2.82.20

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
- SHA1:
3
- metadata.gz: e4bbeedbd93346478be080cccaa8c690a2dab1d4
4
- data.tar.gz: 06860c7283922f58de2599abdfed56ded6006b0f
2
+ SHA256:
3
+ metadata.gz: 6e920f9df3ca076025d9c92638e3999cc0ba4b0f40f5c83b09cf035f6cfadf13
4
+ data.tar.gz: b0c068c18c92efd330bf70deac78ecba681ccc9180f4cb68bcfa424086eee2a8
5
5
  SHA512:
6
- metadata.gz: 23d0eb2edb19432f9ffe8dfb8e352a0d60fc6da010e74cfa2b2601554737996444763914c292f854a7b41a492c940400d0fca56cff40a4a62d25eb2f0991c652
7
- data.tar.gz: 415baa53796260ae23d3a69414d51b0c7bad7def0483cfdf4afbc96d08a265dc3997e0735c918c579bd7f19d0b2c843c78baf39deaf85b689d68ade76688fabc
6
+ metadata.gz: 3d72663ebafa14bef5258048ae013fb6e7a48f99bd388149eab199c66a7be552dfb371bf0d7152dfcd6ad0f1a6a91dadb184423c5bd5629f418d284fe8dc1064
7
+ data.tar.gz: 4b269bc6079be199ab05e35d3c3fe72c02900f30accf53661ee61c01d9b9121a8668683858f94f55e33b63b47a925253c950de4bcac2bed8abfac1f262fcddc8
@@ -0,0 +1,21 @@
1
+ function FindInstalledGem
2
+ {
3
+ param($gemName, $gemVersion)
4
+
5
+ $nameVer = $(Invoke-Expression "gem list --local" | Select-String "^$gemName").Line
6
+ if ($nameVer.StartsWith($gemName)) {
7
+ if ($gemVersion) {
8
+ $versions = ($nameVer -split { $_ -eq "(" -or $_ -eq ")"})[1].split(" ")
9
+ if ($versions.Contains($gemVersion)) {
10
+ $true
11
+ } else {
12
+ $false
13
+ }
14
+ } else {
15
+ $true
16
+ }
17
+ } else {
18
+ $false
19
+ }
20
+ }
21
+
@@ -5,9 +5,10 @@ function IsPortListening
5
5
  $networkIPs = (Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPEnabled}) | %{ $_.IPAddress[0] }
6
6
  [array] $networkIPs += "0.0.0.0"
7
7
  [array] $networkIPs += "127.0.0.1"
8
+ [array] $networkIPs += "[::1]"
8
9
  foreach ($ipaddress in $networkIPs)
9
10
  {
10
- $matchExpression = ("$ipaddress" + ":" + $portNumber)
11
+ $matchExpression = ("$ipaddress" + ":" + $portNumber + ".*LISTENING")
11
12
  if ($protocol) { $matchExpression = ($protocol.toUpper() + "\s+$matchExpression") }
12
13
  if ($netstatOutput -match $matchExpression) { return $true }
13
14
  }
@@ -73,10 +73,16 @@ module Specinfra
73
73
  end
74
74
 
75
75
  def create_ssh
76
+ options = get_config(:ssh_options)
77
+
78
+ if !Net::SSH::VALID_OPTIONS.include?(:strict_host_key_checking)
79
+ options.delete(:strict_host_key_checking)
80
+ end
81
+
76
82
  Net::SSH.start(
77
83
  get_config(:host),
78
- get_config(:ssh_options)[:user],
79
- get_config(:ssh_options)
84
+ options[:user],
85
+ options
80
86
  )
81
87
  end
82
88
 
@@ -34,6 +34,10 @@ class Specinfra::Command::Darwin::Base::File < Specinfra::Command::Base::File
34
34
  def get_mode(file)
35
35
  "stat -f%Lp #{escape(file)}"
36
36
  end
37
+
38
+ def get_size(file)
39
+ "stat -f %z #{escape(file)}"
40
+ end
37
41
 
38
42
  def get_owner_user(file)
39
43
  "stat -f %Su #{escape(file)}"
@@ -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
 
@@ -7,5 +7,13 @@ class Specinfra::Command::Windows::Base::Package < Specinfra::Command::Windows::
7
7
  exec "(FindInstalledApplication -appName '#{package}' #{version_selection}) -eq $true"
8
8
  end
9
9
  end
10
+
11
+ def check_is_installed_by_gem(name, version=nil, gem_binary="gem")
12
+ version_selection = version.nil? ? "" : "-gemVersion '#{version}'"
13
+ Backend::PowerShell::Command.new do
14
+ using 'find_installed_gem.ps1'
15
+ exec "(FindInstalledGem -gemName '#{name}' #{version_selection}) -eq $true"
16
+ end
17
+ end
10
18
  end
11
19
  end
@@ -32,7 +32,7 @@ module Specinfra
32
32
 
33
33
  def parse_system_product_name(ret)
34
34
  product_name = case ret
35
- when /.*VMware Virtual Platform/
35
+ when /.*(VMware Virtual Platform|VMware7,1)/
36
36
  'vmware'
37
37
  when /.*VirtualBox/
38
38
  'vbox'
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.82.15"
2
+ VERSION = "2.82.20"
3
3
  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.15
4
+ version: 2.82.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2020-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -135,6 +135,7 @@ files:
135
135
  - lib/specinfra/backend/powershell/support/find_group.ps1
136
136
  - lib/specinfra/backend/powershell/support/find_iis_component.ps1
137
137
  - lib/specinfra/backend/powershell/support/find_installed_application.ps1
138
+ - lib/specinfra/backend/powershell/support/find_installed_gem.ps1
138
139
  - lib/specinfra/backend/powershell/support/find_installed_hot_fix.ps1
139
140
  - lib/specinfra/backend/powershell/support/find_scheduled_task.ps1
140
141
  - lib/specinfra/backend/powershell/support/find_service.ps1
@@ -613,7 +614,7 @@ homepage: https://github.com/mizzy/specinfra
613
614
  licenses:
614
615
  - MIT
615
616
  metadata: {}
616
- post_install_message:
617
+ post_install_message:
617
618
  rdoc_options: []
618
619
  require_paths:
619
620
  - lib
@@ -628,9 +629,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
628
629
  - !ruby/object:Gem::Version
629
630
  version: '0'
630
631
  requirements: []
631
- rubyforge_project:
632
- rubygems_version: 2.2.2
633
- signing_key:
632
+ rubygems_version: 3.1.2
633
+ signing_key:
634
634
  specification_version: 4
635
635
  summary: Common layer for serverspec and itamae
636
636
  test_files: