Class: Inspec::Resources::IisSite

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/iis_site.rb

Direct Known Subclasses

IisSiteServerSpec

Instance Method Summary collapse

Constructor Details

#initialize(site_name) ⇒ IisSite

Returns a new instance of IisSite.



32
33
34
35
36
37
38
39
40
# File 'lib/resources/iis_site.rb', line 32

def initialize(site_name)
  @site_name = site_name
  @cache = nil

  @site_provider = SiteProvider.new(inspec)

  # verify that this resource is only supported on Windows
  return skip_resource 'The `iis_site` resource is not supported on your OS.' if inspec.os[:family] != 'windows'
end

Instance Method Details

#app_poolObject



42
43
44
# File 'lib/resources/iis_site.rb', line 42

def app_pool
  iis_site.nil? ? nil : iis_site[:app_pool]
end

#bindingsObject



46
47
48
# File 'lib/resources/iis_site.rb', line 46

def bindings
  iis_site.nil? ? nil : iis_site[:bindings]
end

#exists?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/resources/iis_site.rb', line 58

def exists?
  !iis_site.nil? && !iis_site[:name].nil?
end

#has_app_pool?(app_pool) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/resources/iis_site.rb', line 66

def has_app_pool?(app_pool)
  iis_site.nil? ? false : iis_site[:app_pool] == app_pool
end

#has_binding?(binding) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/resources/iis_site.rb', line 74

def has_binding?(binding)
  iis_site.nil? ? false : (iis_site[:bindings].include? binding)
end

#has_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/resources/iis_site.rb', line 70

def has_path?(path)
  iis_site.nil? ? false : iis_site[:path] == path
end

#iis_siteObject



82
83
84
85
# File 'lib/resources/iis_site.rb', line 82

def iis_site
  return @cache if !@cache.nil?
  @cache = @site_provider.iis_site(@site_name) if !@site_provider.nil?
end

#pathObject



54
55
56
# File 'lib/resources/iis_site.rb', line 54

def path
  iis_site.nil? ? nil : iis_site[:path]
end

#running?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/resources/iis_site.rb', line 62

def running?
  iis_site.nil? ? false : (iis_site[:state] == 'Started')
end

#stateObject



50
51
52
# File 'lib/resources/iis_site.rb', line 50

def state
  iis_site.nil? ? nil : iis_site[:state]
end

#to_sObject



78
79
80
# File 'lib/resources/iis_site.rb', line 78

def to_s
  "iis_site '#{@site_name}'"
end