Class ChefZero::Server
In: lib/chef_zero/server.rb
Parent: Object

Methods

Included Modules

ChefZero::Endpoints

Constants

DEFAULT_OPTIONS = { :host => '127.0.0.1', :port => 8889, :log_level => :info, :generate_real_keys => true, :single_org => 'chef', :ssl => false
GLOBAL_ENDPOINTS = [ '/license', '/version', '/server_api_version'

Attributes

options  [R]  @return [Hash]
server  [R]  @return [WEBrick::HTTPServer]

Public Class methods

Public Instance methods

The data store for this server (default is in-memory).

@return [ChefZero::DataStore]

Boolean method to determine if real Public/Private keys should be generated.

@return [Boolean]

  true if real keys should be created, false otherwise

Load data in a nice, friendly form: {

  'roles' => {
    'desert' => '{ "description": "Hot and dry"' },
    'rainforest' => { "description" => 'Wet and humid' }
  },
  'cookbooks' => {
    'apache2-1.0.1' => {
      'templates' => { 'default' => { 'blah.txt' => 'hi' }}
      'recipes' => { 'default.rb' => 'template "blah.txt"' }
      'metadata.rb' => 'depends "mysql"'
    },
    'apache2-1.2.0' => {
      'templates' => { 'default' => { 'blah.txt' => 'lo' }}
      'recipes' => { 'default.rb' => 'template "blah.txt"' }
      'metadata.rb' => 'depends "mysql"'
    },
    'mysql' => {
      'recipes' => { 'default.rb' => 'file { contents "hi" }' },
      'metadata.rb' => 'version "1.0.0"'
    }
  }

}

@return [Integer]

Boolean method to determine if the server is currently ready to accept requests. This method will attempt to make an HTTP request against the server. If this method returns true, you are safe to make a request.

@return [Boolean]

  true if the server is accepting requests, false otherwise

Start a Chef Zero server in the current thread. You can stop this server by canceling the current thread.

@param [Boolean|IO] publish

  publish the server information to the publish parameter or to STDOUT if it's "true"

@return [nil]

  this method will block the main thread until interrupted

Start a Chef Zero server in a forked process. This method returns the PID to the forked process.

@param [Fixnum] wait

  the number of seconds to wait for the server to start

@return [Thread]

  the thread the background process is running in

Gracefully stop the Chef Zero server.

@param [Fixnum] wait

  the number of seconds to wait before raising force-terminating the
  server

The URL for this Chef Zero server. If the given host is an IPV6 address, it is escaped in brackets according to RFC-2732.

@see www.ietf.org/rfc/rfc2732.txt RFC-2732

@return [String]

[Validate]