ALBS-444 #2

Merged
anfimovdm merged 9 commits from ALBS-444 into master 2022-07-01 14:25:17 +00:00
Member
No description provided.
cas_wrapper.py Outdated
@ -96,0 +174,4 @@
self._logger.exception('Cannot notarize artifact:')
all_artifacts_is_notarized = False
continue
artifact.cas_hash = cas_artifact_hash
First-time contributor

It's bad practice to mutate arguments like this, can you return all artifacts with the respected hashes instead?

It's bad practice to mutate arguments like this, can you return all artifacts with the respected hashes instead?
Author
Member

Done

Done
anfimovdm marked this conversation as resolved
cas_wrapper.py Outdated
@ -96,0 +144,4 @@
use_hash: bool = False,
) -> bool:
is_authenticated = False
with self as cas:
First-time contributor

Instead of with self I would prefer self.ensure_login() or something, because you didn't use exit

Instead of `with self` I would prefer `self.ensure_login()` or something, because you didn't use __exit__
Author
Member

Done

Done
anfimovdm marked this conversation as resolved
soksanichenko left a comment

Add docstring to the new functions

Add docstring to the new functions
@ -96,0 +121,4 @@
# it should return 0 for authenticated and trusted commits
is_authenticated = not bool(
result_json.get('status', 1))
commit_cas_hash = result_json.get('hash')

You don't get hash because use_hash equals to Fasle by default

You don't get hash because use_hash equals to Fasle by default
Author
Member

I can get hash here, because when I use return_json flag, self.authenticate returns full JSON response

I can get hash here, because when I use `return_json` flag, `self.authenticate` returns full JSON response
anfimovdm marked this conversation as resolved
cas_wrapper.py Outdated
@ -96,0 +145,4 @@
# we can fall with ProcessExecutionError,
# because source can be not notarized
except ProcessExecutionError:
self._logger.exception('Cannot authenticate %s:', local_path)

I guess colon is not needed in the logging message or it's in wrong place of the message

I guess colon is not needed in the logging message or it's in wrong place of the message
anfimovdm marked this conversation as resolved
cas_wrapper.py Outdated
@ -96,0 +166,4 @@
try:
cas_artifact_hash = future.result()
except Exception:
self._logger.exception('Cannot notarize artifact:')

Add name of an artifact to the logging message

Add name of an artifact to the logging message
anfimovdm marked this conversation as resolved
Korulag approved these changes 2022-06-30 14:35:41 +00:00
anfimovdm merged commit 98ca413db7 into master 2022-07-01 14:25:17 +00:00
anfimovdm referenced this pull request from a commit 2022-07-01 14:25:17 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
almalinux/cas_wrapper!2
No description provided.