specinfra 2.61.2 → 2.61.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 595aec10abe3600660b94d07bcb78c93c78cb5bb
|
4
|
+
data.tar.gz: 1e15b54261cc640db4ae9a7264d6e5994b1ad645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27ccf2fc50f00579d4726bfdabefb06a55e078b1b97a16cf11fb45611f32500b33eee892332eeabf2ae615bd8fb830042e2aa16a2e16b89bab815bc089047b78
|
7
|
+
data.tar.gz: a9190a888cce763b2863ee597e9dcaf0c2f8b21db57ccaf3a7e6f083cc1d82f0fe9c79cee3bf19a8179403a1e7417a18af694c17b2bdd55400a32f273aa73d49
|
@@ -1,21 +1,21 @@
|
|
1
1
|
class Specinfra::Helper::DetectOs::Debian < Specinfra::Helper::DetectOs
|
2
2
|
def detect
|
3
|
-
if run_command('
|
3
|
+
if (debian_version = run_command('cat /etc/debian_version')) && debian_version.success?
|
4
4
|
distro = nil
|
5
5
|
release = nil
|
6
|
-
lsb_release = run_command("lsb_release -ir")
|
7
|
-
if lsb_release.success?
|
6
|
+
if (lsb_release = run_command("lsb_release -ir")) && lsb_release.success?
|
8
7
|
lsb_release.stdout.each_line do |line|
|
9
8
|
distro = line.split(':').last.strip if line =~ /^Distributor ID:/
|
10
9
|
release = line.split(':').last.strip if line =~ /^Release:/
|
11
10
|
end
|
11
|
+
elsif (lsb_release = run_command("cat /etc/lsb-release")) && lsb_release.success?
|
12
|
+
lsb_release.stdout.each_line do |line|
|
13
|
+
distro = line.split('=').last.strip if line =~ /^DISTRIB_ID=/
|
14
|
+
release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
|
15
|
+
end
|
12
16
|
else
|
13
|
-
|
14
|
-
|
15
|
-
lsb_release.stdout.each_line do |line|
|
16
|
-
distro = line.split('=').last.strip if line =~ /^DISTRIB_ID=/
|
17
|
-
release = line.split('=').last.strip if line =~ /^DISTRIB_RELEASE=/
|
18
|
-
end
|
17
|
+
if debian_version.stdout.chomp =~ /^[[:digit:]]+\.[[:digit:]]+$/
|
18
|
+
release = debian_version.stdout.chomp
|
19
19
|
end
|
20
20
|
end
|
21
21
|
distro ||= 'debian'
|
data/lib/specinfra/version.rb
CHANGED
@@ -118,7 +118,7 @@ describe 'os' do
|
|
118
118
|
context 'test ubuntu with lsb_release command' do
|
119
119
|
before do
|
120
120
|
allow(Specinfra.backend).to receive(:run_command) do |args|
|
121
|
-
if ['
|
121
|
+
if ['cat /etc/debian_version', 'lsb_release -ir'].include? args
|
122
122
|
double(
|
123
123
|
:run_command_response,
|
124
124
|
:success? => true,
|
@@ -141,7 +141,7 @@ describe 'os' do
|
|
141
141
|
context 'test ubuntu with /etc/lsb-release' do
|
142
142
|
before do
|
143
143
|
allow(Specinfra.backend).to receive(:run_command) do |args|
|
144
|
-
if ['
|
144
|
+
if ['cat /etc/debian_version', 'cat /etc/lsb-release'].include? args
|
145
145
|
double(
|
146
146
|
:run_command_response,
|
147
147
|
:success? => true,
|
@@ -169,8 +169,8 @@ EOF
|
|
169
169
|
context 'test debian (no lsb_release or lsb-release)' do
|
170
170
|
before do
|
171
171
|
allow(Specinfra.backend).to receive(:run_command) do |args|
|
172
|
-
if args == '
|
173
|
-
double :run_command_response, :success? => true, :stdout =>
|
172
|
+
if args == 'cat /etc/debian_version'
|
173
|
+
double :run_command_response, :success? => true, :stdout => "8.5\n"
|
174
174
|
elsif args == 'uname -m'
|
175
175
|
double :run_command_response, :success? => true, :stdout => "x86_64\n"
|
176
176
|
else
|
@@ -181,7 +181,7 @@ EOF
|
|
181
181
|
subject! { os }
|
182
182
|
it do
|
183
183
|
expect(Specinfra.backend).to have_received(:run_command).at_least(1).times
|
184
|
-
should eq({:family => 'debian', :release =>
|
184
|
+
should eq({:family => 'debian', :release => '8.5', :arch => 'x86_64' })
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'specinfra/helper/detect_os/debian'
|
3
|
+
|
4
|
+
describe Specinfra::Helper::DetectOs::Debian do
|
5
|
+
darwin = Specinfra::Helper::DetectOs::Debian.new(Specinfra.backend)
|
6
|
+
|
7
|
+
it 'Should return debian 8.5 when jessie is installed.' do
|
8
|
+
allow(debian).to receive(:run_command).with('cat /etc/debian_version') {
|
9
|
+
CommandResult.new(:stdout => "8.5\n", :exit_status => 0)
|
10
|
+
}
|
11
|
+
expect(darwin.detect).to include(
|
12
|
+
:family => 'debian',
|
13
|
+
:release => '8.5'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
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.61.
|
4
|
+
version: 2.61.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-scp
|
@@ -569,6 +569,7 @@ files:
|
|
569
569
|
- spec/configuration_spec.rb
|
570
570
|
- spec/helper/detect_os/aix_spec.rb
|
571
571
|
- spec/helper/detect_os/darwin_spec.rb
|
572
|
+
- spec/helper/detect_os/debian_spec.rb
|
572
573
|
- spec/helper/detect_os/eos_spec.rb
|
573
574
|
- spec/helper/detect_os/esxi_spec.rb
|
574
575
|
- spec/helper/detect_os/freebsd_spec.rb
|
@@ -686,6 +687,7 @@ test_files:
|
|
686
687
|
- spec/configuration_spec.rb
|
687
688
|
- spec/helper/detect_os/aix_spec.rb
|
688
689
|
- spec/helper/detect_os/darwin_spec.rb
|
690
|
+
- spec/helper/detect_os/debian_spec.rb
|
689
691
|
- spec/helper/detect_os/eos_spec.rb
|
690
692
|
- spec/helper/detect_os/esxi_spec.rb
|
691
693
|
- spec/helper/detect_os/freebsd_spec.rb
|