specinfra 2.82.22 → 2.83.0

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
- SHA256:
3
- metadata.gz: de49bdd9fd6857b6cf500325aacc404eaf0c9eac696ff6b4a72d3b22aa5adf14
4
- data.tar.gz: 5f047ed2ddc78b139f15fc29531b8ae52fdf184c87abd3011e35280d8fcf851b
2
+ SHA1:
3
+ metadata.gz: d74b760931c73cff0e9828d546a7e63f658ec60a
4
+ data.tar.gz: f945ae61dd3f169436d89903db0ad45847684f63
5
5
  SHA512:
6
- metadata.gz: 7cc5c36ee688c840f61f65e6e2b5776393cd539df7bc505eca2ce533bfb9eb01ee739bfcecae8a17bb710f3384a35c983a3f8194f4edf5acfdbe4566dee01cd6
7
- data.tar.gz: 761f275ff8a9e0fa09b6b9dc28984bdcb2b0263e29c2254112b3814e9c1dd2750f8a9b997665846964928614bb997adb4f1469dfc35ba6dd114777f22bc15214
6
+ metadata.gz: a5c308cdcf87bc332143697d3c6d8d5a47e221f1afef33e711ae0786958a71f3d20009d37d15591294465427e5a31b438ac7fb1494a868cc67895ceb50f1a3fe
7
+ data.tar.gz: cfc67a5a753304dfa7f38573c77b0f6124c4012d63cc57c81d862671fed9bda823a597de02cffa61042c8d6cb1d1ef4b2d609eb3828937bdfa9458886a7e638a
@@ -5,7 +5,7 @@ function FindInstalledGem
5
5
  $nameVer = $(Invoke-Expression "gem list --local" | Select-String "^$gemName").Line
6
6
  if ($nameVer.StartsWith($gemName)) {
7
7
  if ($gemVersion) {
8
- $versions = ($nameVer -split { $_ -eq "(" -or $_ -eq ")"})[1].split(" ")
8
+ $versions = ($nameVer -split { $_ -eq "(" -or $_ -eq ")"})[1].split(", ")
9
9
  if ($versions.Contains($gemVersion)) {
10
10
  $true
11
11
  } else {
@@ -1,7 +1,7 @@
1
1
  class Specinfra::Command::Darwin::Base::Package < Specinfra::Command::Base::Package
2
2
  class << self
3
3
  def check_is_installed(package, version=nil)
4
- escaped_package = escape(File.basename(package))
4
+ escaped_package = escape(::File.basename(package))
5
5
  if version
6
6
  cmd = %Q[brew info #{escaped_package} | grep -E "^$(brew --prefix)/Cellar/#{escaped_package}/#{escape(version)}"]
7
7
  else
@@ -13,7 +13,7 @@ class Specinfra::Command::Darwin::Base::Package < Specinfra::Command::Base::Pack
13
13
  alias :check_is_installed_by_homebrew :check_is_installed
14
14
 
15
15
  def check_is_installed_by_homebrew_cask(package, version=nil)
16
- escaped_package = escape(File.basename(package))
16
+ escaped_package = escape(::File.basename(package))
17
17
  if version
18
18
  cmd = "brew cask info #{escaped_package} | grep -E '^/opt/homebrew-cask/Caskroom/#{escaped_package}/#{escape(version)}'"
19
19
  else
@@ -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
 
@@ -10,7 +10,7 @@ module Specinfra
10
10
  return false if ret.stdout =~ /stop(ped)?\/waiting/
11
11
 
12
12
  # If the service is not registered, check by ps command
13
- if ret.exit_status == 1
13
+ if ret.exit_status == 1 && !Specinfra.configuration.no_service_process_fallback
14
14
  cmd = Specinfra.command.get(:check_process_is_running, service)
15
15
  ret = Specinfra.backend.run_command(cmd)
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.82.22"
2
+ VERSION = "2.83.0"
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
@@ -60,4 +60,53 @@ describe Specinfra::Processor do
60
60
  end
61
61
  end
62
62
  end
63
+
64
+ describe 'check_service_is_running' do
65
+ let(:service_command) { Specinfra.command.get(:check_service_is_running, 'service_name') }
66
+ let(:process_command) { Specinfra.command.get(:check_process_is_running, 'service_name') }
67
+
68
+ context 'default settings' do
69
+ it 'does not fall back to process checking if service checking succeeds' do
70
+ allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 0 }
71
+
72
+ expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
73
+ end
74
+
75
+ context 'when service checking fails' do
76
+ it 'falls back to checking by process and returns true if that succeeds' do
77
+ allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
78
+
79
+ expect(Specinfra.backend).to receive(:run_command).with(process_command) { CommandResult.new :exit_status => 0 }
80
+
81
+ expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
82
+ end
83
+
84
+ it 'falls back to checking by process and returns false if that fails' do
85
+ allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
86
+
87
+ expect(Specinfra.backend).to receive(:run_command).with(process_command) { CommandResult.new :exit_status => 1 }
88
+
89
+ expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(false)
90
+ end
91
+ end
92
+ end
93
+
94
+ context 'no_service_process_fallback set to true' do
95
+ it 'does not fall back to checking processes if service checking succeeds' do
96
+ Specinfra.configuration.no_service_process_fallback(true)
97
+
98
+ allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 0 }
99
+
100
+ expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(true)
101
+ end
102
+
103
+ it 'does not fall back to checking processes if service checking fails' do
104
+ Specinfra.configuration.no_service_process_fallback(true)
105
+
106
+ allow(Specinfra.backend).to receive(:run_command).with(service_command) { CommandResult.new :exit_status => 1 }
107
+
108
+ expect(Specinfra::Processor.check_service_is_running('service_name')).to eq(false)
109
+ end
110
+ end
111
+ end
63
112
  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.22
4
+ version: 2.83.0
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-10-23 00:00:00.000000000 Z
11
+ date: 2021-10-21 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
@@ -629,7 +633,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
629
633
  - !ruby/object:Gem::Version
630
634
  version: '0'
631
635
  requirements: []
632
- rubygems_version: 3.1.2
636
+ rubyforge_project:
637
+ rubygems_version: 2.5.1
633
638
  signing_key:
634
639
  specification_version: 4
635
640
  summary: Common layer for serverspec and itamae
@@ -674,6 +679,10 @@ test_files:
674
679
  - spec/command/debian8/port_spec.rb
675
680
  - spec/command/debian9/port_spec.rb
676
681
  - spec/command/debian9/service_spec.rb
682
+ - spec/command/debiantesting/port_spec.rb
683
+ - spec/command/debiantesting/service_spec.rb
684
+ - spec/command/debianunstable/port_spec.rb
685
+ - spec/command/debianunstable/service_spec.rb
677
686
  - spec/command/esxi/package_spec.rb
678
687
  - spec/command/factory_spec.rb
679
688
  - spec/command/freebsd/file_spec.rb