rhdl 0.1.0.post1729172676__tar.gz → 0.1.0.post1729615558__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rhdl might be problematic. Click here for more details.
- {rhdl-0.1.0.post1729172676/rhdl.egg-info → rhdl-0.1.0.post1729615558}/PKG-INFO +1 -1
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558/rhdl.egg-info}/PKG-INFO +1 -1
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/api.py +10 -2
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/downloader.py +1 -8
- rhdl-0.1.0.post1729615558/rhdlcli/fs.py +23 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/options.py +1 -1
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/tests/test_files.py +1 -1
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/tests/test_options.py +4 -4
- rhdl-0.1.0.post1729172676/rhdlcli/fs.py +0 -41
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/LICENSE +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/MANIFEST.in +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/requirements.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdl.egg-info/SOURCES.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdl.egg-info/dependency_links.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdl.egg-info/entry_points.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdl.egg-info/requires.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdl.egg-info/top_level.txt +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/__init__.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/cli.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/files.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/main.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/stats.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/validator.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/rhdlcli/version.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/setup.cfg +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/setup.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/tests/test_cli.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/tests/test_stats.py +0 -0
- {rhdl-0.1.0.post1729172676 → rhdl-0.1.0.post1729615558}/tests/test_validator.py +0 -0
|
@@ -24,12 +24,20 @@ class HmacSession(requests.Session):
|
|
|
24
24
|
self.secret_key = secret_key
|
|
25
25
|
super(HmacSession, self).__init__()
|
|
26
26
|
|
|
27
|
-
def request(self, method, url, *args, **kwargs):
|
|
27
|
+
def request(self, method, url, *args, allow_redirects=True, **kwargs):
|
|
28
28
|
url = urljoin(self.base_url, url)
|
|
29
29
|
auth = HmacAuthBase(
|
|
30
30
|
self.access_key, self.secret_key, service="api", region="us-east-1"
|
|
31
31
|
)
|
|
32
|
-
|
|
32
|
+
response = super(HmacSession, self).request(
|
|
33
|
+
method, url, auth=auth, allow_redirects=False, *args, **kwargs
|
|
34
|
+
)
|
|
35
|
+
if response.status_code == 302 and allow_redirects:
|
|
36
|
+
redirect_url = response.headers.get("Location")
|
|
37
|
+
return super(HmacSession, self).request(
|
|
38
|
+
method, redirect_url, *args, **kwargs
|
|
39
|
+
)
|
|
40
|
+
return response
|
|
33
41
|
|
|
34
42
|
|
|
35
43
|
def retry(tries=3, delay=2, multiplier=2):
|
|
@@ -10,11 +10,7 @@ from rhdlcli.api import (
|
|
|
10
10
|
)
|
|
11
11
|
from rhdlcli.stats import check_download_folder_has_enough_space
|
|
12
12
|
from rhdlcli.files import get_files_to_remove, filter_files
|
|
13
|
-
from rhdlcli.fs import
|
|
14
|
-
mkdir_p,
|
|
15
|
-
delete_all_symlink_in_path,
|
|
16
|
-
recreate_symlinks,
|
|
17
|
-
)
|
|
13
|
+
from rhdlcli.fs import mkdir_p
|
|
18
14
|
|
|
19
15
|
|
|
20
16
|
def clean_download_folder(download_folder, files):
|
|
@@ -27,8 +23,6 @@ def clean_download_folder(download_folder, files):
|
|
|
27
23
|
print(f"Remove file {file}")
|
|
28
24
|
os.remove(file)
|
|
29
25
|
|
|
30
|
-
delete_all_symlink_in_path(download_folder)
|
|
31
|
-
|
|
32
26
|
|
|
33
27
|
def download_component(options):
|
|
34
28
|
component = get_component(options)
|
|
@@ -46,4 +40,3 @@ def download_component(options):
|
|
|
46
40
|
clean_download_folder(download_folder, files)
|
|
47
41
|
check_download_folder_has_enough_space(download_folder, files)
|
|
48
42
|
download_files(session, download_folder, files)
|
|
49
|
-
recreate_symlinks(download_folder, files_list["symlinks"])
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import errno
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def mkdir_p(path):
|
|
6
|
+
try:
|
|
7
|
+
os.makedirs(path)
|
|
8
|
+
except OSError as exc:
|
|
9
|
+
if exc.errno == errno.EEXIST and os.path.isdir(path):
|
|
10
|
+
pass
|
|
11
|
+
elif exc.errno in [errno.EPERM, errno.EACCES]:
|
|
12
|
+
print(f"Permission error on {path}")
|
|
13
|
+
else:
|
|
14
|
+
raise
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def create_parent_dir(path):
|
|
18
|
+
mkdir_p(os.path.dirname(path))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_config_path(env_variables):
|
|
22
|
+
path = env_variables.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
|
23
|
+
return os.path.join(path, "rhdl")
|
|
@@ -24,7 +24,7 @@ def build_options(cwd, arguments, env_variables):
|
|
|
24
24
|
options.update(
|
|
25
25
|
{
|
|
26
26
|
"app_config_path": app_config_path,
|
|
27
|
-
"base_url": env_variables.get("
|
|
27
|
+
"base_url": env_variables.get("RHDL_API_URL", credentials.get("base_url")),
|
|
28
28
|
"access_key": env_variables.get(
|
|
29
29
|
"RHDL_ACCESS_KEY", credentials.get("access_key")
|
|
30
30
|
),
|
|
@@ -10,7 +10,7 @@ def test_build_options():
|
|
|
10
10
|
["download", "RHEL-9.4", "-d", "/tmp/repo", "-t", "nightly"]
|
|
11
11
|
)
|
|
12
12
|
cwd = "/tmp"
|
|
13
|
-
env_variables = {"
|
|
13
|
+
env_variables = {"RHDL_API_URL": "", "RHDL_ACCESS_KEY": "", "RHDL_SECRET_KEY": ""}
|
|
14
14
|
options = build_options(cwd, arguments, env_variables)
|
|
15
15
|
assert options == {
|
|
16
16
|
"command": "download",
|
|
@@ -40,14 +40,14 @@ def test_build_options_transform_relative_folder_into_absolute_folder():
|
|
|
40
40
|
["download", "RHEL-9.4", "-d", "../home/rhdl", "-t", "nightly"]
|
|
41
41
|
)
|
|
42
42
|
cwd = "/tmp"
|
|
43
|
-
env_variables = {"
|
|
43
|
+
env_variables = {"RHDL_API_URL": "", "RHDL_ACCESS_KEY": "", "RHDL_SECRET_KEY": ""}
|
|
44
44
|
assert build_options(cwd, arguments, env_variables)["destination"] == "/home/rhdl"
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
def test_build_options_read_XDG_CONFIG_HOME_env_variable_for_app_config_path():
|
|
48
48
|
arguments = parse_arguments(["login"])
|
|
49
49
|
cwd = "/tmp"
|
|
50
|
-
env_variables = {"
|
|
50
|
+
env_variables = {"RHDL_API_URL": "", "RHDL_ACCESS_KEY": "", "RHDL_SECRET_KEY": ""}
|
|
51
51
|
assert build_options(cwd, arguments, env_variables)["app_config_path"].endswith(
|
|
52
52
|
".config/rhdl"
|
|
53
53
|
)
|
|
@@ -101,7 +101,7 @@ def test_build_options_read_env_variables_over_app_config_file_if_both_present(
|
|
|
101
101
|
cwd = "/tmp"
|
|
102
102
|
env_variables = {
|
|
103
103
|
"XDG_CONFIG_HOME": str(tmp_path),
|
|
104
|
-
"
|
|
104
|
+
"RHDL_API_URL": "http://localhost:5000",
|
|
105
105
|
"RHDL_ACCESS_KEY": "access_key",
|
|
106
106
|
"RHDL_SECRET_KEY": "secret_key",
|
|
107
107
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import errno
|
|
2
|
-
import os
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def mkdir_p(path):
|
|
6
|
-
try:
|
|
7
|
-
os.makedirs(path)
|
|
8
|
-
except OSError as exc:
|
|
9
|
-
if exc.errno == errno.EEXIST and os.path.isdir(path):
|
|
10
|
-
pass
|
|
11
|
-
elif exc.errno in [errno.EPERM, errno.EACCES]:
|
|
12
|
-
print(f"Permission error on {path}")
|
|
13
|
-
else:
|
|
14
|
-
raise
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def create_parent_dir(path):
|
|
18
|
-
mkdir_p(os.path.dirname(path))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def delete_all_symlink_in_path(path):
|
|
22
|
-
for root, dirs, files in os.walk(path):
|
|
23
|
-
for file in files:
|
|
24
|
-
file_path = os.path.join(root, file)
|
|
25
|
-
if os.path.islink(file_path):
|
|
26
|
-
os.unlink(file_path)
|
|
27
|
-
for dir in dirs:
|
|
28
|
-
folder_path = os.path.join(root, dir)
|
|
29
|
-
if os.path.islink(folder_path):
|
|
30
|
-
os.unlink(folder_path)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def recreate_symlinks(download_folder, symlinks):
|
|
34
|
-
for symlink in symlinks:
|
|
35
|
-
link_path = os.path.join(download_folder, symlink["path"], symlink["name"])
|
|
36
|
-
os.symlink(symlink["destination"], link_path)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def get_config_path(env_variables):
|
|
40
|
-
path = env_variables.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config"))
|
|
41
|
-
return os.path.join(path, "rhdl")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|