Skip to content

Commit

Permalink
Use yaml output on .yml files too (#165)
Browse files Browse the repository at this point in the history
* Use yaml output on .yml files too

* Added changelog fragment

* Apply suggestions from code review

Co-authored-by: Felix Fontein <[email protected]>

---------

Co-authored-by: Felix Fontein <[email protected]>
  • Loading branch information
applejag and felixfontein authored Oct 20, 2023
1 parent a481eee commit b8af869
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/165-yaml-output-for-yml-extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- sops_encrypt - ensure that output-type is set to ``yaml`` when the file extension ``.yml`` is used. Now both ``.yaml`` and ``.yml`` files use the SOPS ``--output-type=yaml`` formatting (https://github.com/ansible-collections/community.sops/issues/164).
2 changes: 1 addition & 1 deletion plugins/modules/sops_encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def get_option_value(argument_name):
output_type = None
if path.endswith('.json'):
output_type = 'json'
elif path.endswith('.yaml'):
elif path.endswith('.yaml') or path.endswith('.yml'):
output_type = 'yaml'
data = Sops.encrypt(
data=input_data, cwd=directory, input_type=input_type, output_type=output_type,
Expand Down

0 comments on commit b8af869

Please sign in to comment.