serverspec 2.0.0.beta19 → 2.0.0.beta20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/WINDOWS_SUPPORT.md +9 -13
  3. data/lib/serverspec/helper/type.rb +7 -9
  4. data/lib/serverspec/helper.rb +0 -2
  5. data/lib/serverspec/setup.rb +11 -7
  6. data/lib/serverspec/type/base.rb +15 -17
  7. data/lib/serverspec/type/cgroup.rb +13 -16
  8. data/lib/serverspec/type/command.rb +14 -17
  9. data/lib/serverspec/type/cron.rb +8 -9
  10. data/lib/serverspec/type/default_gateway.rb +14 -16
  11. data/lib/serverspec/type/file.rb +76 -78
  12. data/lib/serverspec/type/group.rb +7 -9
  13. data/lib/serverspec/type/host.rb +10 -12
  14. data/lib/serverspec/type/iis_app_pool.rb +40 -42
  15. data/lib/serverspec/type/iis_website.rb +28 -31
  16. data/lib/serverspec/type/interface.rb +10 -12
  17. data/lib/serverspec/type/ipfilter.rb +7 -9
  18. data/lib/serverspec/type/ipnat.rb +7 -9
  19. data/lib/serverspec/type/iptables.rb +7 -9
  20. data/lib/serverspec/type/kernel_module.rb +4 -6
  21. data/lib/serverspec/type/linux_kernel_parameter.rb +7 -9
  22. data/lib/serverspec/type/lxc.rb +10 -12
  23. data/lib/serverspec/type/mail_alias.rb +4 -6
  24. data/lib/serverspec/type/package.rb +48 -50
  25. data/lib/serverspec/type/php_config.rb +7 -9
  26. data/lib/serverspec/type/port.rb +28 -30
  27. data/lib/serverspec/type/ppa.rb +7 -9
  28. data/lib/serverspec/type/process.rb +20 -22
  29. data/lib/serverspec/type/routing_table.rb +7 -9
  30. data/lib/serverspec/type/selinux.rb +13 -17
  31. data/lib/serverspec/type/service.rb +24 -26
  32. data/lib/serverspec/type/user.rb +22 -30
  33. data/lib/serverspec/type/windows_feature.rb +4 -6
  34. data/lib/serverspec/type/windows_hot_fix.rb +4 -6
  35. data/lib/serverspec/type/windows_registry_key.rb +13 -15
  36. data/lib/serverspec/type/windows_scheduled_task.rb +4 -6
  37. data/lib/serverspec/type/yumrepo.rb +7 -9
  38. data/lib/serverspec/type/zfs.rb +10 -12
  39. data/lib/serverspec/version.rb +1 -1
  40. data/lib/serverspec.rb +2 -1
  41. data/spec/spec_helper.rb +2 -3
  42. data/spec/type/aix/group_spec.rb +0 -4
  43. data/spec/type/aix/package_spec.rb +0 -4
  44. data/spec/type/aix/port_spec.rb +12 -25
  45. data/spec/type/aix/service_spec.rb +0 -7
  46. data/spec/type/aix/user_spec.rb +0 -12
  47. data/spec/type/arch/file_spec.rb +0 -13
  48. data/spec/type/arch/package_spec.rb +0 -10
  49. data/spec/type/base/cron_spec.rb +0 -8
  50. data/spec/type/base/file_spec.rb +0 -53
  51. data/spec/type/base/group_spec.rb +0 -8
  52. data/spec/type/base/host_spec.rb +0 -20
  53. data/spec/type/base/mail_alias_spec.rb +0 -4
  54. data/spec/type/base/package_spec.rb +10 -38
  55. data/spec/type/base/port_spec.rb +19 -18
  56. data/spec/type/base/service_spec.rb +4 -29
  57. data/spec/type/base/user_spec.rb +0 -24
  58. data/spec/type/darwin/package_spec.rb +0 -8
  59. data/spec/type/darwin/port_spec.rb +17 -23
  60. data/spec/type/darwin/service_spec.rb +0 -12
  61. data/spec/type/debian/package_spec.rb +0 -12
  62. data/spec/type/debian/service_spec.rb +0 -8
  63. data/spec/type/freebsd/file_spec.rb +0 -16
  64. data/spec/type/freebsd/package_spec.rb +0 -8
  65. data/spec/type/freebsd/port_spec.rb +17 -23
  66. data/spec/type/freebsd/service_spec.rb +0 -4
  67. data/spec/type/freebsd10/package_spec.rb +0 -8
  68. data/spec/type/gentoo/package_spec.rb +0 -5
  69. data/spec/type/gentoo/service_spec.rb +0 -8
  70. data/spec/type/linux/file_spec.rb +0 -13
  71. data/spec/type/linux/iptables_spec.rb +0 -8
  72. data/spec/type/linux/kernel_module_spec.rb +0 -4
  73. data/spec/type/linux/lxc_container_spec.rb +0 -8
  74. data/spec/type/nixos/package_spec.rb +0 -12
  75. data/spec/type/openbsd/file_spec.rb +0 -30
  76. data/spec/type/openbsd/mail_alias_spec.rb +0 -4
  77. data/spec/type/openbsd/package_spec.rb +0 -9
  78. data/spec/type/openbsd/service_spec.rb +0 -7
  79. data/spec/type/openbsd/user_spec.rb +0 -8
  80. data/spec/type/opensuse/service_spec.rb +0 -12
  81. data/spec/type/plamo/package_spec.rb +0 -4
  82. data/spec/type/plamo/service_spec.rb +0 -4
  83. data/spec/type/redhat/file_spec.rb +0 -13
  84. data/spec/type/redhat/package_spec.rb +0 -12
  85. data/spec/type/redhat/service_spec.rb +0 -8
  86. data/spec/type/redhat/yumrepo_spec.rb +5 -19
  87. data/spec/type/redhat5/iptables_spec.rb +0 -8
  88. data/spec/type/smartos/package_spec.rb +0 -8
  89. data/spec/type/smartos/service_spec.rb +0 -12
  90. data/spec/type/solaris/cron_spec.rb +0 -8
  91. data/spec/type/solaris/file_spec.rb +0 -14
  92. data/spec/type/solaris/group_spec.rb +0 -4
  93. data/spec/type/solaris/host_spec.rb +3 -11
  94. data/spec/type/solaris/package_spec.rb +0 -4
  95. data/spec/type/solaris/port_spec.rb +23 -22
  96. data/spec/type/solaris/service_spec.rb +0 -12
  97. data/spec/type/solaris/user_spec.rb +0 -12
  98. data/spec/type/solaris10/file_spec.rb +0 -58
  99. data/spec/type/solaris10/group_spec.rb +0 -4
  100. data/spec/type/solaris10/host_spec.rb +2 -6
  101. data/spec/type/solaris10/package_spec.rb +0 -3
  102. data/spec/type/solaris10/user_spec.rb +0 -4
  103. data/spec/type/suse/package_spec.rb +0 -12
  104. data/spec/type/suse/service_spec.rb +0 -8
  105. data/spec/type/ubuntu/ppa_spec.rb +0 -8
  106. data/spec/type/ubuntu/service_spec.rb +0 -4
  107. data/spec/type/windows/feature_spec.rb +8 -0
  108. data/spec/type/windows/file_spec.rb +0 -36
  109. data/spec/type/windows/group_spec.rb +0 -4
  110. data/spec/type/windows/host_spec.rb +0 -20
  111. data/spec/type/windows/port_spec.rb +0 -4
  112. data/spec/type/windows/service_spec.rb +0 -8
  113. data/spec/type/windows/user_spec.rb +0 -8
  114. metadata +2 -5
  115. data/lib/serverspec/helper/properties.rb +0 -9
  116. data/spec/helper/properties_spec.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34bfc818daa6085b0fa154fe2228c9b5cd51b7ce
