specinfra 2.67.7 → 2.67.8

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: 3277900939ebf01c5ac42247f8274e4ba198e585
4
- data.tar.gz: 760acb4646c250057493ed45a752371070a516a8
3
+ metadata.gz: 0ec89b1a61e742e944b125ce3f59c1d24c5c82d2
4
+ data.tar.gz: be037120947aacfa7899bc980dc92a9bcde153c2
5
5
  SHA512:
6
- metadata.gz: e990b6514c5f0cd223da0520b77a9c4e0ab402a70a926f6b459eeb7ef2212d137ae66de89fc02d4ccbcc5b8995e43a65f6b5c7b2eab02b4a851a59ee7a5dd020
7
- data.tar.gz: a96423b03de2ad4903ea3362c06ea20bf20b705574329e102685087623916d3a1161555f73fd55432ef9fb2fc3d9af184623258a324643baa51f46948d292994
6
+ metadata.gz: 2b5c0ddcb7268f5417c1ace1c9fdd61b93d4235dafb33ed913beab573cad36828c16d0456507b747e2ecdd6302d47d4504f75509d7e8ffbde0223cc6fa52760c
7
+ data.tar.gz: 64215c8e8ff8e50f6a4354c2712c7dc00b958f2bb290d254b20a62927427036037b44cb238b3692aa57e2b045961d754b475c5fee383c424b91c72ecf1171126
@@ -3,13 +3,13 @@ module Specinfra
3
3
  class Virtualization < Base
4
4
  def get
5
5
  res = {}
6
- ## docker
7
- if backend.run_command('ls /.dockerinit').success?
6
+ ## docker
7
+ if backend.run_command('grep -Eqa \'docker(/|-[0-9a-f]+)\' /proc/1/cgroup||test -e /.dockerinit').success?
8
8
  res[:system] = 'docker'
9
9
  return res
10
10
  end
11
11
 
12
- ## OpenVZ on Linux
12
+ ## OpenVZ on Linux
13
13
  if backend.run_command('test -d /proc/vz -a ! -d /proc/bc').success?
14
14
  res[:system] = 'openvz'
15
15
  return res
@@ -18,7 +18,7 @@ module Specinfra
18
18
  cmd = backend.command.get(:get_inventory_system_product_name)
19
19
  ret = backend.run_command(cmd)
20
20
  if ret.exit_status == 0
21
- res[:system] = parse_system_product_name(ret.stdout)
21
+ res[:system] = parse_system_product_name(ret.stdout)
22
22
  return res
23
23
  end
24
24
 
@@ -27,8 +27,8 @@ module Specinfra
27
27
  res[:system] = parse_systemd_detect_virt_output(ret.stdout)
28
28
  end
29
29
 
30
- res
31
- end
30
+ res
31
+ end
32
32
 
33
33
  def parse_system_product_name(ret)
34
34
  product_name = case ret
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.67.7"
2
+ VERSION = "2.67.8"
3
3
  end
@@ -3,7 +3,7 @@ require 'specinfra/helper/detect_os/suse'
3
3
 
4
4
  describe Specinfra::Helper::DetectOs::Suse do
5
5
  suse = Specinfra::Helper::DetectOs::Suse.new(:exec)
6
- it 'Should return opensuse 42 when openSUSE 42.2 is installed.' do
6
+ it 'Should return opensuse 42.2 when openSUSE 42.2 is installed.' do
7
7
  allow(suse).to receive(:run_command) {
8
8
  CommandResult.new(:stdout => "NAME=\"openSUSE Leap\"\nVERSION=\"42.2\"\nID=opensuse\nID_LIKE=\"suse\"\nVERSION_ID=\"42.2\"\nPRETTY_NAME=\"openSUSE Leap 42.2\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:opensuse:leap:42.2\"\nBUG_REPORT_URL=\"https://bugs.opensuse.org\"\nHOME_URL=\"https://www.opensuse.org/\"\n", :exit_status => 0)
9
9
  }
@@ -21,13 +21,22 @@ describe Specinfra::Helper::DetectOs::Suse do
21
21
  :release => '13.2'
22
22
  )
23
23
  end
24
- it 'Should return sles 12 when SUSE Linux Enterprise Server 12 is installed.' do
24
+ it 'Should return sles 12.2 when SUSE Linux Enterprise Server 12.2 is installed.' do
25
25
  allow(suse).to receive(:run_command) {
26
- CommandResult.new(:stdout => "NAME=\"SLES\"\nVERSION=\"12\"\nVERSION_ID=\"12\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12\"\n", :exit_status => 0)
26
+ CommandResult.new(:stdout => "NAME=\"SLES\"\nVERSION=\"12.2\"\nVERSION_ID=\"12.2\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12\"\n", :exit_status => 0)
27
27
  }
28
28
  expect(suse.detect).to include(
29
29
  :family => 'sles',
30
- :release => '12'
30
+ :release => '12.2'
31
+ )
32
+ end
33
+ it 'Should return sles 11.4 when SUSE Linux Enterprise Server 11.4 is installed.' do
34
+ allow(suse).to receive(:run_command) {
35
+ CommandResult.new(:stdout => "NAME=\"SLES\"\nVERSION=\"11.4\"\nVERSION_ID=\"11.4\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 11 SP4\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:11:4\"", :exit_status => 0)
36
+ }
37
+ expect(suse.detect).to include(
38
+ :family => 'sles',
39
+ :release => '11.4'
31
40
  )
32
41
  end
33
42
  end
@@ -5,23 +5,23 @@ describe Specinfra::HostInventory::Virtualization do
5
5
  set :os, { :family => 'linux' }
6
6
  end
7
7
 
8
- virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
8
+ virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
9
9
  let(:host_inventory) { nil }
10
10
  it 'Docker Image should return :system => "docker"' do
11
- allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
12
- CommandResult.new(:stdout => '/.dockerinit', :exit_status => 0)
13
- end
11
+ allow(virt.backend).to receive(:run_command).with('grep -Eqa \'docker(/|-[0-9a-f]+)\' /proc/1/cgroup||test -e /.dockerinit') do
12
+ CommandResult.new(:stdout => '', :exit_status => 0)
13
+ end
14
14
  expect(virt.get).to include(:system => 'docker')
15
15
  end
16
16
 
17
17
  let(:host_inventory) { nil }
18
18
  it 'Debian Wheezy on OpenVZ should return :system => "openvz"' do
19
- allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
19
+ allow(virt.backend).to receive(:run_command).with('grep -Eqa \'docker(/|-[0-9a-f]+)\' /proc/1/cgroup||test -e /.dockerinit') do
20
20
  CommandResult.new(:stdout => '', :exit_status => 2)
21
- end
21
+ end
22
22
  allow(virt.backend).to receive(:run_command).with('test -d /proc/vz -a ! -d /proc/bc') do
23
23
  CommandResult.new(:stdout => '', :exit_status => 0)
24
- end
24
+ end
25
25
  expect(virt.get).to include(:system => 'openvz')
26
26
  end
27
27
 
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.67.7
4
+ version: 2.67.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp