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.
- checksums.yaml +4 -4
- data/WINDOWS_SUPPORT.md +9 -13
- data/lib/serverspec/helper/type.rb +7 -9
- data/lib/serverspec/helper.rb +0 -2
- data/lib/serverspec/setup.rb +11 -7
- data/lib/serverspec/type/base.rb +15 -17
- data/lib/serverspec/type/cgroup.rb +13 -16
- data/lib/serverspec/type/command.rb +14 -17
- data/lib/serverspec/type/cron.rb +8 -9
- data/lib/serverspec/type/default_gateway.rb +14 -16
- data/lib/serverspec/type/file.rb +76 -78
- data/lib/serverspec/type/group.rb +7 -9
- data/lib/serverspec/type/host.rb +10 -12
- data/lib/serverspec/type/iis_app_pool.rb +40 -42
- data/lib/serverspec/type/iis_website.rb +28 -31
- data/lib/serverspec/type/interface.rb +10 -12
- data/lib/serverspec/type/ipfilter.rb +7 -9
- data/lib/serverspec/type/ipnat.rb +7 -9
- data/lib/serverspec/type/iptables.rb +7 -9
- data/lib/serverspec/type/kernel_module.rb +4 -6
- data/lib/serverspec/type/linux_kernel_parameter.rb +7 -9
- data/lib/serverspec/type/lxc.rb +10 -12
- data/lib/serverspec/type/mail_alias.rb +4 -6
- data/lib/serverspec/type/package.rb +48 -50
- data/lib/serverspec/type/php_config.rb +7 -9
- data/lib/serverspec/type/port.rb +28 -30
- data/lib/serverspec/type/ppa.rb +7 -9
- data/lib/serverspec/type/process.rb +20 -22
- data/lib/serverspec/type/routing_table.rb +7 -9
- data/lib/serverspec/type/selinux.rb +13 -17
- data/lib/serverspec/type/service.rb +24 -26
- data/lib/serverspec/type/user.rb +22 -30
- data/lib/serverspec/type/windows_feature.rb +4 -6
- data/lib/serverspec/type/windows_hot_fix.rb +4 -6
- data/lib/serverspec/type/windows_registry_key.rb +13 -15
- data/lib/serverspec/type/windows_scheduled_task.rb +4 -6
- data/lib/serverspec/type/yumrepo.rb +7 -9
- data/lib/serverspec/type/zfs.rb +10 -12
- data/lib/serverspec/version.rb +1 -1
- data/lib/serverspec.rb +2 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/type/aix/group_spec.rb +0 -4
- data/spec/type/aix/package_spec.rb +0 -4
- data/spec/type/aix/port_spec.rb +12 -25
- data/spec/type/aix/service_spec.rb +0 -7
- data/spec/type/aix/user_spec.rb +0 -12
- data/spec/type/arch/file_spec.rb +0 -13
- data/spec/type/arch/package_spec.rb +0 -10
- data/spec/type/base/cron_spec.rb +0 -8
- data/spec/type/base/file_spec.rb +0 -53
- data/spec/type/base/group_spec.rb +0 -8
- data/spec/type/base/host_spec.rb +0 -20
- data/spec/type/base/mail_alias_spec.rb +0 -4
- data/spec/type/base/package_spec.rb +10 -38
- data/spec/type/base/port_spec.rb +19 -18
- data/spec/type/base/service_spec.rb +4 -29
- data/spec/type/base/user_spec.rb +0 -24
- data/spec/type/darwin/package_spec.rb +0 -8
- data/spec/type/darwin/port_spec.rb +17 -23
- data/spec/type/darwin/service_spec.rb +0 -12
- data/spec/type/debian/package_spec.rb +0 -12
- data/spec/type/debian/service_spec.rb +0 -8
- data/spec/type/freebsd/file_spec.rb +0 -16
- data/spec/type/freebsd/package_spec.rb +0 -8
- data/spec/type/freebsd/port_spec.rb +17 -23
- data/spec/type/freebsd/service_spec.rb +0 -4
- data/spec/type/freebsd10/package_spec.rb +0 -8
- data/spec/type/gentoo/package_spec.rb +0 -5
- data/spec/type/gentoo/service_spec.rb +0 -8
- data/spec/type/linux/file_spec.rb +0 -13
- data/spec/type/linux/iptables_spec.rb +0 -8
- data/spec/type/linux/kernel_module_spec.rb +0 -4
- data/spec/type/linux/lxc_container_spec.rb +0 -8
- data/spec/type/nixos/package_spec.rb +0 -12
- data/spec/type/openbsd/file_spec.rb +0 -30
- data/spec/type/openbsd/mail_alias_spec.rb +0 -4
- data/spec/type/openbsd/package_spec.rb +0 -9
- data/spec/type/openbsd/service_spec.rb +0 -7
- data/spec/type/openbsd/user_spec.rb +0 -8
- data/spec/type/opensuse/service_spec.rb +0 -12
- data/spec/type/plamo/package_spec.rb +0 -4
- data/spec/type/plamo/service_spec.rb +0 -4
- data/spec/type/redhat/file_spec.rb +0 -13
- data/spec/type/redhat/package_spec.rb +0 -12
- data/spec/type/redhat/service_spec.rb +0 -8
- data/spec/type/redhat/yumrepo_spec.rb +5 -19
- data/spec/type/redhat5/iptables_spec.rb +0 -8
- data/spec/type/smartos/package_spec.rb +0 -8
- data/spec/type/smartos/service_spec.rb +0 -12
- data/spec/type/solaris/cron_spec.rb +0 -8
- data/spec/type/solaris/file_spec.rb +0 -14
- data/spec/type/solaris/group_spec.rb +0 -4
- data/spec/type/solaris/host_spec.rb +3 -11
- data/spec/type/solaris/package_spec.rb +0 -4
- data/spec/type/solaris/port_spec.rb +23 -22
- data/spec/type/solaris/service_spec.rb +0 -12
- data/spec/type/solaris/user_spec.rb +0 -12
- data/spec/type/solaris10/file_spec.rb +0 -58
- data/spec/type/solaris10/group_spec.rb +0 -4
- data/spec/type/solaris10/host_spec.rb +2 -6
- data/spec/type/solaris10/package_spec.rb +0 -3
- data/spec/type/solaris10/user_spec.rb +0 -4
- data/spec/type/suse/package_spec.rb +0 -12
- data/spec/type/suse/service_spec.rb +0 -8
- data/spec/type/ubuntu/ppa_spec.rb +0 -8
- data/spec/type/ubuntu/service_spec.rb +0 -4
- data/spec/type/windows/feature_spec.rb +8 -0
- data/spec/type/windows/file_spec.rb +0 -36
- data/spec/type/windows/group_spec.rb +0 -4
- data/spec/type/windows/host_spec.rb +0 -20
- data/spec/type/windows/port_spec.rb +0 -4
- data/spec/type/windows/service_spec.rb +0 -8
- data/spec/type/windows/user_spec.rb +0 -8
- metadata +2 -5
- data/lib/serverspec/helper/properties.rb +0 -9
- data/spec/helper/properties_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f5c21f68d3a593ac38c66936009b9b391d05981
|
4
|
+
data.tar.gz: b56991bd56276db1d0bfedc54117f8ad7edc12e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
24
|
-
include Serverspec::Helper::Windows
|
21
|
+
set :backend, :winrm
|
25
22
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
6
|
-
ipfilter ipnat iptables
|
7
|
-
|
8
|
-
|
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
|
-
|
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
|
data/lib/serverspec/helper.rb
CHANGED
data/lib/serverspec/setup.rb
CHANGED
@@ -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(
|
26
|
+
print('Input vagrant instance name: ')
|
27
27
|
@hostname = $stdin.gets.chomp
|
28
28
|
end
|
29
29
|
else
|
30
30
|
@vagrant = false
|
31
|
-
print(
|
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
|
-
|
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
|
304
|
+
endpoint = "http://#{ENV['TARGET_HOST']}:5985/wsman"
|
302
305
|
|
303
|
-
|
304
|
-
|
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
|
data/lib/serverspec/type/base.rb
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
15
|
+
alias_method :inspect, :to_s
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
17
|
+
def to_ary
|
18
|
+
to_s.split(" ")
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -1,19 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
7
|
+
def stderr
|
8
|
+
command_result.stderr
|
9
|
+
end
|
15
10
|
|
16
|
-
|
11
|
+
def exit_status
|
12
|
+
command_result.exit_status.to_i
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
private
|
16
|
+
def command_result()
|
17
|
+
@command_result ||= @runner.run_command(@name)
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
data/lib/serverspec/type/cron.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
def to_s
|
16
|
+
'Default Gateway'
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -1,109 +1,107 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
|
-
module Serverspec
|
4
|
-
|
5
|
-
|
6
|
-
attr_accessor :content
|
3
|
+
module Serverspec::Type
|
4
|
+
class File < Base
|
5
|
+
attr_accessor :content
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def file?
|
8
|
+
@runner.check_file_is_file(@name)
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def socket?
|
12
|
+
@runner.check_file_is_socket(@name)
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
def directory?
|
16
|
+
@runner.check_file_is_directory(@name)
|
17
|
+
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
31
|
+
def mode?(mode)
|
32
|
+
@runner.check_file_has_mode(@name, mode)
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
def owned_by?(owner)
|
36
|
+
@runner.check_file_is_owned_by(@name, owner)
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
def grouped_into?(group)
|
40
|
+
@runner.check_file_is_grouped(@name, group)
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
def linked_to?(target)
|
44
|
+
@runner.check_file_is_linked_to(@name, target)
|
45
|
+
end
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
71
|
+
def mounted?(attr, only_with)
|
72
|
+
@runner.check_file_is_mounted(@name, attr, only_with)
|
73
|
+
end
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
def immutable?
|
76
|
+
@runner.check_file_is_immutable(@name)
|
77
|
+
end
|
79
78
|
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
def md5sum
|
80
|
+
@runner.get_file_md5sum(@name).stdout.strip
|
81
|
+
end
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
def sha256sum
|
84
|
+
@runner.get_file_sha256sum(@name).stdout.strip
|
85
|
+
end
|
87
86
|
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
-
|
96
|
-
|
97
|
-
|
94
|
+
def version?(version)
|
95
|
+
@runner.check_file_has_version(@name, version)
|
96
|
+
end
|
98
97
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
|
105
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Group < Base
|
3
|
+
def exists?
|
4
|
+
@runner.check_group_exists(@name)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def has_gid?(gid)
|
8
|
+
@runner.check_group_has_gid(@name, gid)
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
data/lib/serverspec/type/host.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def reachable?(port, proto, timeout)
|
8
|
+
@runner.check_host_is_reachable(@name, port, proto, timeout)
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|