rhdl 0.1.0.post1729158829__tar.gz → 0.1.0.post1729715499__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.post1729158829/rhdl.egg-info → rhdl-0.1.0.post1729715499}/PKG-INFO +1 -1
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499/rhdl.egg-info}/PKG-INFO +1 -1
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/api.py +10 -2
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/cli.py +3 -2
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/downloader.py +1 -8
- rhdl-0.1.0.post1729715499/rhdlcli/fs.py +23 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/options.py +5 -4
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/tests/test_cli.py +1 -1
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/tests/test_files.py +1 -1
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/tests/test_options.py +4 -4
- rhdl-0.1.0.post1729158829/rhdlcli/fs.py +0 -41
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/LICENSE +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/MANIFEST.in +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/requirements.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdl.egg-info/SOURCES.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdl.egg-info/dependency_links.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdl.egg-info/entry_points.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdl.egg-info/requires.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdl.egg-info/top_level.txt +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/__init__.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/files.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/main.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/stats.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/validator.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/rhdlcli/version.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/setup.cfg +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/setup.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/tests/test_stats.py +0 -0
- {rhdl-0.1.0.post1729158829 → rhdl-0.1.0.post1729715499}/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):
|
|
@@ -9,7 +9,7 @@ examples:
|
|
|
9
9
|
# Login to RHDL
|
|
10
10
|
rhdl login
|
|
11
11
|
|
|
12
|
-
# download lastest RHEL-10 compose in
|
|
12
|
+
# download lastest RHEL-10 compose in <cwd>/RHEL-10 folder
|
|
13
13
|
rhdl download RHEL-10
|
|
14
14
|
|
|
15
15
|
# download latest RHEL-10 in /tmp/repo folder
|
|
@@ -39,6 +39,8 @@ def clean_with_default_values(parsed_arguments):
|
|
|
39
39
|
setattr(parsed_arguments, "include_and_exclude", DEFAULT_INCLUDE_EXCLUDE_LIST)
|
|
40
40
|
del parsed_arguments.include
|
|
41
41
|
del parsed_arguments.exclude
|
|
42
|
+
if parsed_arguments.destination is None:
|
|
43
|
+
setattr(parsed_arguments, "destination", f"./{parsed_arguments.compose}")
|
|
42
44
|
return vars(parsed_arguments)
|
|
43
45
|
|
|
44
46
|
|
|
@@ -71,7 +73,6 @@ def parse_arguments(arguments):
|
|
|
71
73
|
"-d",
|
|
72
74
|
"--destination",
|
|
73
75
|
metavar="DESTINATION",
|
|
74
|
-
default=".",
|
|
75
76
|
help="Destination folder where rhdl will download the compose",
|
|
76
77
|
)
|
|
77
78
|
parser.add_argument(
|
|
@@ -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")
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import getpass
|
|
1
2
|
import json
|
|
2
3
|
import os
|
|
3
4
|
import pathlib
|
|
@@ -24,7 +25,7 @@ def build_options(cwd, arguments, env_variables):
|
|
|
24
25
|
options.update(
|
|
25
26
|
{
|
|
26
27
|
"app_config_path": app_config_path,
|
|
27
|
-
"base_url": env_variables.get("
|
|
28
|
+
"base_url": env_variables.get("RHDL_API_URL", credentials.get("base_url")),
|
|
28
29
|
"access_key": env_variables.get(
|
|
29
30
|
"RHDL_ACCESS_KEY", credentials.get("access_key")
|
|
30
31
|
),
|
|
@@ -44,10 +45,10 @@ def login(options):
|
|
|
44
45
|
if not os.path.exists(app_config_path):
|
|
45
46
|
os.makedirs(app_config_path)
|
|
46
47
|
|
|
47
|
-
access_key = input("RHDL Access Key
|
|
48
|
-
secret_key =
|
|
48
|
+
access_key = input("RHDL Access Key: ")
|
|
49
|
+
secret_key = getpass.getpass("RHDL Secret Key: ")
|
|
49
50
|
default_base_url = "https://api.rhdl.distributed-ci.io"
|
|
50
|
-
base_url = input(f"RHDL server host
|
|
51
|
+
base_url = input(f"RHDL server host ({default_base_url}):") or default_base_url
|
|
51
52
|
credentials = {
|
|
52
53
|
"base_url": base_url,
|
|
53
54
|
"access_key": access_key,
|
|
@@ -3,7 +3,7 @@ from rhdlcli.cli import parse_arguments
|
|
|
3
3
|
|
|
4
4
|
def test_parse_arguments_when_no_options():
|
|
5
5
|
args = parse_arguments(["download", "RHEL-9.4"])
|
|
6
|
-
assert args["destination"] == "."
|
|
6
|
+
assert args["destination"] == "./RHEL-9.4"
|
|
7
7
|
assert args["tag"] == "milestone"
|
|
8
8
|
assert args["include_and_exclude"] == [
|
|
9
9
|
{"pattern": ".composeinfo", "type": "include"},
|
|
@@ -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
|