Sha256: 23545fbe52682643b59b947c312502bfebe904f371adbf8b4e56e6345e2cd8bf

Contents?: true

Size: 893 Bytes

Versions: 5

Compression:

Stored size: 893 Bytes

Contents

module HeadStartApp
  module Marionette

    require 'uri'
  
  
    # Master class is the ZMQ socket connection on the puppet master
    class Master
      attr_accessor :socket, :threads
  
      def initialize(socket)
  
        # Set socket
        @socket = socket
  
      end
  
      # Sends a msg to puppet node
      def send(msg)
  
        # Send and Receive
        @socket.send_string Marshal.dump(msg)

      end
      
      # Stands by for the next msg from puppet
      # Processes and returns response 
      def receive
        
        # Stand by for a response
        begin
          
          response = socket.recv_string
          @response = Marshal.load(response)
          
        rescue
          
          # Catch non-marshal-able response
          @response = response

        end
        
        @response
          
      end
      
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
marionette-0.0.5 lib/marionette/master.rb
marionette-0.0.4 lib/marionette/master.rb
marionette-0.0.3 lib/marionette/master.rb
marionette-0.0.2 lib/marionette/master.rb
marionette-0.0.1 lib/marionette/master.rb