lib/open_directory_utils/connection.rb
# after configuring a connection with .new - send commands via ssh to open directory
# @command [Symbol] - required -- to choose the action wanted
# @params [Hash] - required -- necessary information to accomplish action
# @output [String] - optional -- 'xml' or 'plist' will return responses using xml format
# response [Hash] - { response: results, status: status, command: command, attributes: params, dscl_cmds: ssh_clean }
after configuring a connection with .new - send commands via ssh to open directory
after configuring a connection with . new - send commands via ssh to open directory
def run(command:, params:, output: nil)
      answer = {}
      params[:format] = output
      params[:record_name] = nil
      ssh_cmds = send(command, params, dir_info)
      results   = send_cmds_to_od_server(ssh_cmds)
      answer = process_results(results, command, params, ssh_cmds )
      params[:value] = nil
      return answer
      rescue ArgumentError, NoMethodError => error
        format_results(error.message, command, params, ssh_cmds, 'error')
    end
def run ( command : , params : , output : nil ) answer = { } params [ :format ] = output params [ :record_name ] = nil ssh_cmds = send ( command , params , dir_info ) results = send_cmds_to_od_server ( ssh_cmds ) answer = process_results ( results , command , params , ssh_cmds ) params [ :value ] = nil return answer rescue ArgumentError , NoMethodError => error format_results ( error . message , command , params , ssh_cmds , 'error' ) end
after configuring a connection with .new - send commands via ssh to open directory
after configuring a connection with . new - send commands via ssh to open directory
# just in case clear record_name and calculate later # pp ssh_cmds # pp results
command
params
output
command
[Symbol] - required -- to choose the action wanted
[ Symbol ] - required -- to choose the action wanted
params
[Hash] - required -- necessary information to accomplish action
[ Hash ] - required -- necessary information to accomplish action
output
[String] - optional -- 'xml' or 'plist' will return responses using xml format response [Hash] - { response: results, status: status, command: command, attributes: params, dscl_cmds: ssh_clean }
[ String ] - optional -- ' xml ' or ' plist ' will return responses using xml format response [ Hash ] - { response : results status : status command : command attributes : params dscl_cmds : ssh_clean }