specinfra 2.43.11 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25d7a37781f4679ffda169df36604e3414b300b5
4
- data.tar.gz: 9d244072c2ed7ad846a4afc756dc31e4b7512a19
3
+ metadata.gz: d6e519f0626f5f595627c16d9f024957fc4e1227
4
+ data.tar.gz: 66b58a2652ad4670601157a2b0f2f26b285d697c
5
5
  SHA512:
6
- metadata.gz: 4fb6e2d3e77b0f04bfef7fa26376281bd7adabf03bdde31f0f5897b53f69121f2c6198bff1f492654f4a12ff5e5b36fbe47186b0894429ca17c5ee4712d23608
7
- data.tar.gz: 48d121d37b9ef6c46cf7807ec3341da4479e976c52a02ff92cb58962c3962c84fc3ed2ad7629d8b868538c747fb1f2df186a5f9b8b48e3234d292f91bc414a06
6
+ metadata.gz: 8d91a924736f66bb7fa33c7e2bfe1992023670ef270ded8b395b0b9d21beaac52fcddb7a0cb19c0929fa2aa69a82099c0b0cc93e0067b532be75189cf4b325be
7
+ data.tar.gz: b3b2042aaac7c0dca6076f9bac4ed59a4ca3ad44018a1af1ba106574dc30e03c72544d0e540b206929a00c052dd07bbc008fc02ce2036cf3bc8cbc92af9d4d67
data/appveyor.yml CHANGED
@@ -21,13 +21,13 @@ matrix:
21
21
  clone_depth: 5
22
22
 
23
23
  cache:
24
- - C:\Ruby193\lib\ruby\gems\1.9.1
25
- - C:\Ruby193\bin
26
- - C:\Ruby200\lib\ruby\gems\2.0.0
27
- - C:\Ruby200\bin
28
- - C:\Ruby21\lib\ruby\gems\2.1.0
29
- - C:\Ruby21\bin
30
- - C:\Ruby22\lib\ruby\gems\2.2.0
24
+ - C:\Ruby193\lib\ruby\gems\1.9.1 -> appveyor.yml
25
+ - C:\Ruby193\bin -> appveyor.yml
26
+ - C:\Ruby200\lib\ruby\gems\2.0.0 -> appveyor.yml
27
+ - C:\Ruby200\bin -> appveyor.yml
28
+ - C:\Ruby21\lib\ruby\gems\2.1.0 -> appveyor.yml
29
+ - C:\Ruby21\bin -> appveyor.yml
30
+ - C:\Ruby22\lib\ruby\gems\2.2.0 -> appveyor.yml
31
31
  - C:\Ruby22\bin
32
32
 
33
33
  install:
@@ -163,6 +163,9 @@ require 'specinfra/command/debian/base/service'
163
163
  require 'specinfra/command/debian/v8'
164
164
  require 'specinfra/command/debian/v8/service'
165
165
 
166
+ # Raspbian (inherit Debian)
167
+ require 'specinfra/command/raspbian'
168
+
166
169
  # Ubuntu (inherit Debian)
167
170
  require 'specinfra/command/ubuntu'
168
171
  require 'specinfra/command/ubuntu/base'
@@ -1,8 +1,11 @@
1
1
  class Specinfra::Command::Base::MailAlias < Specinfra::Command::Base
2
2
  class << self
3
3
  def check_is_aliased_to(mail_alias, recipient)
4
- recipient = "[[:space:]]([\"']?)#{recipient}\\1"
5
- "getent aliases #{escape(mail_alias)} | egrep -- #{escape(recipient)}$"
4
+ ## if the recipient contains pipes escape them
5
+ ## or egrep will interpret it as an OR
6
+ recipient = recipient.gsub(/\|/, '\|')
7
+ recipient = "[[:space:]]([\"']?)#{recipient}\\1(,|$)"
8
+ "getent aliases #{escape(mail_alias)} | egrep -- #{escape(recipient)}"
6
9
  end
7
10
 
8
11
  def add(mail_alias, recipient)
@@ -32,5 +32,10 @@ class Specinfra::Command::Linux::Base::Inventory < Specinfra::Command::Base::Inv
32
32
  block_device_dirs = '/sys/block/*/{size,removable,device/{model,rev,state,timeout,vendor},queue/rotational}'
