mirror of
https://github.com/famedly/ansible-collection-base
synced 2024-11-10 06:24:17 +00:00
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:
parent
2b998d030d
commit
2a9003d198
2 changed files with 5 additions and 4 deletions
|
@ -94,7 +94,7 @@ class SecretStore:
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
raise 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(
|
file = Path(
|
||||||
(self.password_store_path / (slug + self.file_extension))
|
(self.password_store_path / (slug + self.file_extension))
|
||||||
.expanduser()
|
.expanduser()
|
||||||
|
@ -127,7 +127,7 @@ class SecretStore:
|
||||||
except (json.decoder.JSONDecodeError, yaml.YAMLError) as e:
|
except (json.decoder.JSONDecodeError, yaml.YAMLError) as e:
|
||||||
raise PasswordDecodeError
|
raise PasswordDecodeError
|
||||||
|
|
||||||
def __get_recipients_from_keyring(self) -> list[str]:
|
def __get_recipients_from_keyring(self):
|
||||||
recipients = []
|
recipients = []
|
||||||
for key in self.__gpg.list_keys():
|
for key in self.__gpg.list_keys():
|
||||||
if key["trust"] in [
|
if key["trust"] in [
|
||||||
|
@ -138,7 +138,7 @@ class SecretStore:
|
||||||
recipients.append(key["fingerprint"])
|
recipients.append(key["fingerprint"])
|
||||||
return recipients
|
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
|
base_path = self.password_store_path.expanduser().absolute() / password_slug
|
||||||
while base_path.as_posix() != "/":
|
while base_path.as_posix() != "/":
|
||||||
if os.path.isfile(base_path / self.pass_gpg_id_file):
|
if os.path.isfile(base_path / self.pass_gpg_id_file):
|
||||||
|
@ -157,7 +157,7 @@ class SecretStore:
|
||||||
data: Union[str, dict, list],
|
data: Union[str, dict, list],
|
||||||
data_type: str = None,
|
data_type: str = None,
|
||||||
recipient_method: str = "pass_file",
|
recipient_method: str = "pass_file",
|
||||||
recipients_list: list[str] = None,
|
recipients_list=None,
|
||||||
):
|
):
|
||||||
if not isinstance(data, str) and data_type is None:
|
if not isinstance(data, str) and data_type is None:
|
||||||
data_type = "yaml"
|
data_type = "yaml"
|
||||||
|
|
|
@ -21,6 +21,7 @@ DOCUMENTATION = r"""
|
||||||
module: gpg_secretstore
|
module: gpg_secretstore
|
||||||
author:
|
author:
|
||||||
- Jadyn Emma Jäger (@jadyndev)
|
- Jadyn Emma Jäger (@jadyndev)
|
||||||
|
- Lars Kaiser (@lrsksr)
|
||||||
requirements:
|
requirements:
|
||||||
- PyYAML >= 6.0
|
- PyYAML >= 6.0
|
||||||
- python >= 3.7
|
- python >= 3.7
|
||||||
|
|
Loading…
Reference in a new issue