juergbi commented on code in PR #1895:
URL: https://github.com/apache/buildstream/pull/1895#discussion_r1508820341
##########
src/buildstream/downloadablefilesource.py:
##########
@@ -145,7 +221,22 @@ class DownloadableFileSource(Source):
def configure(self, node):
self.original_url = node.get_str("url")
self.ref = node.get_str("ref", None)
- self.url = self.translate_url(self.original_url)
+
+ extra_data = {}
+ self.url = self.translate_url(self.original_url, extra_data=extra_data)
+ self.auth_header_format = extra_data.get("auth-header-format")
Review Comment:
Fail if `extra_deps` contains unknown keys?
##########
src/buildstream/downloadablefilesource.py:
##########
@@ -145,7 +221,22 @@ class DownloadableFileSource(Source):
def configure(self, node):
self.original_url = node.get_str("url")
self.ref = node.get_str("ref", None)
- self.url = self.translate_url(self.original_url)
+
+ extra_data = {}
+ self.url = self.translate_url(self.original_url, extra_data=extra_data)
+ self.auth_header_format = extra_data.get("auth-header-format")
+
+ #
+ # Validate the auth header format for a `{password}` formatting
identifier
+ #
+ if self.auth_header_format:
+ try:
+ self.auth_header_format.format(password="dummy")
+ except KeyError as e:
+ raise SourceError(
+ "SourceMirror specified auth-header-format without a
password", detail=self.auth_header_format
+ ) from e
Review Comment:
As I understand it, this raises an error if `auth_header_format` contains
non-`password` replacement fields but it doesn't raise an error if there is no
`{password}` field. At least the error message seems wrong but it would be
better if we could actually check that issue as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]