Skip to content

Commit c84b7a2

Browse files
remove comments
1 parent df5c364 commit c84b7a2

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

src/planet_auth/storage_utils.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

tests/test_planet_auth/unit/auth/auth_clients/oidc/test_oidc_request_authenticator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def _filter_spdata(data: dict) -> dict:
8080
filtered_data = {
8181
k: v
8282
for k, v in data.items()
83-
# if k not in [_SOPSAwareFilesystemObjectStorageProvider._STORAGE_TYPE_KEY]
8483
if not (isinstance(k, str) and k.startswith("__"))
8584
}
8685
return filtered_data

tests/test_planet_auth/unit/auth/test_storage_utils_file_backed_json_object.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def _filter_spdata(data: dict) -> dict:
9595
filtered_data = {
9696
k: v
9797
for k, v in data.items()
98-
# if k not in [_SOPSAwareFilesystemObjectStorageProvider._STORAGE_TYPE_KEY]
9998
if not (isinstance(k, str) and k.startswith("__"))
10099
}
101100
return filtered_data

0 commit comments

Comments
 (0)