fix(gpg_secretstore): remove strong typing for python 3.7

Needs to be reverted as soon as the autodeployment hosts are on py 3.9
Manually reviewed in person due to gitlab outage
This commit is contained in:
Lars Kaiser 2021-07-15 20:52:04 +02:00 committed by Jan Christian Grünhage
parent 2b998d030d
commit 2a9003d198
No known key found for this signature in database
GPG key ID: EEC1170CE56FA2ED
2 changed files with 5 additions and 4 deletions

View file

@ -94,7 +94,7 @@ class SecretStore:
except FileNotFoundError:
raise FileNotFoundError
def __save(self, slug: str, data: str, recipients: list[str]) -> bool:
def __save(self, slug: str, data: str, recipients) -> bool:
file = Path(
(self.password_store_path / (slug + self.file_extension))
.expanduser()
@ -127,7 +127,7 @@ class SecretStore:
except (json.decoder.JSONDecodeError, yaml.YAMLError) as e:
raise PasswordDecodeError
def __get_recipients_from_keyring(self) -> list[str]:
def __get_recipients_from_keyring(self):
recipients = []
for key in self.__gpg.list_keys():
if key["trust"] in [
@ -138,7 +138,7 @@ class SecretStore:
recipients.append(key["fingerprint"])
return recipients
def __get_recipients_from_pass_file(self, password_slug: str) -> list[str]:
def __get_recipients_from_pass_file(self, password_slug: str):
base_path = self.password_store_path.expanduser().absolute() / password_slug
while base_path.as_posix() != "/":
if os.path.isfile(base_path / self.pass_gpg_id_file):
@ -157,7 +157,7 @@ class SecretStore:
data: Union[str, dict, list],
data_type: str = None,
recipient_method: str = "pass_file",
recipients_list: list[str] = None,
recipients_list=None,
):
if not isinstance(data, str) and data_type is None:
data_type = "yaml"

View file

@ -21,6 +21,7 @@ DOCUMENTATION = r"""
module: gpg_secretstore
author:
- Jadyn Emma Jäger (@jadyndev)
- Lars Kaiser (@lrsksr)
requirements:
- PyYAML >= 6.0
- python >= 3.7