33
33
  "for f in $(ls #{block_device_dirs}); do echo -e \"${f}\t$(cat ${f})\"; done"
34
34
  end
35
+
36
+ def get_system_product_name
37
+ "dmidecode -s system-product-name"
38
+ end
39
+
35
40
  end
36
41
  end
@@ -24,5 +24,10 @@ class Specinfra::Command::Openbsd::Base::Inventory < Specinfra::Command::Base::I
24
24
  def get_filesystem
25
25
  'df -kP'
26
26
  end
27
+
28
+ def get_system_product_name
29
+ 'sysctl -n hw.product'
30
+ end
31
+
27
32
  end
28
33
  end
@@ -1,7 +1,8 @@
1
1
  class Specinfra::Command::Openbsd::Base::MailAlias < Specinfra::Command::Base::MailAlias
2
2
  class << self
3
3
  def check_is_aliased_to(recipient, target)
4
- "egrep '^#{escape(recipient)}:.*#{escape(target)}' /etc/mail/aliases"
4
+ target = %Q{([[:space:]]|,)["']?#{escape(target)}["']?(,|$)}
5
+ "egrep ^#{escape(recipient)}:.*#{escape(target)} /etc/mail/aliases"
5
6
  end
6
7
  end
7
8
  end
@@ -0,0 +1 @@
1
+ class Specinfra::Command::Raspbian < Specinfra::Command::Debian; end
@@ -33,5 +33,10 @@ class Specinfra::Command::Solaris::Base::Inventory < Specinfra::Command::Base::I
33
33
  # e.g. swap0, swap1 and so on.
34
34
  %Q{df -k | nawk -v i=0 '$1 == "swap" { $1=$1i; i++ }; NF == 1 { printf($1); next }; { print }'}
35
35
  end
36
+
37
+ def get_system_product_name
38
+ "prtdiag | grep 'System Configuration'"
39
+ end
40
+
36
41
  end
37
42
  end
@@ -29,7 +29,7 @@ module Specinfra
29
29
  end
30
30
 
31
31
  # Define os method explicitly to avoid stack level
32
- # too deep caused by Helpet::DetectOS#os
32
+ # too deep caused by Helper::DetectOS#os
33
33
  def os(value=nil)
34
34
  @os = value if value
35
35
  if @os.nil? && defined?(RSpec) && RSpec.configuration.respond_to?(:os)
@@ -5,6 +5,8 @@ class Specinfra::Helper::DetectOs::Solaris < Specinfra::Helper::DetectOs
5
5
  { :family => 'solaris', :release => 10 }
6
6
  elsif run_command('grep -q "Oracle Solaris 11" /etc/release').success?
7
7
  { :family => 'solaris', :release => 11 }
8
+ elsif run_command('grep -q "OpenIndiana" /etc/release').success?
9
+ { :family => 'solaris', :release => 11 }
8
10
  elsif run_command('grep -q SmartOS /etc/release').success?
9
11
  { :family => 'smartos', :release => nil }
10
12
  else
@@ -3,37 +3,43 @@ module Specinfra
3
3
  class Virtualization < Base
4
4
  def get
5
5
  res = {}
6
+ ## docker
6
7
  if backend.run_command('ls /.dockerinit').success?
7
8
  res[:system] = 'docker'
8
9
  return res
9
10
  end
10
11
 
11
- if backend.run_command('ls /usr/sbin/dmidecode').success?
12
- ret = backend.run_command('dmidecode')
13
- if ret.exit_status == 0
14
- case ret.stdout
15
- when /Manufacturer: VMware/
16
- if ret.stdout =~ /Product Name: VMware Virtual Platform/
17
- res[:system] = 'vmware'
18
- end
19
- when /Manufacturer: Oracle Corporation/
20
- if ret.stdout =~ /Product Name: VirtualBox/
21
- res[:system] = 'vbox'
22
- end
23
- when /Product Name: KVM/
24
- res[:system] = 'kvm'
25
- when /Product Name: OpenStack/
26
- res[:system] = 'openstack'
27
- else
28
- nil
29
- end
12
+ ## OpenVZ on Linux
13
+ if backend.run_command('test -d /proc/vz -a ! -d /proc/bc').success?
14
+ res[:system] = 'openvz'
15
+ return res
16
+ end
17
+
18
+ cmd = backend.command.get(:get_inventory_system_product_name)
19
+ ret = backend.run_command(cmd)
20
+ if ret.exit_status == 0
21
+ res[:system] = parse_system_product_name(ret.stdout)
22
+ end
23
+
24
+ res
25
+ end
26
+
27
+ def parse_system_product_name(ret)
28
+ product_name = case ret
29
+ when /.*VMware Virtual Platform/
30
+ 'vmware'
31
+ when /.*VirtualBox/
32
+ 'vbox'
33
+ when /.*KVM/
34
+ 'kvm'
35
+ when /.*OpenStack/
36
+ 'openstack'
30
37
  else
31
38
  nil
32
- end
33
39
  end
34
-
35
- res
40
+ product_name
36
41
  end
42
+
37
43
  end
38
44
  end
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.43.11"
2
+ VERSION = "2.44.0"
3
3
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => nil }
4
+
5
+ describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony') do
6
+ it do
7
+ should eq %Q{getent aliases pink | } +
8
+ %Q{egrep -- \\\[\\\[:space:\\\]\\\]\\\(\\\[\\\"\\'\\\]\\?\\)\\\\\\|/pony\\\\1\\\(,\\\|\\\$\\\)}
9
+ end
10
+ end
11
+
12
+ describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony, |/unicorn') do
13
+ it do
14
+ should eq %Q{getent aliases pink | } +
15
+ %Q{egrep -- \\\[\\\[:space:\\\]\\\]\\\(\\\[\\\"\\'\\\]\\?\\)\\\\\\|/pony,\\\ \\\\\\|/unicorn\\\\1\\\(,\\\|\\\$\\\)}
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'openbsd' }
4
+
5
+ describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony') do
6
+ it do
7
+ should eq %Q{egrep ^pink:.*\\(\\[\\[:space:\\]\\]\\|,\\)\\[\\\"\\'\\]\\?} +
8
+ %Q{\\\\\\|/pony\\[\\\"\\'\\]\\?\\(,\\|\\$\\) } +
9
+ %Q{/etc/mail/aliases}
10
+ end
11
+ end
12
+
13
+ describe get_command(:check_mail_alias_is_aliased_to, 'pink', '|/pony, |/unicorn') do
14
+ it do
15
+ should eq %Q{egrep ^pink:.*\\(\\[\\[:space:\\]\\]\\|,\\)\\[\\\"\\'\\]\\?} +
16
+ %Q{\\\\\\|/pony,\\\\\\ \\\\\\|/unicorn\\[\\\"\\'\\]\\?\\(,\\|\\$\\) } +
17
+ %Q{/etc/mail/aliases}
18
+ end
19
+ end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'linux' }
4
+
5
+ describe Specinfra::HostInventory::Virtualization do
6
+ virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
7
+ let(:host_inventory) { nil }
8
+ it 'Docker Image should return :system => "docker"' do
9
+ allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
10
+ CommandResult.new(:stdout => '/.dockerinit', :exit_status => 0)
11
+ end
12
+ expect(virt.get).to include(:system => 'docker')
13
+ end
14
+
15
+ let(:host_inventory) { nil }
16
+ it 'Debian Wheezy on OpenVZ should return :system => "openvz"' do
17
+ allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
18
+ CommandResult.new(:stdout => '', :exit_status => 2)
19
+ end
20
+ allow(virt.backend).to receive(:run_command).with('test -d /proc/vz -a ! -d /proc/bc') do
21
+ CommandResult.new(:stdout => '', :exit_status => 0)
22
+ end
23
+ expect(virt.get).to include(:system => 'openvz')
24
+ end
25
+
26
+ let(:host_inventory) { nil }
27
+ it 'Debian Jessie on KVM should return :system => "kvm"' do
28
+ ret = virt.parse_system_product_name("KVM\n")
29
+ expect(ret).to include('kvm')
30
+ end
31
+
32
+ let(:host_inventory) { nil }
33
+ it 'CentOS 6.7 on VMware should return :system => "vmware"' do
34
+ ret = virt.parse_system_product_name("VMware Virtual Platform\n")
35
+ expect(ret).to include('vmware')
36
+ end
37
+
38
+ let(:host_inventory) { nil }
39
+ it 'Ubuntu 14.04 on VirtualBox should return :system => "vbox"' do
40
+ ret = virt.parse_system_product_name("VirtualBox\n")
41
+ expect(ret).to include('vbox')
42
+ end
43
+
44
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'openbsd' }
4
+
5
+ describe Specinfra::HostInventory::Virtualization do
6
+ virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
7
+
8
+ let(:host_inventory) { nil }
9
+ it 'OpenBSD 5.7 on KVM should return :system => "kvm"' do
10
+ ret = virt.parse_system_product_name("KVM\n")
11
+ expect(ret).to include('kvm')
12
+ end
13
+
14
+ let(:host_inventory) { nil }
15
+ it 'OpenBSD 5.7 on VMware should return :system => "vmware"' do
16
+ ret = virt.parse_system_product_name("VMware Virtual Platform\n")
17
+ expect(ret).to include('vmware')
18
+ end
19
+
20
+ let(:host_inventory) { nil }
21
+ it 'OpenBSD 5.7 on VirtualBox should return :system => "vbox"' do
22
+ ret = virt.parse_system_product_name("VirtualBox\n")
23
+ expect(ret).to include('vbox')
24
+ end
25
+
26
+
27
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ set :os, { :family => 'solaris' }
4
+
5
+ describe Specinfra::HostInventory::Virtualization do
6
+ virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
7
+
8
+ let(:host_inventory) { nil }
9
+ it 'OpenIndiana on KVM should return :system => "kvm"' do
10
+ ret = virt.parse_system_product_name("System Configuration: Red Hat KVM")
11
+ expect(ret).to include('kvm')
12
+ end
13
+
14
+ let(:host_inventory) { nil }
15
+ it 'OpenIndiana on VMware should return :system => "vmware"' do
16
+ ret = virt.parse_system_product_name("System Configuration: VMware, Inc. VMware Virtual Platform\n")
17
+ expect(ret).to include('vmware')
18
+ end
19
+
20
+ let(:host_inventory) { nil }
21
+ it 'OpenIndiana on VirtualBox should return :system => "vbox"' do
22
+ ret = virt.parse_system_product_name("System Configuration: innotek GmbH VirtualBox\n")
23
+ expect(ret).to include('vbox')
24
+ end
25
+
26
+ end
27
+
28
+
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.43.11
4
+ version: 2.44.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: 2015-10-03 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -336,6 +336,7 @@ files:
336
336
  - lib/specinfra/command/poky/base/inventory.rb
337
337
  - lib/specinfra/command/poky/base/package.rb
338
338
  - lib/specinfra/command/poky/base/service.rb
339
+ - lib/specinfra/command/raspbian.rb
339
340
  - lib/specinfra/command/redhat.rb
340
341
  - lib/specinfra/command/redhat/base.rb
341
342
  - lib/specinfra/command/redhat/base/file.rb
@@ -466,6 +467,7 @@ files:
466
467
  - spec/command/base/group_spec.rb
467
468
  - spec/command/base/host_spec.rb
468
469
  - spec/command/base/localhost_spec.rb
470
+ - spec/command/base/mail_alias.rb
469
471
  - spec/command/base/package_spec.rb
470
472
  - spec/command/base/user_spec.rb
471
473
  - spec/command/darwin/file_spec.rb
@@ -496,6 +498,7 @@ files:
496
498
  - spec/command/openbsd/file_spec.rb
497
499
  - spec/command/openbsd/host_spec.rb
498
500
  - spec/command/openbsd/interface_spec.rb
501
+ - spec/command/openbsd/mail_alias_spec.rb
499
502
  - spec/command/openbsd/service_spec.rb
500
503
  - spec/command/openbsd57/service_spec.rb
501
504
  - spec/command/redhat/package_spec.rb
@@ -523,10 +526,11 @@ files:
523
526
  - spec/host_inventory/linux/filesystem_spec.rb
524
527
  - spec/host_inventory/linux/kernel_spec.rb
525
528
  - spec/host_inventory/linux/memory_spec.rb
526
- - spec/host_inventory/linux/virtualization_docker_spec.rb
527
- - spec/host_inventory/linux/virtualization_kvm_spec.rb
529
+ - spec/host_inventory/linux/virtualization_spec.rb
528
530
  - spec/host_inventory/openbsd/filesystem_spec.rb
531
+ - spec/host_inventory/openbsd/virtualization_spec.rb
529
532
  - spec/host_inventory/solaris/filesystem_spec.rb
533
+ - spec/host_inventory/solaris/virtualization_spec.rb
530
534
  - spec/spec_helper.rb
531
535
  - specinfra.gemspec
532
536
  homepage: ''
@@ -567,6 +571,7 @@ test_files:
567
571
  - spec/command/base/group_spec.rb
568
572
  - spec/command/base/host_spec.rb
569
573
  - spec/command/base/localhost_spec.rb
574
+ - spec/command/base/mail_alias.rb
570
575
  - spec/command/base/package_spec.rb
571
576
  - spec/command/base/user_spec.rb
572
577
  - spec/command/darwin/file_spec.rb
@@ -597,6 +602,7 @@ test_files:
597
602
  - spec/command/openbsd/file_spec.rb
598
603
  - spec/command/openbsd/host_spec.rb
599
604
  - spec/command/openbsd/interface_spec.rb
605
+ - spec/command/openbsd/mail_alias_spec.rb
600
606
  - spec/command/openbsd/service_spec.rb
601
607
  - spec/command/openbsd57/service_spec.rb
602
608
  - spec/command/redhat/package_spec.rb
@@ -624,8 +630,10 @@ test_files:
624
630
  - spec/host_inventory/linux/filesystem_spec.rb
625
631
  - spec/host_inventory/linux/kernel_spec.rb
626
632
  - spec/host_inventory/linux/memory_spec.rb
627
- - spec/host_inventory/linux/virtualization_docker_spec.rb
628
- - spec/host_inventory/linux/virtualization_kvm_spec.rb
633
+ - spec/host_inventory/linux/virtualization_spec.rb
629
634
  - spec/host_inventory/openbsd/filesystem_spec.rb
635
+ - spec/host_inventory/openbsd/virtualization_spec.rb
630
636
  - spec/host_inventory/solaris/filesystem_spec.rb
637
+ - spec/host_inventory/solaris/virtualization_spec.rb
631
638
  - spec/spec_helper.rb
639
+ has_rdoc:
@@ -1,134 +0,0 @@
1
- require 'spec_helper'
2
-
3
- str = <<-EOH
4
- # dmidecode 2.12
5
- SMBIOS 2.4 present.
6
- 10 structures occupying 326 bytes.
7
- Table at 0x000F1EF0.
8
-
9
- Handle 0x0000, DMI type 0, 24 bytes
10
- BIOS Information
11
- Vendor: Seabios
12
- Version: 0.5.1
13
- Release Date: 01/01/2011
14
- Address: 0xE8000
15
- Runtime Size: 96 kB
16
- ROM Size: 64 kB
17
- Characteristics:
18
- BIOS characteristics not supported
19
- Targeted content distribution is supported
20
- BIOS Revision: 1.0
21
-
22
- Handle 0x0100, DMI type 1, 27 bytes
23
- System Information
24
- Manufacturer: Red Hat
25
- Product Name: KVM
26
- Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
27
- Serial Number: Not Specified
28
- UUID: 5E317344-67C8-42D1-BD62-8587C8532251
29
- Wake-up Type: Power Switch
30
- SKU Number: Not Specified
31
- Family: Red Hat Enterprise Linux
32
-
33
- Handle 0x0300, DMI type 3, 20 bytes
34
- Chassis Information
35
- Manufacturer: Bochs
36
- Type: Other
37
- Lock: Not Present
38
- Version: Not Specified
39
- Serial Number: Not Specified
40
- Asset Tag: Not Specified
41
- Boot-up State: Safe
42
- Power Supply State: Safe
43
- Thermal State: Safe
44
- Security Status: Unknown
45
- OEM Information: 0x00000000
46
- Height: Unspecified
47
- Number Of Power Cords: Unspecified
48
-
49
- Handle 0x0401, DMI type 4, 32 bytes
50
- Processor Information
51
- Socket Designation: CPU 1
52
- Type: Central Processor
53
- Family: Other
54
- Manufacturer: Bochs
55
- ID: D3 06 00 00 FD FB 8B 07
56
- Version: Not Specified
57
- Voltage: Unknown
58
- External Clock: Unknown
59
- Max Speed: 2000 MHz
60
- Current Speed: 2000 MHz
61
- Status: Populated, Enabled
62
- Upgrade: Other
63
- L1 Cache Handle: Not Provided
64
- L2 Cache Handle: Not Provided
65
- L3 Cache Handle: Not Provided
66
-
67
- Handle 0x1000, DMI type 16, 15 bytes
68
- Physical Memory Array
69
- Location: Other
70
- Use: System Memory
71
- Error Correction Type: Multi-bit ECC
72
- Maximum Capacity: 512 MB
73
- Error Information Handle: Not Provided
74
- Number Of Devices: 1
75
-
76
- Handle 0x1100, DMI type 17, 21 bytes
77
- Memory Device
78
- Array Handle: 0x1000
79
- Error Information Handle: 0x0000
80
- Total Width: 64 bits
81
- Data Width: 64 bits
82
- Size: 512 MB
83
- Form Factor: DIMM
84
- Set: None
85
- Locator: DIMM 0
86
- Bank Locator: Not Specified
87
- Type: RAM
88
- Type Detail: None
89
-
90
- Handle 0x1300, DMI type 19, 15 bytes
91
- Memory Array Mapped Address
92
- Starting Address: 0x00000000000
93
- Ending Address: 0x0001FFFFFFF
94
- Range Size: 512 MB
95
- Physical Array Handle: 0x1000
96
- Partition Width: 1
97
-
98
- Handle 0x1400, DMI type 20, 19 bytes
99
- Memory Device Mapped Address
100
- Starting Address: 0x00000000000
101
- Ending Address: 0x0001FFFFFFF
102
- Range Size: 512 MB
103
- Physical Device Handle: 0x1100
104
- Memory Array Mapped Address Handle: 0x1300
105
- Partition Row Position: 1
106
-
107
- Handle 0x2000, DMI type 32, 11 bytes
108
- System Boot Information
109
- Status: No errors detected
110
-
111
- Handle 0x7F00, DMI type 127, 4 bytes
112
- End Of Table
113
- EOH
114
-
115
- describe Specinfra::HostInventory::Virtualization do
116
- virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
117
- let(:host_inventory) { nil }
118
- it 'Docker Image should return :system => "docker"' do
119
- allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
120
- CommandResult.new(:stdout => '/.dockerinit', :exit_status => 0)
121
- end
122
- # although there is most likely no dmidecode on a docker image
123
- # this is to make sure the code is only reporting docker
124
- allow(virt.backend).to receive(:run_command).with('ls /usr/sbin/dmidecode') do
125
- CommandResult.new(:stdout => '/usr/sbin/dmidecode', :exit_status => 0)
126
- end
127
- allow(virt.backend).to receive(:run_command).with('dmidecode') do
128
- CommandResult.new(:stdout => str, :exit_status => 0)
129
- end
130
- expect(virt.get).to include(
131
- :system => 'docker'
132
- )
133
- end
134
- end
@@ -1,132 +0,0 @@
1
- require 'spec_helper'
2
-
3
- str = <<-EOH
4
- # dmidecode 2.12
5
- SMBIOS 2.4 present.
6
- 10 structures occupying 326 bytes.
7
- Table at 0x000F1EF0.
8
-
9
- Handle 0x0000, DMI type 0, 24 bytes
10
- BIOS Information
11
- Vendor: Seabios
12
- Version: 0.5.1
13
- Release Date: 01/01/2011
14
- Address: 0xE8000
15
- Runtime Size: 96 kB
16
- ROM Size: 64 kB
17
- Characteristics:
18
- BIOS characteristics not supported
19
- Targeted content distribution is supported
20
- BIOS Revision: 1.0
21
-
22
- Handle 0x0100, DMI type 1, 27 bytes
23
- System Information
24
- Manufacturer: Red Hat
25
- Product Name: KVM
26
- Version: RHEL 7.0.0 PC (i440FX + PIIX, 1996)
27
- Serial Number: Not Specified
28
- UUID: 5E317344-67C8-42D1-BD62-8587C8532251
29
- Wake-up Type: Power Switch
30
- SKU Number: Not Specified
31
- Family: Red Hat Enterprise Linux
32
-
33
- Handle 0x0300, DMI type 3, 20 bytes
34
- Chassis Information
35
- Manufacturer: Bochs
36
- Type: Other
37
- Lock: Not Present
38
- Version: Not Specified
39
- Serial Number: Not Specified
40
- Asset Tag: Not Specified
41
- Boot-up State: Safe
42
- Power Supply State: Safe
43
- Thermal State: Safe
44
- Security Status: Unknown
45
- OEM Information: 0x00000000
46
- Height: Unspecified
47
- Number Of Power Cords: Unspecified
48
-
49
- Handle 0x0401, DMI type 4, 32 bytes
50
- Processor Information
51
- Socket Designation: CPU 1
52
- Type: Central Processor
53
- Family: Other
54
- Manufacturer: Bochs
55
- ID: D3 06 00 00 FD FB 8B 07
56
- Version: Not Specified
57
- Voltage: Unknown
58
- External Clock: Unknown
59
- Max Speed: 2000 MHz
60
- Current Speed: 2000 MHz
61
- Status: Populated, Enabled
62
- Upgrade: Other
63
- L1 Cache Handle: Not Provided
64
- L2 Cache Handle: Not Provided
65
- L3 Cache Handle: Not Provided
66
-
67
- Handle 0x1000, DMI type 16, 15 bytes
68
- Physical Memory Array
69
- Location: Other
70
- Use: System Memory
71
- Error Correction Type: Multi-bit ECC
72
- Maximum Capacity: 512 MB
73
- Error Information Handle: Not Provided
74
- Number Of Devices: 1
75
-
76
- Handle 0x1100, DMI type 17, 21 bytes
77
- Memory Device
78
- Array Handle: 0x1000
79
- Error Information Handle: 0x0000
80
- Total Width: 64 bits
81
- Data Width: 64 bits
82
- Size: 512 MB
83
- Form Factor: DIMM
84
- Set: None
85
- Locator: DIMM 0
86
- Bank Locator: Not Specified
87
- Type: RAM
88
- Type Detail: None
89
-
90
- Handle 0x1300, DMI type 19, 15 bytes
91
- Memory Array Mapped Address
92
- Starting Address: 0x00000000000
93
- Ending Address: 0x0001FFFFFFF
94
- Range Size: 512 MB
95
- Physical Array Handle: 0x1000
96
- Partition Width: 1
97
-
98
- Handle 0x1400, DMI type 20, 19 bytes
99
- Memory Device Mapped Address
100
- Starting Address: 0x00000000000
101
- Ending Address: 0x0001FFFFFFF
102
- Range Size: 512 MB
103
- Physical Device Handle: 0x1100
104
- Memory Array Mapped Address Handle: 0x1300
105
- Partition Row Position: 1
106
-
107
- Handle 0x2000, DMI type 32, 11 bytes
108
- System Boot Information
109
- Status: No errors detected
110
-
111
- Handle 0x7F00, DMI type 127, 4 bytes
112
- End Of Table
113
- EOH
114
-
115
- describe Specinfra::HostInventory::Virtualization do
116
- virt = Specinfra::HostInventory::Virtualization.new(host_inventory)
117
- let(:host_inventory) { nil }
118
- it 'Debian Jessie on KVM should return :system => "kvm"' do
119
- allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
120
- CommandResult.new(:stdout => '', :exit_status => 2)
121
- end
122
- allow(virt.backend).to receive(:run_command).with('ls /usr/sbin/dmidecode') do
123
- CommandResult.new(:stdout => '/usr/sbin/dmidecode', :exit_status => 0)
124
- end
125
- allow(virt.backend).to receive(:run_command).with('dmidecode') do
126
- CommandResult.new(:stdout => str, :exit_status => 0)
127
- end
128
- expect(virt.get).to include(
129
- :system => 'kvm'
130
- )
131
- end
132
- end