Skip to content

Commit 7f92ccb

Browse files
authored
Merge pull request #212 from mdellweg/129_remote_headers
Add headers options to remotes
2 parents 39a6967 + 36fa882 commit 7f92ccb

File tree

11 files changed

+28170
-17853
lines changed

11 files changed

+28170
-17853
lines changed

plugins/doc_fragments/pulp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ class ModuleDocFragment(object):
9090
description:
9191
- URL to the upstream repository
9292
type: str
93+
headers:
94+
description:
95+
- Headers to pass to the remote server.
96+
Specified as a list of dictionaries with single entries so keys can be repeated.
97+
type: list
98+
elements: dict
9399
remote_username:
94100
description:
95101
- The username to authenticate with the remote repository.

plugins/module_utils/pulp_glue.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ def __init__(self, **kwargs):
224224
argument_spec = {
225225
"name": {},
226226
"url": {},
227+
"headers": {
228+
"type": "list",
229+
"elements": "dict",
230+
},
227231
"remote_username": {"no_log": True},
228232
"remote_password": {"no_log": True},
229233
"ca_cert": {},
@@ -263,6 +267,7 @@ def process(self, natural_key, desired_attributes):
263267
key: self.params[key]
264268
for key in [
265269
"url",
270+
"headers",
266271
"policy",
267272
"tls_validation",
268273
"proxy_url",

tests/fixtures/file_remote-0.yml

Lines changed: 28014 additions & 17712 deletions
Large diffs are not rendered by default.

tests/fixtures/file_remote-1.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- Squeezer/0.0.17-dev
12+
- Squeezer/0.2.0-dev
1313
method: GET
1414
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/?name=test_file_remote&offset=0&limit=1
1515
response:
1616
body:
17-
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/","pulp_created":"2024-08-28T12:51:58.611214Z","pulp_last_updated":"2024-08-28T12:51:58.611224Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":true,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"immediate","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":null,"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
17+
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/","prn":"prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","pulp_created":"2025-07-18T14:35:01.288714Z","pulp_last_updated":"2025-07-18T14:35:01.288723Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":true,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"immediate","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":[{"x-header-a":"AAA"},{"x-header-b":"BBB"}],"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
1818
headers:
1919
Access-Control-Expose-Headers:
2020
- Correlation-ID
@@ -23,15 +23,15 @@ interactions:
2323
Connection:
2424
- keep-alive
2525
Content-Length:
26-
- '818'
26+
- '922'
2727
Content-Type:
2828
- application/json
2929
Correlation-ID:
30-
- 86df51957d334d54b0c4e8c72da6089c
30+
- 4a96c0a428d04ef4943c66d8a94c4087
3131
Cross-Origin-Opener-Policy:
3232
- same-origin
3333
Date:
34-
- Wed, 28 Aug 2024 12:51:59 GMT
34+
- Fri, 18 Jul 2025 14:35:01 GMT
3535
Referrer-Policy:
3636
- same-origin
3737
Server:

tests/fixtures/file_remote-2.yml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- Squeezer/0.0.17-dev
12+
- Squeezer/0.2.0-dev
1313
method: GET
1414
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/?name=test_file_remote&offset=0&limit=1
1515
response:
1616
body:
17-
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/","pulp_created":"2024-08-28T12:51:58.611214Z","pulp_last_updated":"2024-08-28T12:51:58.611224Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":true,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"immediate","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":null,"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
17+
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/","prn":"prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","pulp_created":"2025-07-18T14:35:01.288714Z","pulp_last_updated":"2025-07-18T14:35:01.288723Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":true,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"immediate","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":[{"x-header-a":"AAA"},{"x-header-b":"BBB"}],"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
1818
headers:
1919
Access-Control-Expose-Headers:
2020
- Correlation-ID
@@ -23,15 +23,15 @@ interactions:
2323
Connection:
2424
- keep-alive
2525
Content-Length:
26-
- '818'
26+
- '922'
2727
Content-Type:
2828
- application/json
2929
Correlation-ID:
30-
- 93021c2381244fe1b92c1e01b48284d3
30+
- 6b245d89db4c41649c2b4e04ca2932ad
3131
Cross-Origin-Opener-Policy:
3232
- same-origin
3333
Date:
34-
- Wed, 28 Aug 2024 12:51:59 GMT
34+
- Fri, 18 Jul 2025 14:35:01 GMT
3535
Referrer-Policy:
3636
- same-origin
3737
Server:
@@ -56,17 +56,17 @@ interactions:
5656
- keep-alive
5757
Content-Length:
5858
- '48'
59-
Content-Type:
60-
- application/json
61-
Correlation-ID:
62-
- 93021c2381244fe1b92c1e01b48284d3
59+
Correlation-Id:
60+
- 6b245d89db4c41649c2b4e04ca2932ad
6361
User-Agent:
64-
- Squeezer/0.0.17-dev
62+
- Squeezer/0.2.0-dev
63+
content-type:
64+
- application/json
6565
method: PATCH
66-
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/
66+
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/
6767
response:
6868
body:
69-
string: '{"task":"/pulp/api/v3/tasks/0191990a-fbdd-7396-b122-5b781ea5342f/"}'
69+
string: '{"task":"/pulp/api/v3/tasks/01981df5-c247-7288-9500-8864383c13bb/"}'
7070
headers:
7171
Access-Control-Expose-Headers:
7272
- Correlation-ID
@@ -79,11 +79,11 @@ interactions:
7979
Content-Type:
8080
- application/json
8181
Correlation-ID:
82-
- 93021c2381244fe1b92c1e01b48284d3
82+
- 6b245d89db4c41649c2b4e04ca2932ad
8383
Cross-Origin-Opener-Policy:
8484
- same-origin
8585
Date:
86-
- Wed, 28 Aug 2024 12:51:59 GMT
86+
- Fri, 18 Jul 2025 14:35:02 GMT
8787
Referrer-Policy:
8888
- same-origin
8989
Server:
@@ -106,15 +106,15 @@ interactions:
106106
- gzip, deflate
107107
Connection:
108108
- keep-alive
109-
Correlation-ID:
110-
- 93021c2381244fe1b92c1e01b48284d3
109+
Correlation-Id:
110+
- 6b245d89db4c41649c2b4e04ca2932ad
111111
User-Agent:
112-
- Squeezer/0.0.17-dev
112+
- Squeezer/0.2.0-dev
113113
method: GET
114-
uri: http://pulp.example.org/pulp/api/v3/tasks/0191990a-fbdd-7396-b122-5b781ea5342f/
114+
uri: http://pulp.example.org/pulp/api/v3/tasks/01981df5-c247-7288-9500-8864383c13bb/
115115
response:
116116
body:
117-
string: '{"pulp_href":"/pulp/api/v3/tasks/0191990a-fbdd-7396-b122-5b781ea5342f/","pulp_created":"2024-08-28T12:51:59.581799Z","pulp_last_updated":"2024-08-28T12:51:59.581809Z","state":"completed","name":"pulpcore.app.tasks.base.general_update","logging_cid":"93021c2381244fe1b92c1e01b48284d3","created_by":"/pulp/api/v3/users/1/","unblocked_at":"2024-08-28T12:51:59.592584Z","started_at":"2024-08-28T12:51:59.593647Z","finished_at":"2024-08-28T12:51:59.598201Z","error":null,"worker":null,"parent_task":null,"child_tasks":[],"task_group":null,"progress_reports":[],"created_resources":[],"reserved_resources_record":["prn:file.fileremote:0191990a-f812-76e8-9afd-8fab40f568a6","shared:prn:core.domain:019192cc-cf85-7342-bd0e-2c2a7d3a272e"]}'
117+
string: '{"pulp_href":"/pulp/api/v3/tasks/01981df5-c247-7288-9500-8864383c13bb/","prn":"prn:core.task:01981df5-c247-7288-9500-8864383c13bb","pulp_created":"2025-07-18T14:35:02.088145Z","pulp_last_updated":"2025-07-18T14:35:02.088155Z","state":"completed","name":"pulpcore.app.tasks.base.ageneral_update","logging_cid":"6b245d89db4c41649c2b4e04ca2932ad","created_by":"/pulp/api/v3/users/1/","unblocked_at":"2025-07-18T14:35:02.094592Z","started_at":"2025-07-18T14:35:02.095385Z","finished_at":"2025-07-18T14:35:02.101827Z","error":null,"worker":null,"parent_task":null,"child_tasks":[],"task_group":null,"progress_reports":[],"created_resources":[],"reserved_resources_record":["prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","shared:prn:core.domain:7d8c4e1b-94d4-4d3f-89b7-4a67e6ba61ca"]}'
118118
headers:
119119
Access-Control-Expose-Headers:
120120
- Correlation-ID
@@ -123,15 +123,15 @@ interactions:
123123
Connection:
124124
- keep-alive
125125
Content-Length:
126-
- '730'
126+
- '790'
127127
Content-Type:
128128
- application/json
129129
Correlation-ID:
130-
- 93021c2381244fe1b92c1e01b48284d3
130+
- 6b245d89db4c41649c2b4e04ca2932ad
131131
Cross-Origin-Opener-Policy:
132132
- same-origin
133133
Date:
134-
- Wed, 28 Aug 2024 12:51:59 GMT
134+
- Fri, 18 Jul 2025 14:35:02 GMT
135135
Referrer-Policy:
136136
- same-origin
137137
Server:
@@ -154,15 +154,15 @@ interactions:
154154
- gzip, deflate
155155
Connection:
156156
- keep-alive
157-
Correlation-ID:
158-
- 93021c2381244fe1b92c1e01b48284d3
157+
Correlation-Id:
158+
- 6b245d89db4c41649c2b4e04ca2932ad
159159
User-Agent:
160-
- Squeezer/0.0.17-dev
160+
- Squeezer/0.2.0-dev
161161
method: GET
162-
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/
162+
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/
163163
response:
164164
body:
165-
string: '{"pulp_href":"/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/","pulp_created":"2024-08-28T12:51:58.611214Z","pulp_last_updated":"2024-08-28T12:51:59.596679Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":null,"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}'
165+
string: '{"pulp_href":"/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/","prn":"prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","pulp_created":"2025-07-18T14:35:01.288714Z","pulp_last_updated":"2025-07-18T14:35:02.099700Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":[{"x-header-a":"AAA"},{"x-header-b":"BBB"}],"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}'
166166
headers:
167167
Access-Control-Expose-Headers:
168168
- Correlation-ID
@@ -171,15 +171,15 @@ interactions:
171171
Connection:
172172
- keep-alive
173173
Content-Length:
174-
- '767'
174+
- '871'
175175
Content-Type:
176176
- application/json
177177
Correlation-ID:
178-
- 93021c2381244fe1b92c1e01b48284d3
178+
- 6b245d89db4c41649c2b4e04ca2932ad
179179
Cross-Origin-Opener-Policy:
180180
- same-origin
181181
Date:
182-
- Wed, 28 Aug 2024 12:51:59 GMT
182+
- Fri, 18 Jul 2025 14:35:02 GMT
183183
Referrer-Policy:
184184
- same-origin
185185
Server:

tests/fixtures/file_remote-3.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- Squeezer/0.0.17-dev
12+
- Squeezer/0.2.0-dev
1313
method: GET
1414
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/?name=test_file_remote&offset=0&limit=1
1515
response:
1616
body:
17-
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/","pulp_created":"2024-08-28T12:51:58.611214Z","pulp_last_updated":"2024-08-28T12:51:59.596679Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":null,"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
17+
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/","prn":"prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","pulp_created":"2025-07-18T14:35:01.288714Z","pulp_last_updated":"2025-07-18T14:35:02.099700Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":[{"x-header-a":"AAA"},{"x-header-b":"BBB"}],"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
1818
headers:
1919
Access-Control-Expose-Headers:
2020
- Correlation-ID
@@ -23,15 +23,15 @@ interactions:
2323
Connection:
2424
- keep-alive
2525
Content-Length:
26-
- '819'
26+
- '923'
2727
Content-Type:
2828
- application/json
2929
Correlation-ID:
30-
- 68d03863a02d4612b861d8b9586a3d7a
30+
- d37db92b3f924814b6353bae841f65ca
3131
Cross-Origin-Opener-Policy:
3232
- same-origin
3333
Date:
34-
- Wed, 28 Aug 2024 12:52:00 GMT
34+
- Fri, 18 Jul 2025 14:35:02 GMT
3535
Referrer-Policy:
3636
- same-origin
3737
Server:

tests/fixtures/file_remote-4.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ interactions:
99
Connection:
1010
- keep-alive
1111
User-Agent:
12-
- Squeezer/0.0.17-dev
12+
- Squeezer/0.2.0-dev
1313
method: GET
1414
uri: http://pulp.example.org/pulp/api/v3/remotes/file/file/?offset=0&limit=1000
1515
response:
1616
body:
17-
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/0191990a-f812-76e8-9afd-8fab40f568a6/","pulp_created":"2024-08-28T12:51:58.611214Z","pulp_last_updated":"2024-08-28T12:51:59.596679Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":null,"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
17+
string: '{"count":1,"next":null,"previous":null,"results":[{"pulp_href":"/pulp/api/v3/remotes/file/file/01981df5-bf28-7eb2-980a-4802a364c8cc/","prn":"prn:file.fileremote:01981df5-bf28-7eb2-980a-4802a364c8cc","pulp_created":"2025-07-18T14:35:01.288714Z","pulp_last_updated":"2025-07-18T14:35:02.099700Z","name":"test_file_remote","url":"https://example.org/file/PULP_MANIFEST","ca_cert":null,"client_cert":null,"tls_validation":false,"proxy_url":"http://proxy.int:3128","pulp_labels":{},"download_concurrency":null,"max_retries":null,"policy":"on_demand","total_timeout":null,"connect_timeout":null,"sock_connect_timeout":null,"sock_read_timeout":null,"headers":[{"x-header-a":"AAA"},{"x-header-b":"BBB"}],"rate_limit":null,"hidden_fields":[{"name":"client_key","is_set":false},{"name":"proxy_username","is_set":false},{"name":"proxy_password","is_set":false},{"name":"username","is_set":false},{"name":"password","is_set":false}]}]}'
1818
headers:
1919
Access-Control-Expose-Headers:
2020
- Correlation-ID
@@ -23,15 +23,15 @@ interactions:
2323
Connection:
2424
- keep-alive
2525
Content-Length:
26-
- '819'
26+
- '923'
2727
Content-Type:
2828
- application/json
2929
Correlation-ID:
30-
- eac5da43bb844a5fb89f45595f018e46
30+
- 31b9957da69447cf87e3c1b6754bd646
3131
Cross-Origin-Opener-Policy:
3232
- same-origin
3333
Date:
34-
- Wed, 28 Aug 2024 12:52:00 GMT
34+
- Fri, 18 Jul 2025 14:35:02 GMT
3535
Referrer-Policy:
3636
- same-origin
3737
Server:

0 commit comments

Comments
 (0)