Class: Puppet::Network::Server Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/network/server.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, port) ⇒ Server

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Server.



9
10
11
12
13
14
15
16
17
18
# File 'lib/puppet/network/server.rb', line 9

def initialize(address, port)
  @port = port
  @address = address
  @http_server = Puppet::Network::HTTP::WEBrick.new

  @listening = false

  # Make sure we have all of the directories we need to function.
  Puppet.settings.use(:main, :ssl, :application)
end

Instance Attribute Details

#addressObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
# File 'lib/puppet/network/server.rb', line 7

def address
  @address
end

#portObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
# File 'lib/puppet/network/server.rb', line 7

def port
  @port
end

Instance Method Details

#listening?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


20
21
22
# File 'lib/puppet/network/server.rb', line 20

def listening?
  @listening
end

#startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
# File 'lib/puppet/network/server.rb', line 24

def start
  raise _("Cannot listen -- already listening.") if listening?
  @listening = true
  @http_server.listen(address, port)
end

#stopObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
33
34
# File 'lib/puppet/network/server.rb', line 30

def stop
  raise _("Cannot unlisten -- not currently listening.") unless listening?
  @http_server.unlisten
  @listening = false
end

#wait_for_shutdownObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/puppet/network/server.rb', line 36

def wait_for_shutdown
  @http_server.wait_for_shutdown
end