-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into production
- Loading branch information
Showing
8 changed files
with
184 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
use File::Basename; | ||
use perunDataGenerator; | ||
|
||
local $::SERVICE_NAME = basename($0); | ||
local $::PROTOCOL_VERSION = "3.0.0"; | ||
local $::SKIP_NON_VALID_MEMBERS = 1; | ||
|
||
perunDataGenerator::generateMemberUsersDataInJson; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
#!/bin/bash | ||
export SERVICE_NAME="pithia_portal" | ||
#!/usr/bin/env python3 | ||
import sys | ||
import send_lib | ||
import requests | ||
import generic_sender | ||
|
||
python3 generic_send.py "$1" "$2" "$3" | ||
SERVICE_NAME = "pithia_portal" | ||
|
||
send_lib.check_input_fields(sys.argv, True) | ||
|
||
facility = sys.argv[1] | ||
destination = sys.argv[2] | ||
destination_type = sys.argv[3] | ||
|
||
send_lib.check_destination_type_allowed(destination_type, send_lib.DESTINATION_TYPE_URL) | ||
|
||
auth_token = None | ||
|
||
auth = send_lib.get_auth_credentials(SERVICE_NAME, destination) | ||
tokenUrl = send_lib.get_custom_config_properties(SERVICE_NAME, destination, ["tokenUrl"])[0] | ||
data = { | ||
"username": auth[0], | ||
"password": auth[1] | ||
} | ||
response = requests.post(tokenUrl, data) | ||
resp_cookies = response.cookies.get_dict() | ||
if response.status_code == 200: | ||
response = response.json() | ||
if "token" not in response: | ||
send_lib.die_with_error("Token missing in response from token server") | ||
auth_token = response["token"] | ||
else: | ||
send_lib.die_with_error("Response from token server ended with error code: " + str(response.status_code) | ||
+ ", content: " + response.text) | ||
|
||
opts = ['-H', 'Authorization: Bearer ' + auth_token, '--cookie', 'sessionid=' + resp_cookies['sessionid']] | ||
|
||
generic_sender.send(SERVICE_NAME, facility, destination, destination_type, opts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env python3 | ||
import sys | ||
import requests | ||
import send_lib | ||
import tarfile | ||
|
||
SERVICE_NAME = "webcentrum_eosc" | ||
TIMEOUT = 1800 # 30 * 60 sec = 30 min | ||
|
||
send_lib.check_input_fields(sys.argv, True) | ||
|
||
facility = sys.argv[1] | ||
destination = sys.argv[2] | ||
destination_type = sys.argv[3] | ||
|
||
send_lib.check_destination_type_allowed(destination_type, send_lib.DESTINATION_TYPE_URL) | ||
send_lib.check_destination_format(destination, destination_type) | ||
|
||
auth = send_lib.get_auth_credentials(SERVICE_NAME, destination) | ||
|
||
send_lib.create_lock(SERVICE_NAME, destination) | ||
gen_folder = send_lib.get_gen_folder(facility, SERVICE_NAME) | ||
with send_lib.prepare_temporary_directory() as temp_dir: | ||
send_lib.copy_files_to_directory(gen_folder, temp_dir) | ||
|
||
with tarfile.open(temp_dir + '/perun_data.tar.gz', 'w:gz', format=tarfile.GNU_FORMAT) as archive: | ||
archive.add(temp_dir, arcname='.') | ||
|
||
with open(temp_dir + '/perun_data.tar.gz', 'rb') as compressed: | ||
headers = {'Content-type': 'application/tar+gzip'} | ||
response = requests.put(destination, headers=headers, data=compressed, auth=auth, timeout=TIMEOUT) | ||
if not response.ok: | ||
send_lib.die_with_error( | ||
"Request ended with error code: " + str(response.status_code)) |