@@ -130,23 +130,11 @@ def _is_sops_path(file_path: pathlib.Path) -> bool:
130130 # files with a ".sops.json" suffix.
131131 return bool (file_path .suffixes == [".sops" , ".json" ])
132132
133- # @staticmethod
134- # def _convert_to_sops_path(file_path: pathlib.Path) -> pathlib.Path:
135- # if _SOPSAwareFilesystemObjectStorageProvider._is_sops_path(file_path):
136- # return file_path
137- # else:
138- # if bool(file_path.suffix == ".json"):
139- # return file_path.with_name(file_path.stem + ".sops" + file_path.suffix)
140- # else:
141- # return file_path.with_suffix(file_path.suffix + ".sops.json")
142-
143133 @staticmethod
144134 def _filter_write_object (data : dict ) -> dict :
145- # TODO: consider making this part of the base class?
146135 final_data = {
147136 k : v
148137 for k , v in data .items ()
149- # if k not in [_SOPSAwareFilesystemObjectStorageProvider._STORAGE_TYPE_KEY]
150138 if not (isinstance (k , str ) and k .startswith ("__" ))
151139 }
152140 return final_data
@@ -213,7 +201,11 @@ def _do_sops(file_path: pathlib.Path, data: dict) -> bool:
213201 ):
214202 auth_logger .warning (msg = f"Data sourced from SOPS being written cleartext to the file { file_path } ." )
215203 # Upgrading to SOPS would be great, but also problematic.
216- # return True
204+ # The problem is that if we are writing to SOPS we should use a
205+ # SOPS file name so that we know we should read it as a SOPS file
206+ # later. We can't change the name here because the caller would
207+ # not know what we did, and may not be able to find the object
208+ # later.
217209
218210 return False
219211
@@ -224,9 +216,6 @@ def _save_file(file_path: pathlib.Path, data: dict):
224216 write_data = _SOPSAwareFilesystemObjectStorageProvider ._filter_write_object (data )
225217
226218 if do_sops :
227- # This has to be with the caller, otherwise the caller would not know
228- # where we actually wrote the data and would likely not be able to find it again.
229- # sops_file_path = _SOPSAwareFilesystemObjectStorageProvider._convert_to_sops_path(file_path)
230219 _SOPSAwareFilesystemObjectStorageProvider ._write_json_sops (file_path , write_data )
231220 else :
232221 _SOPSAwareFilesystemObjectStorageProvider ._write_json (file_path , write_data )
0 commit comments