From dbe4ad92a1bb21fd66ece365f1f13cc0a9dd31ca Mon Sep 17 00:00:00 2001 From: David Lahm Date: Wed, 4 Sep 2024 12:29:56 +0200 Subject: [PATCH 1/3] add ini as possible choice for input-type, output-type. --- plugins/filter/decrypt.py | 4 +++- plugins/lookup/sops.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/filter/decrypt.py b/plugins/filter/decrypt.py index 2418cad..f652445 100644 --- a/plugins/filter/decrypt.py +++ b/plugins/filter/decrypt.py @@ -42,6 +42,7 @@ - json - yaml - dotenv + - ini default: yaml output_type: description: @@ -55,6 +56,7 @@ - json - yaml - dotenv + - ini default: yaml decode_output: description: @@ -111,7 +113,7 @@ from ansible_collections.community.sops.plugins.module_utils.sops import Sops, SopsError -_VALID_TYPES = set(['binary', 'json', 'yaml', 'dotenv']) +_VALID_TYPES = set(['binary', 'json', 'yaml', 'dotenv', 'ini']) def decrypt_filter(data, input_type='yaml', output_type='yaml', sops_binary='sops', rstrip=True, decode_output=True, diff --git a/plugins/lookup/sops.py b/plugins/lookup/sops.py index d6c8571..7c3f4c0 100644 --- a/plugins/lookup/sops.py +++ b/plugins/lookup/sops.py @@ -41,6 +41,7 @@ - json - yaml - dotenv + - ini output_type: description: - Tell SOPS how to interpret the decrypted file. @@ -53,6 +54,7 @@ - json - yaml - dotenv + - ini empty_on_not_exist: description: - When set to V(true), will not raise an error when a file cannot be found, From 69e28311b4a3ee64b5f3db2ee868b688813203aa Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 8 Sep 2024 17:06:37 +0200 Subject: [PATCH 2/3] Add note from when on new types are supported. --- plugins/filter/decrypt.py | 2 ++ plugins/lookup/sops.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/filter/decrypt.py b/plugins/filter/decrypt.py index f652445..728ec54 100644 --- a/plugins/filter/decrypt.py +++ b/plugins/filter/decrypt.py @@ -36,6 +36,7 @@ - There is no auto-detection since we do not have a filename. By default SOPS is told to treat the input as YAML. If that is wrong, please set this option to the correct value. + - The value V(ini) is available since community.sops 1.9.0. type: str choices: - binary @@ -50,6 +51,7 @@ - Please note that the output is always text or bytes, depending on the value of O(decode_output). To parse the resulting JSON or YAML, use corresponding filters such as P(ansible.builtin.from_json#filter) and P(ansible.builtin.from_yaml#filter). + - The value V(ini) is available since community.sops 1.9.0. type: str choices: - binary diff --git a/plugins/lookup/sops.py b/plugins/lookup/sops.py index 7c3f4c0..5b0851e 100644 --- a/plugins/lookup/sops.py +++ b/plugins/lookup/sops.py @@ -35,6 +35,7 @@ - By default, SOPS will chose the input type from the file extension. If it detects the wrong type for a file, this could result in decryption failing. + - The value V(ini) is available since community.sops 1.9.0. type: str choices: - binary @@ -48,6 +49,7 @@ - By default, SOPS will chose the output type from the file extension. If it detects the wrong type for a file, this could result in decryption failing. + - The value V(ini) is available since community.sops 1.9.0. type: str choices: - binary From 71876d28288bca05e4f0be4edd6fcb44f2524734 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 8 Sep 2024 17:08:24 +0200 Subject: [PATCH 3/3] Add changelog fragment. --- changelogs/fragments/204-input-output-type-ini.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/204-input-output-type-ini.yml diff --git a/changelogs/fragments/204-input-output-type-ini.yml b/changelogs/fragments/204-input-output-type-ini.yml new file mode 100644 index 0000000..a2e1258 --- /dev/null +++ b/changelogs/fragments/204-input-output-type-ini.yml @@ -0,0 +1,3 @@ +minor_changes: + - "decrypt filter plugin - now supports the input and output type ``ini`` (https://github.com/ansible-collections/community.sops/pull/204)." + - "sops lookup plugin - now supports the input and output type ``ini`` (https://github.com/ansible-collections/community.sops/pull/204)."