4
- data.tar.gz: dbf6210c50fd26d4d9131114eb3784952c2f4cbf
3
+ metadata.gz: 9f5c21f68d3a593ac38c66936009b9b391d05981
4
+ data.tar.gz: b56991bd56276db1d0bfedc54117f8ad7edc12e2
5
5
  SHA512:
6
- metadata.gz: 7a30443127f10a9c7c340380ea636be0c6faff0ed8d67e230292c6f64ce85ca84c633dbaa3a2f833792900929c278b177415abb8618aa780fd6c9b7b81910e01
7
- data.tar.gz: 149c7b4759356c918a0abcc9943f3af70c743e25e370b63072ed988fc60e5c515255f87736df15ae787cd3fd163b1ad0d7d84832e07679b5759b9256ed7296c0
6
+ metadata.gz: a2d6724aa264a39827d3533c71f79aa3f5c90ff67ecbffd7dcc79d57e54951a41a0fd0df6e2fce7a6c12cd9f88002c997ff58443dda6e07b5ca7ca6d180e550e
7
+ data.tar.gz: 8c74196779ee1f396a9ae8c215aa4cdf2b6d56ab276460ccb08ace4a03f2a932d730465c41a77644b66b55af202a3389b3ef77ff00db3908c92cddde29700eee
data/WINDOWS_SUPPORT.md CHANGED
@@ -9,9 +9,7 @@ For local testing (equivalent to the Exec option in Linux/Unix systems) simply d
9
9
  ```ruby
10
10
  require 'serverspec'
11
11
 
12
- include Serverspec::Helper::Cmd
13
- include Serverspec::Helper::Windows
14
-
12
+ set :backend, :cmd
15
13
  ```
