Method: Inspec::Resources::Nginx#initialize

Defined in:
lib/resources/nginx.rb

#initialize(nginx_path = '/usr/sbin/nginx') ⇒ Nginx

Returns a new instance of Nginx.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/resources/nginx.rb', line 24

def initialize(nginx_path = '/usr/sbin/nginx')
  return skip_resource 'The `nginx` resource is not yet available on your OS.' if inspec.os.windows?
  return skip_resource 'The `nginx` binary not found in the path provided.' unless inspec.command(nginx_path).exist?

  cmd = inspec.command("#{nginx_path} -V 2>&1")
  if !cmd.exit_status.zero?
    return skip_resource 'Error using the command nginx -V'
  end
  @data = cmd.stdout
  @params = {}
  read_content
end