pulp-ansible 0.29.1__py3-none-any.whl → 0.29.3__py3-none-any.whl
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.
- pulp_ansible/app/__init__.py +1 -1
- pulp_ansible/app/serializers.py +16 -0
- pulp_ansible/app/tasks/collections.py +2 -3
- pulp_ansible/exceptions.py +26 -0
- pulp_ansible/tests/functional/api/collection/v3/test_proxy.py +5 -1
- pulp_ansible/tests/functional/api/collection/v3/test_sync.py +4 -2
- pulp_ansible/tests/functional/api/role/test_sync.py +16 -5
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/METADATA +1 -1
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/RECORD +13 -12
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/WHEEL +0 -0
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/entry_points.txt +0 -0
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/licenses/LICENSE +0 -0
- {pulp_ansible-0.29.1.dist-info → pulp_ansible-0.29.3.dist-info}/top_level.txt +0 -0
pulp_ansible/app/__init__.py
CHANGED
pulp_ansible/app/serializers.py
CHANGED
|
@@ -665,6 +665,22 @@ class CollectionVersionSerializer(ContentChecksumSerializer, CollectionVersionUp
|
|
|
665
665
|
|
|
666
666
|
creating = True
|
|
667
667
|
|
|
668
|
+
def __init__(self, *args, **kwargs):
|
|
669
|
+
super().__init__(*args, **kwargs)
|
|
670
|
+
try:
|
|
671
|
+
request = self.context["request"]
|
|
672
|
+
if request.method != "GET":
|
|
673
|
+
return
|
|
674
|
+
except (AttributeError, TypeError, KeyError):
|
|
675
|
+
# The serializer was not initialized with request context.
|
|
676
|
+
return
|
|
677
|
+
query_params = request.query_params
|
|
678
|
+
if self.include_arg_name in query_params or self.exclude_arg_name in query_params:
|
|
679
|
+
return
|
|
680
|
+
for fieldname in ["files", "manifest", "docs_blob", "contents"]:
|
|
681
|
+
# Redact these fields by default as they have no size limit.
|
|
682
|
+
self.fields.pop(fieldname)
|
|
683
|
+
|
|
668
684
|
def validate(self, data):
|
|
669
685
|
"""Run super() validate if creating, else return data."""
|
|
670
686
|
# This validation is for creating CollectionVersions
|
|
@@ -57,6 +57,7 @@ from semantic_version import SimpleSpec, Version
|
|
|
57
57
|
from semantic_version.base import Always
|
|
58
58
|
|
|
59
59
|
from pulp_ansible.app.constants import PAGE_SIZE
|
|
60
|
+
from pulp_ansible.exceptions import CollectionNotFound
|
|
60
61
|
from pulp_ansible.app.models import (
|
|
61
62
|
AnsibleCollectionDeprecated,
|
|
62
63
|
AnsibleNamespace,
|
|
@@ -841,9 +842,7 @@ class CollectionSyncFirstStage(Stage):
|
|
|
841
842
|
namespace not in self._unpaginated_collection_metadata
|
|
842
843
|
or name not in self._unpaginated_collection_metadata[namespace]
|
|
843
844
|
):
|
|
844
|
-
raise
|
|
845
|
-
f"Collection {namespace}.{name} does not exist on {self.remote.url}"
|
|
846
|
-
)
|
|
845
|
+
raise CollectionNotFound(namespace, name, self.remote.url)
|
|
847
846
|
|
|
848
847
|
if self._unpaginated_collection_metadata[namespace][name]["deprecated"]:
|
|
849
848
|
d_content = DeclarativeContent(
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from gettext import gettext as _
|
|
2
|
+
|
|
3
|
+
from pulpcore.plugin.exceptions import PulpException
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CollectionNotFound(PulpException):
|
|
7
|
+
error_code = "PLPAN01"
|
|
8
|
+
|
|
9
|
+
def __init__(self, namespace, name, url):
|
|
10
|
+
"""
|
|
11
|
+
:param url: The full URL that failed validation.
|
|
12
|
+
:type url: str
|
|
13
|
+
"""
|
|
14
|
+
# Work around a sudden api change in pulpcore 3.103.
|
|
15
|
+
try:
|
|
16
|
+
super().__init__()
|
|
17
|
+
except BaseException:
|
|
18
|
+
super().__init__(self.error_code)
|
|
19
|
+
self.namespace = namespace
|
|
20
|
+
self.name = name
|
|
21
|
+
self.url = url
|
|
22
|
+
|
|
23
|
+
def __str__(self):
|
|
24
|
+
return f"[{self.error_code}] " + _(
|
|
25
|
+
"Collection {namespace}.{name} does not exist on {url}"
|
|
26
|
+
).format(namespace=self.namespace, name=self.name, url=self.url)
|
|
@@ -77,6 +77,7 @@ def test_sync_through_http_proxy_with_auth(
|
|
|
77
77
|
|
|
78
78
|
@pytest.mark.parallel
|
|
79
79
|
def test_sync_through_http_proxy_with_auth_but_auth_not_configured(
|
|
80
|
+
has_pulp_plugin,
|
|
80
81
|
ansible_bindings,
|
|
81
82
|
ansible_repo,
|
|
82
83
|
ansible_collection_remote_factory,
|
|
@@ -101,4 +102,7 @@ def test_sync_through_http_proxy_with_auth_but_auth_not_configured(
|
|
|
101
102
|
monitor_task,
|
|
102
103
|
)
|
|
103
104
|
except PulpTaskError as exc:
|
|
104
|
-
|
|
105
|
+
if has_pulp_plugin("core", min="3.102"):
|
|
106
|
+
assert "[PLP0010]" in exc.task.error["description"]
|
|
107
|
+
else:
|
|
108
|
+
assert "407, message='Proxy Authentication Required'" in exc.task.error["description"]
|
|
@@ -72,6 +72,7 @@ class TestSync:
|
|
|
72
72
|
@pytest.mark.parametrize("mirror", (True, False))
|
|
73
73
|
def test_sync_absent_collection_from_pulp_fails(
|
|
74
74
|
self,
|
|
75
|
+
has_pulp_plugin,
|
|
75
76
|
ansible_bindings,
|
|
76
77
|
monitor_task,
|
|
77
78
|
ansible_repository_factory,
|
|
@@ -89,10 +90,11 @@ class TestSync:
|
|
|
89
90
|
result = ansible_bindings.RepositoriesAnsibleApi.sync(
|
|
90
91
|
repository.pulp_href, {"mirror": mirror}
|
|
91
92
|
)
|
|
92
|
-
message = "Collection absent.not_present does not exist on"
|
|
93
93
|
with pytest.raises(Exception) as exc_info:
|
|
94
94
|
monitor_task(result.task)
|
|
95
|
-
|
|
95
|
+
if has_pulp_plugin("core", min="3.102"):
|
|
96
|
+
assert "[PLPAN01]" in exc_info.value.task.error["description"]
|
|
97
|
+
assert "absent.not_present" in exc_info.value.task.error["description"]
|
|
96
98
|
|
|
97
99
|
@pytest.mark.parametrize("mirror", (True, False))
|
|
98
100
|
def test_resync_is_noop(
|
|
@@ -30,12 +30,23 @@ def test_role_sync(
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
@pytest.mark.parallel
|
|
33
|
-
def test_role_sync_invalid(
|
|
33
|
+
def test_role_sync_invalid(
|
|
34
|
+
has_pulp_plugin,
|
|
35
|
+
ansible_repo_factory,
|
|
36
|
+
ansible_role_remote_factory,
|
|
37
|
+
ansible_sync_factory,
|
|
38
|
+
):
|
|
39
|
+
# Note this is not a DNS lookup error.
|
|
40
|
+
# This url fails a check before even reaching out overthe network.
|
|
34
41
|
remote = ansible_role_remote_factory(url="http://i-am-an-invalid-url.com/invalid/")
|
|
35
42
|
|
|
36
43
|
with pytest.raises(PulpTaskError) as exc_info:
|
|
37
44
|
ansible_sync_factory(remote=remote.pulp_href)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
if has_pulp_plugin("core", min="3.102"):
|
|
46
|
+
# This should actually have been caught by validation of the remote.
|
|
47
|
+
assert "[PLP0000]" in exc_info.value.task.error["description"]
|
|
48
|
+
else:
|
|
49
|
+
assert (
|
|
50
|
+
exc_info.value.task.error["description"]
|
|
51
|
+
== "Could not determine API version for: http://i-am-an-invalid-url.com/invalid/"
|
|
52
|
+
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
pulp_ansible/__init__.py,sha256=WXL3JyOZzh4tALN4OBNgqj412O2LXVr8iYSn14Av0_o,67
|
|
2
|
+
pulp_ansible/exceptions.py,sha256=UsmjGBmQwv6XiRn-IwhnQdRf926FmaMyX2wwGNgCUmM,781
|
|
2
3
|
pulp_ansible/pytest_plugin.py,sha256=hi9crI7QGghXCItNx27pW6KoXMzZqhAqAUstpJrsmlA,9105
|
|
3
|
-
pulp_ansible/app/__init__.py,sha256=
|
|
4
|
+
pulp_ansible/app/__init__.py,sha256=0ZkB7eXaS8_K7Z2rTjiuVmduN-Dh4aqbI1Nhmcp4avQ,308
|
|
4
5
|
pulp_ansible/app/constants.py,sha256=cRrWMbJU-v1nCY2CjmGTOFGzz5aggn4ZKIs4-zeYADQ,78
|
|
5
6
|
pulp_ansible/app/downloaders.py,sha256=0xrAXzhTMJ6ywvs6XyYNAKvRzYb_UZR6A5_WgaHvuiE,8331
|
|
6
7
|
pulp_ansible/app/fields.py,sha256=yV3FL-47K-nxbiBxgzWi1hk3tfLsRdgic59LiwT2Fvs,624
|
|
@@ -8,7 +9,7 @@ pulp_ansible/app/global_access_conditions.py,sha256=ayV_LbQIa4ReuDYQycdDY7WysfGk
|
|
|
8
9
|
pulp_ansible/app/logutils.py,sha256=My4XivZMYLKeJqPHFwk3pIZSGlspALhI93vZxwWzlSY,846
|
|
9
10
|
pulp_ansible/app/modelresource.py,sha256=fJ_njrSWdftFQpA54e6mdoIWG_zqBjpp2TkkyU8Y7D4,7181
|
|
10
11
|
pulp_ansible/app/models.py,sha256=CrEcVxQUlb6V_d9l7_as7_Gi6TrBuJ_xJLhFCR_5jew,22709
|
|
11
|
-
pulp_ansible/app/serializers.py,sha256=
|
|
12
|
+
pulp_ansible/app/serializers.py,sha256=28lwMvLa3D-i4cekaIx50ffHUU78OfoDBlwdcTSTWyI,36670
|
|
12
13
|
pulp_ansible/app/settings.py,sha256=ArDsI7VezOpKM9iFqxXb6VmEDOtRUS5lfB_oklkcxds,1244
|
|
13
14
|
pulp_ansible/app/urls.py,sha256=gpMqsYPgHfc_6-EySR9ezUnI1F5yklzOVlSz9nlppmY,8697
|
|
14
15
|
pulp_ansible/app/utils.py,sha256=ClI_WvVy73kOZQB2mS8Gftf80Vye7pOxrbodTmPQgmk,1686
|
|
@@ -97,7 +98,7 @@ pulp_ansible/app/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
97
98
|
pulp_ansible/app/schema/__init__.py,sha256=eGi2QVJ0kJgXwiDNjQsvqWDSr3EA8TFqFZATTY8xwT8,207
|
|
98
99
|
pulp_ansible/app/schema/copy_config.json,sha256=AJz8riON7_rh-L7jM5iev2Imc5UKjlNvGfwF7KrFH7Y,568
|
|
99
100
|
pulp_ansible/app/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
100
|
-
pulp_ansible/app/tasks/collections.py,sha256=
|
|
101
|
+
pulp_ansible/app/tasks/collections.py,sha256=5mkOCS-FnT7Y69yahuUij-sduMoSKObhxMZtGQMGm4k,51038
|
|
101
102
|
pulp_ansible/app/tasks/collectionversion_index.py,sha256=_cnQeWRpFXrreTJM9aaEc2HuknTksZa0lLZ7XUfmQ_c,9401
|
|
102
103
|
pulp_ansible/app/tasks/copy.py,sha256=dO_DnLT5hck6GpZomEHurrDHJM0Wkh2B0_wgHHOtbuY,5563
|
|
103
104
|
pulp_ansible/app/tasks/deletion.py,sha256=f-VNTMzDMQiJpCLN34fY5gwhAGlh3RACj4VWc_tOaP0,3579
|
|
@@ -135,17 +136,17 @@ pulp_ansible/tests/functional/api/collection/v3/test_content_guard.py,sha256=lid
|
|
|
135
136
|
pulp_ansible/tests/functional/api/collection/v3/test_deletion.py,sha256=V25G4VgJybNeMbElunE1cOSm_6KRk8FkYBAW-L1ZLWc,11620
|
|
136
137
|
pulp_ansible/tests/functional/api/collection/v3/test_deprecation.py,sha256=n8khr_JySTXWDl-SiSDt4SLcdncMBGa5lBMIGyItyak,4185
|
|
137
138
|
pulp_ansible/tests/functional/api/collection/v3/test_namespace.py,sha256=6eOazDAQXnx3rxwhSX1cpSjWMrqj63DFtNnsHrswpGA,8828
|
|
138
|
-
pulp_ansible/tests/functional/api/collection/v3/test_proxy.py,sha256
|
|
139
|
+
pulp_ansible/tests/functional/api/collection/v3/test_proxy.py,sha256=-QFZu3f4mx4jimiTSZhf0MFYo9y4YOwSyXqLAarxERM,2969
|
|
139
140
|
pulp_ansible/tests/functional/api/collection/v3/test_redirects.py,sha256=ffolGXCJUp20YWk-ix_dWmCxtLN5yePHVywys3yDEZI,5170
|
|
140
141
|
pulp_ansible/tests/functional/api/collection/v3/test_serializers.py,sha256=uO2puJL-4K1HQz9oAmo828RavpiKFfFa4xR7_f7K3SQ,3036
|
|
141
|
-
pulp_ansible/tests/functional/api/collection/v3/test_sync.py,sha256=
|
|
142
|
+
pulp_ansible/tests/functional/api/collection/v3/test_sync.py,sha256=Hkb_D9g1tdMq9-Dap35BsENMcPJWAO1MQ4aSVtQRO1A,5324
|
|
142
143
|
pulp_ansible/tests/functional/api/git/__init__.py,sha256=_Ea-UgDCAz6Vl60TS1y0IrKZgRhNgIpgIzTsaXpqhrc,90
|
|
143
144
|
pulp_ansible/tests/functional/api/git/test_crud_remotes.py,sha256=2si9SV_VUmLtjQ01xUxn1d0kgTfyZxTgr9kAbamWKQk,1728
|
|
144
145
|
pulp_ansible/tests/functional/api/git/test_sync.py,sha256=DLYB2CJELz6IpEfbVLm1bLMjTcHmdeZ9NeETdhlId5c,6354
|
|
145
146
|
pulp_ansible/tests/functional/api/role/__init__.py,sha256=zfzTtnHbggPn45K_BOt_UGw89qYGrS-FFsU7SbaSPqw,68
|
|
146
147
|
pulp_ansible/tests/functional/api/role/test_crud_distribution.py,sha256=ws-uf1NZ9ozpAbeo0KJQOaCrGYmMSu4fYh2__gfmmps,3377
|
|
147
148
|
pulp_ansible/tests/functional/api/role/test_crud_remote.py,sha256=fQqIk2hc5jz-xcepP9qNWO_tpvuq8jpX2oLLOpbmjTQ,1816
|
|
148
|
-
pulp_ansible/tests/functional/api/role/test_sync.py,sha256=
|
|
149
|
+
pulp_ansible/tests/functional/api/role/test_sync.py,sha256=StiOo1XpDmyPy3mTbItSLPDXskykZE6f0zRiSBICFlk,1991
|
|
149
150
|
pulp_ansible/tests/functional/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
150
151
|
pulp_ansible/tests/functional/cli/test_collection_download_count.py,sha256=jG6hW40k_bH-gpPV2mnpvSJm0FXPkjxFbOCnWaZOPKI,3499
|
|
151
152
|
pulp_ansible/tests/functional/cli/test_collection_install.py,sha256=n0lQ-SkrbX4etsvjYjzs4z81gqZvtb84qo_Ph7N5Z2E,3772
|
|
@@ -167,9 +168,9 @@ pulp_ansible/tests/unit/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
|
167
168
|
pulp_ansible/tests/unit/migrations/conftest.py,sha256=61n56aJuwEuAcUS27xnmnEDx6Ie7M5zxh851doWm7Ok,438
|
|
168
169
|
pulp_ansible/tests/unit/migrations/test_0057_collection_version_sha256_migrate.py,sha256=NmU-frZNO1qHvhdxfw-bwPTEkqN4Wdc3dEs9dWME47o,2174
|
|
169
170
|
pulp_ansible/tests/unit/migrations/test_x_repo_search_migration.py,sha256=IrC_V_Gss4nqhkdL-60upcEzGcz8IsiI2d-MfUtFY-g,657
|
|
170
|
-
pulp_ansible-0.29.
|
|
171
|
-
pulp_ansible-0.29.
|
|
172
|
-
pulp_ansible-0.29.
|
|
173
|
-
pulp_ansible-0.29.
|
|
174
|
-
pulp_ansible-0.29.
|
|
175
|
-
pulp_ansible-0.29.
|
|
171
|
+
pulp_ansible-0.29.3.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
|
|
172
|
+
pulp_ansible-0.29.3.dist-info/METADATA,sha256=R4Ms9JM3R9aTLb94bGxKtPjzG-tcc2_OYguUZwtLrr8,3125
|
|
173
|
+
pulp_ansible-0.29.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
174
|
+
pulp_ansible-0.29.3.dist-info/entry_points.txt,sha256=6PFqCdT7Yn7U5MlioYRsyyWbJDcZI2aAJuzc7yXHqGk,119
|
|
175
|
+
pulp_ansible-0.29.3.dist-info/top_level.txt,sha256=5Rrg5DSM_F9wH8vu8Fxjb5EmroC-I8RVKp05fhXH6kQ,13
|
|
176
|
+
pulp_ansible-0.29.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|