-
Notifications
You must be signed in to change notification settings - Fork 4
fixes done while validating solution for LGI Polaris project #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,8 @@ def __exit__(self, type, value, traceback): | |
| with self.file_system.create_file(self.file_path) as file_stream: | ||
| lines = ['---'] | ||
| for key, value in sorted(self.vars.items()): | ||
| lines.append(str(key) + ': "' + str(value) + '"') | ||
| # lines.append(str(key) + ": '" + str(value) + "'") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer to delete than to comment
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
| lines.append("{}: '{}'".format(str(key), str(value))) | ||
| file_stream.write(bytes(os.linesep.join(lines), 'utf-8')) | ||
| self.logger.debug(os.linesep.join(lines)) | ||
| self.logger.info('Done.') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,10 +67,11 @@ def _download(self, url, auth, logger, cancel_sampler, verify_certificate): | |
| if not response_valid and auth is None: | ||
| raise Exception('Please make sure the URL is valid, and the credentials are correct and necessary.') | ||
|
|
||
| generic_auth = auth.token if auth.token else auth.password | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is a different section intended to handle auth password further down, if the normal token path does not succeed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for supporting older customers that can't upgrade yet to also use tokens |
||
| # repo is private and token provided | ||
| if not response_valid and auth.token is not None: | ||
| if not response_valid and generic_auth is not None: | ||
| logger.info("Token provided. Starting download script with Token...") | ||
| headers = {"Authorization": "Bearer %s" % auth.token } | ||
| headers = {"Authorization": "Bearer %s" % generic_auth } | ||
| response = self.http_request_service.get_response_with_headers(url, headers, verify_certificate) | ||
|
|
||
| response_valid = self._is_response_valid(logger, response, "Token") | ||
|
|
@@ -79,9 +80,9 @@ def _download(self, url, auth, logger, cancel_sampler, verify_certificate): | |
| file_name = self.filename_extractor.get_filename(response) | ||
|
|
||
| # try again with authorization {"Private-Token": "%s" % token}, since gitlab uses that pattern | ||
| if not response_valid and auth.token is not None: | ||
| if not response_valid and generic_auth is not None: | ||
| logger.info("Token provided. Starting download script with Token (private-token pattern)...") | ||
| headers = {"Private-Token": "Bearer %s" % auth.token } | ||
| headers = {"Private-Token": "Bearer %s" % generic_auth } | ||
| response = self.http_request_service.get_response_with_headers(url, headers, verify_certificate) | ||
|
|
||
| response_valid = self._is_response_valid(logger, response, "Token") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 2.0.1 | ||
| 2.0.1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is purpose here?
can there be a password if no username?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there can be a token with no username. My use case here was backwards support of driver for users on system without the token attribute field available yet. If the token field is empty fallback to the password. Customers can use the driver and won't have to migrate attributes from password to token.