ALBS-444 #2

Merged
anfimovdm merged 9 commits from ALBS-444 into master 2022-07-01 14:25:17 +00:00
1 changed files with 4 additions and 6 deletions
Showing only changes of commit fa16027062 - Show all commits

View File

@ -122,8 +122,7 @@ class CasWrapper:
self.ensure_login()
try:
result_json = self.authenticate(local_path, return_json=True)
anfimovdm marked this conversation as resolved
Review

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
Review

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
# it should return 0 for authenticated and trusted commits
is_authenticated = not bool(result_json['status'])
is_authenticated = result_json['verified']
commit_cas_hash = result_json['hash']
# we can fall with ProcessExecutionError,
# because source can be not notarized
@ -135,7 +134,6 @@ class CasWrapper:
self,
local_path: str,
use_hash: bool = False,
return_json: bool = False,
) -> bool:
"""
Authenticates artifact by artifact path or hash if `use_hash` is True.
@ -147,10 +145,10 @@ class CasWrapper:
is_authenticated = self.authenticate(
local_path,
use_hash=use_hash,
anfimovdm marked this conversation as resolved Outdated

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__

Done

Done
return_json=return_json,
)
return_json=True,
anfimovdm marked this conversation as resolved Outdated

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
)['verified']
# we can fall with ProcessExecutionError,
# because source can be not notarized
# because artifact can be not notarized
except ProcessExecutionError:
self._logger.exception('Cannot authenticate: %s', local_path)
return is_authenticated