specinfra 2.82.14 → 2.82.19

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: 149c1e2722e441af453f1eca0da8bc9f6e639097
4
- data.tar.gz: b7eb2635ebfaf3b7119e1103da9ed96861abd956
2
+ SHA256:
3
+ metadata.gz: '0977a93ebe817fca71a2a1d98a37e0bf9db280913e86fe6817ac87a84e804435'
4
+ data.tar.gz: 5a9c576204f65744b2c276bb9238bd2d7c15ee1111be3ff7aa7b4301035c5947
5
5
  SHA512:
6
- metadata.gz: 30dc8b7ac56e049c1e29a71fe7f473ce14c58e4387a61b0b8c5c9206862c09a2a30838ee8d5131c0c8865f37ec955c987d8687a54710c41410736a48c1b0d1fc
7
- data.tar.gz: 3e28985de56c4995daa461278ffaea599c80e6e443f410039971e61410029eaa7c4679d0dbb84cfb82b64a2d95a58999f02423d1804bca885aa290026abe9ff0
6
+ metadata.gz: 712afed966c8dfc740ac94c0bf5c0c825a35fbd9b1e622ada62f46bcec34efcc0a8cb0b3fc370c7b2548af83ad888b883f30b2c8032df9558fd5b31c5fdc90fa
7
+ data.tar.gz: 826c184a2ab8e072bfcc1f371d8a34834cb016bf5a123f16a529ad363fd25fbee33d7aea45d852870cde28b2d0ffb3ef1effe0fe89c5123b7fef06a377f9d7c6
@@ -0,0 +1,20 @@
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
+ if ($nameVer.EndsWith("$gemVersion)")) {
9
+ $true
10
+ } else {
11
+ $false
12
+ }
13
+ } else {
14
+ $true
15
+ }
16
+ } else {
17
+ $false
18
+ }
19
+ }
20
+
@@ -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
 
@@ -1,17 +1,15 @@
1
1
  class Specinfra::Command::Base::User < Specinfra::Command::Base
2
2
  class << self
3
3
  def check_exists(user)
4
- "getent passwd #{escape(user)}"
4
+ "id #{escape(user)}"
5
5
  end
6
6
 
7
7
  def check_belongs_to_group(user, group)
8
- "groups #{escape(user)} | grep -- #{escape(group)}"
8
+ "id #{escape(user)} | sed 's/ context=.*//g' | cut -f 4 -d '=' | grep -- #{escape(group)}"
9
9
  end
10
10
 
11
11
  def check_belongs_to_primary_group(user, group)
12
- pgid = "getent passwd #{escape(user)} | cut -f 4 -d ':'"
13
- ggid = "getent group #{escape(group)} | cut -f 3 -d ':'"
14
- %Q|test "#{escape(pgid)}" -eq "#{escape(ggid)}"|
12
+ "id -gn #{escape(user)}| grep ^#{escape(group)}$"
15
13
  end
16
14
 
17
15
  def check_is_system_user(user)
@@ -23,8 +21,8 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
23
21
  end
24
22
 
25
23
  def check_has_uid(user, uid)
26
- auid = "getent passwd #{escape(user)} | cut -f 3 -d ':'"
27
- %Q| test "#{escape(uid)}" -eq "#{escape(auid)}"|
24
+ regexp = "^uid=#{uid}("
25
+ "id #{escape(user)} | grep -- #{escape(regexp)}"
28
26
  end
29
27
 
30
28
  def check_has_home_directory(user, path_to_home)
@@ -49,11 +47,11 @@ class Specinfra::Command::Base::User < Specinfra::Command::Base
49
47
  end
50
48
 
51
49
  def get_uid(user)
52
- "getent passwd #{escape(user)} | cut -f 3 -d ':'"
50
+ "id -u #{escape(user)}"
53
51
  end
54
52
 
55
53
  def get_gid(user)
56
- "getent passwd #{escape(user)} | cut -f 4 -d ':'"
54
+ "id -g #{escape(user)}"
57
55
  end
58
56
 
59
57
  def get_home_directory(user)
@@ -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)}"
@@ -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.14"
2
+ VERSION = "2.82.19"
3
3
  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.14
4
+ version: 2.82.19
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-08-24 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: