def validate_ssh_credentials(self, cur_message):

        """ 
        Validate the SSH Credentials are working without password for cluster control: 
        
            sudo ./run_message_simulation.py -f simulations/validate_ssh_credentials_across_cluster.json

        --- Please Read --- 
        
        Setup Notes:

            For now this is using ssh to invoke a command on the remote host

            Please install the ssh keys that will allow password-less access to a user that has credentials to perform a command:
            
                kill -9 <Broker PID>

            Eventually this could be using a Queue for control messages or post using HTTP to a rest control service deployed on the node

        """
        
        results             = build_dict("FAILED", "Not Valid", {})

        try:

            self.m_cur_count        += 1

            self.lg("Handling - Validating SSH Credentials(" + str(json.dumps(cur_message)) + ")", 6)

            ssh_host        = str(cur_message["Host"])
            ssh_user        = str(cur_message["User"])

            commands_to_run = cur_message["Commands"]
            count_idx       = 0

            valid_setup     = False

            for ssh_command in commands_to_run:
                
                # Allow for edits before running:
                remote_command  = str(ssh_command)

                proc            = subprocess.Popen(remote_command, shell=True, stdout=subprocess.PIPE)
                std_rows        = proc.communicate()[0].split("\n")
            
                if len(std_rows) == 1:
                    valid_setup = False
                else:
                    lg("\tSSH Credentials Validated(" + str(ssh_host) + ")", 5)
                    valid_setup = True

            # end of for all commands

            if valid_setup:
                results     = build_dict("SUCCESS", "SSH Credentials Validated", {})
            else:
                err_msg     = "SSH Validation Failed Please run: ssh-copy-id root@" + str(ssh_host)
                self.elg(err_msg, True)
                results     = build_dict("FAILED", str(err_msg), {})

        except Exception,k:
            err_msg         = "Failed Validating SSH Credentials Number(" + str(self.m_message_number) + ") Message(" + str(cur_message) + ") with Ex(" + str(k) + ")"
            self.elg(err_msg, True)
            results         = build_dict("FAILED", str(err_msg), {})

            self.m_message_number   += 1
        # end of try/ex

        return results
    # end of validate_ssh_credentials
dataset/ETHPy150Open GetLevvel/message-simulator/src/rabbit_message_publisher.py/RabbitMessagePublisher.validate_ssh_credentials/original