Exemple #1
0
def test_048_mount_the_smb_share_robocopy_testdir_to_the_share_windows_mount(
        request):
    depends(request, ["service_cifs_running", "ssh_password"], scope="session")
    # sleep 61 second to make sure that
    sleep(61)
    script = '@echo on\n'
    script += fr'net use X: \\{ip}\{SMB_NAME} /user:shareuser testing'
    script += '\n'
    script += r'robocopy testdir X:\testdir /COPY:DAT'
    script += '\n'
    script += r'dir X:\testdir'
    script += '\nnet use X: /delete\n'
    cmd_file = open('runtest.cmd', 'w')
    cmd_file.writelines(script)
    cmd_file.close()
    results = send_file('runtest.cmd', 'runtest.cmd', WIN_USERNAME,
                        WIN_PASSWORD, WIN_HOST)
    assert results['result'] is True, results['output']
    cmd_results = SSH_TEST('runtest.cmd', WIN_USERNAME, WIN_PASSWORD, WIN_HOST)
    assert cmd_results['result'] is True, cmd_results['output']
    os.remove("runtest.cmd")
    cmd = 'del runtest.cmd'
    results = SSH_TEST(cmd, WIN_USERNAME, WIN_PASSWORD, WIN_HOST)
    assert results['result'] is True, results['output']
    regex = re.compile(r"^(?=.*testfile)(?!.*New).*", re.MULTILINE)
    data_list = regex.findall(cmd_results['output'])[0].split()
    global mounted_time, mounted_date
    mounted_time = data_list[1]
    mounted_date = data_list[0]
Exemple #2
0
def test_06_setup_function(image):
    zf = os.path.join(os.path.dirname(__file__), "fixtures", f"{image}.gz")
    destination = f"/tmp/{image}.gz"
    send_results = send_file(zf, destination, user, None, ip)
    assert send_results['result'] is True, send_results['output']

    cmd = f"gunzip -f /tmp/{image}.gz"
    gunzip_results = SSH_TEST(cmd, user, password, ip)
    assert gunzip_results['result'] is True, gunzip_results['output']

    cmd = f"mdconfig -a -t vnode -f /tmp/{image}"
    mdconfig_results = SSH_TEST(cmd, user, password, ip)
    assert mdconfig_results['result'] is True, mdconfig_results['output']
    IMAGES[image] = mdconfig_results['output'].strip()
Exemple #3
0
def test_06_setup_function(image):
    zf = os.path.join(os.path.dirname(__file__), "fixtures", f"{image}.gz")
    destination = f"/tmp/{image}.gz"
    send_results = send_file(zf, destination, user, None, ip)
    assert send_results['result'] is True, send_results['output']

    cmd = f"gunzip -f /tmp/{image}.gz"
    gunzip_results = SSH_TEST(cmd, user, password, ip)
    assert gunzip_results['result'] is True, gunzip_results['output']

    cmd = f"mdconfig -a -t vnode -f /tmp/{image}"
    mdconfig_results = SSH_TEST(cmd, user, password, ip)
    assert mdconfig_results['result'] is True, mdconfig_results['output']
    IMAGES[image] = mdconfig_results['output'].strip()
def test_02_setup_function(request, image):
    depends(request, ["pool_04", "ssh_key"], scope="session")
    zf = os.path.join(os.path.dirname(__file__), "fixtures", f"{image}.gz")
    destination = f"/tmp/{image}.gz"
    send_results = send_file(zf, destination, user, None, ip)
    assert send_results['result'] is True, send_results['output']

    cmd = f"gunzip -f /tmp/{image}.gz"
    gunzip_results = SSH_TEST(cmd, user, password, ip)
    assert gunzip_results['result'] is True, gunzip_results['output']
    cmd = f"losetup -P {loops[image]} /tmp/{image}"
    mdconfig_results = SSH_TEST(cmd, user, password, ip)
    assert mdconfig_results['result'] is True, mdconfig_results['output']
    IMAGES[image] = f"{loops[image]}p1"
Exemple #5
0
import sys
import warnings
import requests as R
import functions as F

warnings.filterwarnings('ignore')

if len(sys.argv) is not 6:
    print(
        "Usage: python direct_download.py url server_address username password path"
    )
else:
    url = sys.argv[1]
    server = sys.argv[2]
    username = sys.argv[3]
    password = sys.argv[4]
    path = sys.argv[5]

    response = R.get(url, stream=True)
    sftp = F.sftp_connect(server, username, password)
    F.send_file(response, sftp, path)
Exemple #6
0
def send_from_gdrive(id, server, username, password, path):
    sftp = F.sftp_connect(server, username, password)
    response = get_response(file_id)
    F.send_file(response, sftp, path)