16
14
 
17
15
  For remote testing you have to configure Windows Remote Management in order to communicate to the target host:
@@ -20,17 +18,15 @@ For remote testing you have to configure Windows Remote Management in order to c
20
18
  require 'serverspec'
21
19
  require 'winrm'
22
20
 
23
- include Serverspec::Helper::WinRM
24
- include Serverspec::Helper::Windows
21
+ set :backend, :winrm
25
22
 
26
- RSpec.configure do |c|
27
- user = <username>
28
- pass = <password>
29
- endpoint = "http://<hostname>:5985/wsman"
30
-
31
- c.winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
32
- c.winrm.set_timeout 300 # 5 minutes max timeout for any operation
33
- end
23
+ user = <username>
24
+ pass = <password>
25
+ endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
26
+
27
+ winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
28
+ winrm.set_timeout 300 # 5 minutes max timeout for any operation
29
+ Specinfra.configuration.winrm = winrm
34
30
  ```
35
31
 
36
32
  For how to configure the guest to accept WinRM connections and the different authentication mechanisms check the Microsoft WinRM documentation and verify the ones that are supported by [WinRb/WinRM](https://github.com/WinRb/WinRM).
@@ -2,10 +2,12 @@ module Serverspec
2
2
  module Helper
3
3
  module Type
4
4
  types = %w(
5
- base cgroup command cron default_gateway file group host iis_website iis_app_pool interface
6
- ipfilter ipnat iptables kernel_module linux_kernel_parameter lxc mail_alias
7
- package php_config port ppa process routing_table selinux service user yumrepo
8
- windows_feature windows_hot_fix windows_registry_key windows_scheduled_task zfs
5
+ base cgroup command cron default_gateway file group host
6
+ iis_website iis_app_pool interface ipfilter ipnat iptables
7
+ kernel_module linux_kernel_parameter lxc mail_alias package
8
+ php_config port ppa process routing_table selinux service user
9
+ yumrepo windows_feature windows_hot_fix windows_registry_key
10
+ windows_scheduled_task zfs
9
11
  )
10
12
 
11
13
  types.each {|type| require "serverspec/type/#{type}" }
@@ -13,13 +15,9 @@ module Serverspec
13
15
  types.each do |type|
14
16
  define_method type do |*args|
15
17
  name = args.first
16
- self.class.const_get('Serverspec').const_get('Type').const_get(camelize(type)).new(name)
18
+ eval "Serverspec::Type::#{type.to_camel_case}.new(name)"
17
19
  end
18
20
  end
19
-
20
- def camelize(string)
21
- string.split("_").each {|s| s.capitalize! }.join("")
22
- end
23
21
  end
24
22
  end
25
23
  end
@@ -6,5 +6,3 @@ class RSpec::Core::ExampleGroup
6
6
  include Serverspec::Helper::Type
7
7
  end
8
8
 
9
- require 'serverspec/helper/properties'
10
-
@@ -23,14 +23,17 @@ module Serverspec
23
23
  if auto_config =~ (/(true|t|yes|y|1)$/i)
24
24
  auto_vagrant_configuration
25
25
  else
26
- print("Input vagrant instance name: ")
26
+ print('Input vagrant instance name: ')
27
27
  @hostname = $stdin.gets.chomp
28
28
  end
29
29
  else
30
30
  @vagrant = false
31
- print("Input target host name: ")
31
+ print('Input target host name: ')
32
32
  @hostname = $stdin.gets.chomp
33
33
  end
34
+ elsif @backend_type == 'winrm'
35
+ print('Input target host name: ')
36
+ @hostname = $stdin.gets.chomp
34
37
  else
35
38
  @hostname = 'localhost'
36
39
  end
@@ -287,21 +290,22 @@ set :ssh_options, options
287
290
  # Disable sudo
288
291
  # set :disable_sudo, true
289
292
  <%- end -%>
290
- <%- end -%>
293
+
291
294
 
292
295
  # Set environment variables
293
296
  # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
294
297
 
295
298
  # Set PATH
296
299
  # set :path, '/sbin:/usr/local/sbin:$PATH'
297
-
300
+ <%- end -%>
298
301
  <% if @backend_type == 'winrm'-%>
299
302
  user = <username>
300
303
  pass = <password>
301
- endpoint = "http://<hostname>:5985/wsman"
304
+ endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
302
305
 
303
- c.winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
304
- c.winrm.set_timeout 300 # 5 minutes max timeout for any operation
306
+ winrm = ::WinRM::WinRMWebService.new(endpoint, :ssl, :user => user, :pass => pass, :basic_auth_only => true)
307
+ winrm.set_timeout 300 # 5 minutes max timeout for any operation
308
+ Specinfra.configuration.winrm = winrm
305
309
  <% end -%>
306
310
  EOF
307
311
  template
@@ -1,23 +1,21 @@
1
- module Serverspec
2
- module Type
3
- class Base
4
- def initialize(name=nil)
5
- @name = name
6
- @runner = Specinfra::Runner
7
- end
1
+ module Serverspec::Type
2
+ class Base
3
+ def initialize(name=nil)
4
+ @name = name
5
+ @runner = Specinfra::Runner
6
+ end
8
7
 
9
- def to_s
10
- type = self.class.name.split(':')[-1]
11
- type.gsub!(/([a-z\d])([A-Z])/, '\1 \2')
12
- type.capitalize!
13
- %Q!#{type} "#{@name}"!
14
- end
8
+ def to_s
9
+ type = self.class.name.split(':')[-1]
10
+ type.gsub!(/([a-z\d])([A-Z])/, '\1 \2')
11
+ type.capitalize!
12
+ %Q!#{type} "#{@name}"!
13
+ end
15
14
 
16
- alias_method :inspect, :to_s
15
+ alias_method :inspect, :to_s
17
16
 
18
- def to_ary
19
- to_s.split(" ")
20
- end
17
+ def to_ary
18
+ to_s.split(" ")
21
19
  end
22
20
  end
23
21
  end
@@ -1,19 +1,16 @@
1
- :q
2
- module Serverspec
3
- module Type
4
- class Cgroup < Base
5
- attr_accessor :subsystem
6
- def method_missing(meth)
7
- if @subsystem.nil?
8
- @subsystem = meth.to_s
9
- self
10
- else
11
- param = "#{@subsystem}.#{meth.to_s}"
12
- ret = @runner.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
13
- val = ret.stdout.strip
14
- val = val.to_i if val.match(/^\d+$/)
15
- val
16
- end
1
+ module Serverspec::Type
2
+ class Cgroup < Base
3
+ attr_accessor :subsystem
4
+ def method_missing(meth)
5
+ if @subsystem.nil?
6
+ @subsystem = meth.to_s
7
+ self
8
+ else
9
+ param = "#{@subsystem}.#{meth.to_s}"
10
+ ret = @runner.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
11
+ val = ret.stdout.strip
12
+ val = val.to_i if val.match(/^\d+$/)
13
+ val
17
14
  end
18
15
  end
19
16
  end
@@ -1,23 +1,20 @@
1
- module Serverspec
2
- module Type
3
- class Command < Base
4
- def stdout
5
- command_result.stdout
6
- end
7
-
8
- def stderr
9
- command_result.stderr
10
- end
1
+ module Serverspec::Type
2
+ class Command < Base
3
+ def stdout
4
+ command_result.stdout
5
+ end
11
6
 
12
- def exit_status
13
- command_result.exit_status.to_i
14
- end
7
+ def stderr
8
+ command_result.stderr
9
+ end
15
10
 
16
- private
11
+ def exit_status
12
+ command_result.exit_status.to_i
13
+ end
17
14
 
18
- def command_result()
19
- @command_result ||= @runner.run_command(@name)
20
- end
15
+ private
16
+ def command_result()
17
+ @command_result ||= @runner.run_command(@name)
21
18
  end
22
19
  end
23
20
  end
@@ -1,12 +1,11 @@
1
- module Serverspec
2
- module Type
3
- class Cron < Base
4
- def has_entry?(user, entry)
5
- @runner.check_cron_has_entry(user, entry)
6
- end
7
- def to_s
8
- 'Cron'
9
- end
1
+ module Serverspec::Type
2
+ class Cron < Base
3
+ def has_entry?(user, entry)
4
+ @runner.check_cron_has_entry(user, entry)
5
+ end
6
+
7
+ def to_s
8
+ 'Cron'
10
9
  end
11
10
  end
12
11
  end
@@ -1,21 +1,19 @@
1
- module Serverspec
2
- module Type
3
- class DefaultGateway < Base
4
- def ipaddress
5
- ret = @runner.get_routing_table_entry(:destination => 'default')
6
- ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
7
- $2 ? $2 : $4
8
- end
1
+ module Serverspec::Type
2
+ class DefaultGateway < Base
3
+ def ipaddress
4
+ ret = @runner.get_routing_table_entry(:destination => 'default')
5
+ ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
6
+ $2 ? $2 : $4
7
+ end
9
8
 
10
- def interface
11
- ret = @runner.get_routing_table_entry(:destination => 'default')
12
- ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
13
- $3
14
- end
9
+ def interface
10
+ ret = @runner.get_routing_table_entry(:destination => 'default')
11
+ ret.stdout =~ /^(\S+)(?: via (\S+))? dev (\S+).+(?:\r)?\n(?:default via (\S+))?/
12
+ $3
13
+ end
15
14
 
16
- def to_s
17
- 'Default Gateway'
18
- end
15
+ def to_s
16
+ 'Default Gateway'
19
17
  end
20
18
  end
21
19
  end
@@ -1,109 +1,107 @@
1
1
  require 'date'
2
2
 
3
- module Serverspec
4
- module Type
5
- class File < Base
6
- attr_accessor :content
3
+ module Serverspec::Type
4
+ class File < Base
5
+ attr_accessor :content
7
6
 
8
- def file?
9
- @runner.check_file_is_file(@name)
10
- end
7
+ def file?
8
+ @runner.check_file_is_file(@name)
9
+ end
11
10
 
12
- def socket?
13
- @runner.check_file_is_socket(@name)
14
- end
11
+ def socket?
12
+ @runner.check_file_is_socket(@name)
13
+ end
15
14
 
16
- def directory?
17
- @runner.check_file_is_directory(@name)
18
- end
15
+ def directory?
16
+ @runner.check_file_is_directory(@name)
17
+ end
19
18
 
20
- def contain(pattern, from, to)
21
- if pattern.is_a?(Array)
22
- @runner.check_file_contains_lines(@name, pattern, from, to)
19
+ def contain(pattern, from, to)
20
+ if pattern.is_a?(Array)
21
+ @runner.check_file_contains_lines(@name, pattern, from, to)
22
+ else
23
+ if (from || to).nil?
24
+ @runner.check_file_contains(@name, pattern)
23
25
  else
24
- if (from || to).nil?
25
- @runner.check_file_contains(@name, pattern)
26
- else
27
- @runner.check_file_contains_within(@name, pattern, from, to)
28
- end
26
+ @runner.check_file_contains_within(@name, pattern, from, to)
29
27
  end
30
28
  end
29
+ end
31
30
 
32
- def mode?(mode)
33
- @runner.check_file_has_mode(@name, mode)
34
- end
31
+ def mode?(mode)
32
+ @runner.check_file_has_mode(@name, mode)
33
+ end
35
34
 
36
- def owned_by?(owner)
37
- @runner.check_file_is_owned_by(@name, owner)
38
- end
35
+ def owned_by?(owner)
36
+ @runner.check_file_is_owned_by(@name, owner)
37
+ end
39
38
 
40
- def grouped_into?(group)
41
- @runner.check_file_is_grouped(@name, group)
42
- end
39
+ def grouped_into?(group)
40
+ @runner.check_file_is_grouped(@name, group)
41
+ end
43
42
 
44
- def linked_to?(target)
45
- @runner.check_file_is_linked_to(@name, target)
46
- end
43
+ def linked_to?(target)
44
+ @runner.check_file_is_linked_to(@name, target)
45
+ end
47
46
 
48
- def readable?(by_whom, by_user)
49
- if by_user != nil
50
- @runner.check_file_is_accessible_by_user(@name, by_user, 'r')
51
- else
52
- @runner.check_file_is_readable(@name, by_whom)
53
- end
47
+ def readable?(by_whom, by_user)
48
+ if by_user != nil
49
+ @runner.check_file_is_accessible_by_user(@name, by_user, 'r')
50
+ else
51
+ @runner.check_file_is_readable(@name, by_whom)
54
52
  end
53
+ end
55
54
 
56
- def writable?(by_whom, by_user)
57
- if by_user != nil
58
- @runner.check_file_is_accessible_by_user(@name, by_user, 'w')
59
- else
60
- @runner.check_file_is_writable(@name, by_whom)
61
- end
55
+ def writable?(by_whom, by_user)
56
+ if by_user != nil
57
+ @runner.check_file_is_accessible_by_user(@name, by_user, 'w')
58
+ else
59
+ @runner.check_file_is_writable(@name, by_whom)
62
60
  end
61
+ end
63
62
 
64
- def executable?(by_whom, by_user)
65
- if by_user != nil
66
- @runner.check_file_is_accessible_by_user(@name, by_user, 'x')
67
- else
68
- @runner.check_file_is_executable(@name, by_whom)
69
- end
63
+ def executable?(by_whom, by_user)
64
+ if by_user != nil
65
+ @runner.check_file_is_accessible_by_user(@name, by_user, 'x')
66
+ else
67
+ @runner.check_file_is_executable(@name, by_whom)
70
68
  end
69
+ end
71
70
 
72
- def mounted?(attr, only_with)
73
- @runner.check_file_is_mounted(@name, attr, only_with)
74
- end
71
+ def mounted?(attr, only_with)
72
+ @runner.check_file_is_mounted(@name, attr, only_with)
73
+ end
75
74
 
76
- def immutable?
77
- @runner.check_file_is_immutable(@name)
78
- end
75
+ def immutable?
76
+ @runner.check_file_is_immutable(@name)
77
+ end
79
78
 
80
- def md5sum
81
- @runner.get_file_md5sum(@name).stdout.strip
82
- end
79
+ def md5sum
80
+ @runner.get_file_md5sum(@name).stdout.strip
81
+ end
83
82
 
84
- def sha256sum
85
- @runner.get_file_sha256sum(@name).stdout.strip
86
- end
83
+ def sha256sum
84
+ @runner.get_file_sha256sum(@name).stdout.strip
85
+ end
87
86
 
88
- def content
89
- if @content.nil?
90
- @content = @runner.get_file_content(@name).stdout
91
- end
92
- @content
87
+ def content
88
+ if @content.nil?
89
+ @content = @runner.get_file_content(@name).stdout
93
90
  end
91
+ @content
92
+ end
94
93
 
95
- def version?(version)
96
- @runner.check_file_has_version(@name, version)
97
- end
94
+ def version?(version)
95
+ @runner.check_file_has_version(@name, version)
96
+ end
98
97
 
99
- def mtime
100
- d = @runner.get_file_mtime(@name).stdout.strip
101
- DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
102
- end
98
+ def mtime
99
+ d = @runner.get_file_mtime(@name).stdout.strip
100
+ DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
101
+ end
103
102
 
104
- def size
105
- @runner.get_file_size(@name).stdout.strip.to_i
106
- end
103
+ def size
104
+ @runner.get_file_size(@name).stdout.strip.to_i
107
105
  end
108
106
  end
109
107
  end
@@ -1,13 +1,11 @@
1
- module Serverspec
2
- module Type
3
- class Group < Base
4
- def exists?
5
- @runner.check_group_exists(@name)
6
- end
1
+ module Serverspec::Type
2
+ class Group < Base
3
+ def exists?
4
+ @runner.check_group_exists(@name)
5
+ end
7
6
 
8
- def has_gid?(gid)
9
- @runner.check_group_has_gid(@name, gid)
10
- end
7
+ def has_gid?(gid)
8
+ @runner.check_group_has_gid(@name, gid)
11
9
  end
12
10
  end
13
11
  end
@@ -1,17 +1,15 @@
1
- module Serverspec
2
- module Type
3
- class Host < Base
4
- def resolvable?(type)
5
- @runner.check_host_is_resolvable(@name, type)
6
- end
1
+ module Serverspec::Type
2
+ class Host < Base
3
+ def resolvable?(type)
4
+ @runner.check_host_is_resolvable(@name, type)
5
+ end
7
6
 
8
- def reachable?(port, proto, timeout)
9
- @runner.check_host_is_reachable(@name, port, proto, timeout)
10
- end
7
+ def reachable?(port, proto, timeout)
8
+ @runner.check_host_is_reachable(@name, port, proto, timeout)
9
+ end
11
10
 
12
- def ipaddress
13
- @runner.get_host_ipaddress(@name).stdout.strip
14
- end
11
+ def ipaddress
12
+ @runner.get_host_ipaddress(@name).stdout.strip
15
13
  end
16
14
  end
17
15
  end
@@ -1,45 +1,43 @@
1
- module Serverspec
2
- module Type
3
- class IisAppPool < Base
4
- def exists?()
5
- @runner.check_iis_app_pool_exists(@name)
6
- end
7
-
8
- def has_dotnet_version?(dotnet)
9
- @runner.check_iis_app_pool_has_dotnet_version(@name, dotnet)
10
- end
11
-
12
- def has_32bit_enabled?()
13
- @runner.check_iis_app_pool_has_32bit_enabled(@name)
14
- end
15
-
16
- def has_idle_timeout?(minutes)
17
- @runner.check_iis_app_pool_has_idle_timeout(@name, minutes)
18
- end
19
-
20
- def has_identity_type?(identity_type)
21
- @runner.check_iis_app_pool_has_identity_type(@name, identity_type)
22
- end
23
-
24
- def has_periodic_restart?(minutes)
25
- @runner.check_iis_app_pool_has_periodic_restart(@name, minutes)
26
- end
27
-
28
- def has_user_profile_enabled?()
29
- @runner.check_iis_app_pool_has_user_profile(@name)
30
- end
31
-
32
- def has_username?(username)
33
- @runner.check_iis_app_pool_has_username(@name, username)
34
- end
35
-
36
- def has_managed_pipeline_mode?(mode)
37
- @runner.check_iis_app_pool_has_managed_pipeline_mode(@name, mode)
38
- end
39
-
40
- def to_s
41
- %Q[IIS Application Pool "#{@name}"]
42
- end
1
+ module Serverspec::Type
2
+ class IisAppPool < Base
3
+ def exists?()
4
+ @runner.check_iis_app_pool_exists(@name)
5
+ end
6
+
7
+ def has_dotnet_version?(dotnet)
8
+ @runner.check_iis_app_pool_has_dotnet_version(@name, dotnet)
9
+ end
10
+
11
+ def has_32bit_enabled?()
12
+ @runner.check_iis_app_pool_has_32bit_enabled(@name)
13
+ end
14
+
15
+ def has_idle_timeout?(minutes)
16
+ @runner.check_iis_app_pool_has_idle_timeout(@name, minutes)
17
+ end
18
+
19
+ def has_identity_type?(identity_type)
20
+ @runner.check_iis_app_pool_has_identity_type(@name, identity_type)
21
+ end
22
+
23
+ def has_periodic_restart?(minutes)
24
+ @runner.check_iis_app_pool_has_periodic_restart(@name, minutes)
25
+ end
26
+
27
+ def has_user_profile_enabled?()
28
+ @runner.check_iis_app_pool_has_user_profile(@name)
29
+ end
30
+
31
+ def has_username?(username)
32
+ @runner.check_iis_app_pool_has_username(@name, username)
33
+ end
34
+
35
+ def has_managed_pipeline_mode?(mode)
36
+ @runner.check_iis_app_pool_has_managed_pipeline_mode(@name, mode)
37
+ end
38
+
39
+ def to_s
40
+ %Q[IIS Application Pool "#{@name}"]
43
41
  end
44
42
  end
45
43
  end