Exemple #1
0
def old_upload(local_path):
    """
    OBSOLETE Upload file to incoming folder.
    :param local_path:
    :return:
    """

    ProxyIP = config_get("ProxyIP")
    ProxyUsername = config_get("ProxyUsername")
    ProxyPassword = config_get("ProxyPassword")
    LORISHostIP = config_get("LORISHostIP")
    LORISHostUsername = config_get("LORISHostUsername")
    LORISHostPassword = config_get("LORISHostPassword")

    Client = LORIS_helper.getProxySSHClient(
        ProxyIP,
        ProxyUsername,
        ProxyPassword,
        LORISHostIP,
        LORISHostUsername,
        LORISHostPassword,
    )

    file_name = os.path.basename(local_path)
    LORIS_helper.uploadThroughClient(Client, "//data/incoming/" + file_name,
                                     local_path)
Exemple #2
0
    def deleteCandidateCNBP(DCCID, PSCID):
        # @todo: this should really be done through API. But Currently LORIS does not offer such API.
        # NOTE! If you EVER get NULL coalesce not recognized error, make sure that the PHP version being called from
        # the SSH session is 7+ or else. We had a major issue where the PHP version from SSH session being LOWER
        # than the .bashrc profile imported edition. Also keep in mind that EVEN if .bashrc import this, it MOST LIKELY
        # will not apply to the SSH session!

        LORISHostPassword = config_get("LORISHostPassword")
        LORISHostUsername = config_get("LORISHostUsername")
        LORISHostIP = config_get("LORISHostIP")
        DeletionScript = config_get("DeletionScript")

        # NOTE! If you EVER get NULL coalesce not recognized error, make sure that the PHP version being called from
        # the SSH session is 7+ or else. We had a major issue where the PHP version from SSH session being LOWER
        # than the bashrc profile imported edition. Also keep in mind that EVEN if .bashrc import this, it MOST LIKELY
        # will not apply to the SSH session!

        command_string = f"/opt/rh//rh-php70/root/usr/bin/php {DeletionScript} delete_candidate {str(DCCID)} {PSCID} confirm"

        logger.debug(command_string)

        # Establish connection to client.
        Client = LORIS_helper.getProxySSHClient(
            ProxyIP,
            ProxyUsername,
            ProxyPassword,
            LORISHostIP,
            LORISHostUsername,
            LORISHostPassword,
        )

        # Execute the command
        LORIS_helper.triggerCommand(Client, command_string)

        # Close the client.
        Client.close()