def get(context, node, file):
    """ Get the contents of a file in a remote host """
    ssh = context.getUtils().sshForNode().apply(node)
    try:
        ssh.connect()
        payload = ssh.get(file)
        return Strings2.toStringAndClose(payload.getInput())
    finally:
        if payload:
            payload.release()
        if ssh:
            ssh.disconnect()
Exemple #2
0
 def _print_node_file(self, context, node, file):
     ssh = context.getUtils().sshForNode().apply(node)
     try:
         ssh.connect()
         payload = ssh.get(file)
         log.info(file)
         log.info(Strings2.toStringAndClose(payload.getInput()))
     finally:
         if payload:
             payload.release()
         if ssh:
             ssh.disconnect()