1- """Module for custom click types regarding to ansible"""
1+ """Module for custom click types regarding to ansible. """
22
33import click
44import os
@@ -64,7 +64,7 @@ def convert(self, value, param, ctx):
6464 data = self .v .load (open (self .vault ).read ())
6565 except AnsibleError as e :
6666 if 'not vault encrypted data' in str (e ):
67- data = yaml .load (open (self .vault ).read (), SafeLoader ) or {}
67+ data = yaml .safe_load (open (self .vault ).read (), SafeLoader ) or {}
6868 except Exception as e :
6969 self .fail ('Decryption failed: {0}' .format (str (e )), param , ctx )
7070
@@ -74,26 +74,26 @@ def convert(self, value, param, ctx):
7474
7575 try :
7676 self .v .dump (data , open (self .vault , 'w' ))
77- except : # noqa: E722
77+ except Exception :
7878 self .fail ('Error while encrypting data' , param , ctx )
7979
8080 return self .path
8181
82- def _populate_data (self , input = {} , keys = [] , value = None ):
82+ def _populate_data (self , origin : dict = None , keys : list = None , value : str = None ):
8383 """Save value at the desired position in vault.
8484
8585 This method takes vault data, a list of keys where to store the value.
8686
87- :param input : The dictionary of vault data, defaults to {}
88- :type input : dict, optional
87+ :param origin : The dictionary of vault data, defaults to {}
88+ :type origin : dict, optional
8989 :param keys: List of keys that describe the desired position in vault, defaults to []
9090 :type keys: list, optional
9191 :param value: The value to store in vault, defaults to None
9292 :type value: str, optional
9393 :return: The vault data extended by `value` at the desired position.
9494 :rtype: dict
9595 """
96- data = input .copy ()
96+ data = origin .copy ()
9797
9898 if keys :
9999 key = keys [0 ]
0 commit comments