From 85764ae6554af003d1d6eab3a6b171e15d4b7477 Mon Sep 17 00:00:00 2001 From: soksanichenko Date: Tue, 21 Jun 2022 09:56:58 +0300 Subject: [PATCH] ALBS-443: Integrate CodeNotary with git updater tool - Additional metadata for notarizing --- cas_wrapper.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/cas_wrapper.py b/cas_wrapper.py index e1e20a9..e5990a4 100644 --- a/cas_wrapper.py +++ b/cas_wrapper.py @@ -45,19 +45,32 @@ class CasWrapper: result_of_execution = command() return json.loads(result_of_execution)['hash'] - def authenticate(self, local_git_repo_path: str) -> bool: + def authenticate( + self, + local_path: str, + metadata: dict = None, + ): """ Wrapper around `cas authenticate` - :param local_git_repo_path: path to a local Git repo + :param local_path: path to a local Git repo + (should be started from `git://`) + or to a single local file + :param metadata: additional metadata :return: true if a commit is trusted, vice versa - false :rtype: bool """ command = self._cas[ 'authenticate', - f'git://{local_git_repo_path}', + local_path, '-o', 'json', ] + if metadata is not None: + for key, value in metadata.items(): + command = command[ + '-a', + f'{key}={value}', + ] try: result_of_execution = command() except ProcessExecutionError: