dayhoff-tools 1.1.17__py3-none-any.whl → 1.1.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dayhoff_tools/cli/cloud_commands.py +66 -0
- {dayhoff_tools-1.1.17.dist-info → dayhoff_tools-1.1.18.dist-info}/METADATA +1 -1
- {dayhoff_tools-1.1.17.dist-info → dayhoff_tools-1.1.18.dist-info}/RECORD +5 -5
- {dayhoff_tools-1.1.17.dist-info → dayhoff_tools-1.1.18.dist-info}/WHEEL +0 -0
- {dayhoff_tools-1.1.17.dist-info → dayhoff_tools-1.1.18.dist-info}/entry_points.txt +0 -0
@@ -902,6 +902,72 @@ def gcp_use_devcon_adc():
|
|
902
902
|
sys.exit(1)
|
903
903
|
|
904
904
|
|
905
|
+
@gcp_app.command("logout")
|
906
|
+
def gcp_logout():
|
907
|
+
"""Clear all GCP credentials for testing or role switching purposes.
|
908
|
+
|
909
|
+
This removes the active user's gcloud login, disables impersonation,
|
910
|
+
and invalidates Application Default Credentials (ADC).
|
911
|
+
"""
|
912
|
+
print(f"{BLUE}Clearing all GCP credentials...{NC}")
|
913
|
+
|
914
|
+
try:
|
915
|
+
gcloud_path = _find_executable("gcloud")
|
916
|
+
errors = []
|
917
|
+
|
918
|
+
# 1. Revoke user-level credentials
|
919
|
+
print(f"{BLUE}Revoking active gcloud credentials...{NC}")
|
920
|
+
revoke_cmd = [gcloud_path, "auth", "revoke", "--all", "--quiet"]
|
921
|
+
revoke_code, _, revoke_err = _run_command(revoke_cmd, capture=True, check=False)
|
922
|
+
if revoke_code != 0 and revoke_err:
|
923
|
+
errors.append(f"Failed to revoke credentials: {revoke_err}")
|
924
|
+
|
925
|
+
# 2. Unset impersonation config
|
926
|
+
print(f"{BLUE}Disabling service account impersonation...{NC}")
|
927
|
+
unset_code, _, unset_err = _gcloud_unset_config(
|
928
|
+
"auth/impersonate_service_account"
|
929
|
+
)
|
930
|
+
if unset_code != 0 and unset_err:
|
931
|
+
errors.append(f"Failed to unset impersonation: {unset_err}")
|
932
|
+
|
933
|
+
# 3. Revoke ADC
|
934
|
+
print(f"{BLUE}Revoking Application Default Credentials (ADC)...{NC}")
|
935
|
+
adc_cmd = [gcloud_path, "auth", "application-default", "revoke", "--quiet"]
|
936
|
+
adc_code, _, adc_err = _run_command(adc_cmd, capture=True, check=False)
|
937
|
+
|
938
|
+
# 4. Additionally remove ADC file if it exists (belt-and-suspenders approach)
|
939
|
+
adc_file = (
|
940
|
+
Path.home() / ".config" / "gcloud" / "application_default_credentials.json"
|
941
|
+
)
|
942
|
+
if adc_file.exists():
|
943
|
+
try:
|
944
|
+
adc_file.unlink()
|
945
|
+
print(f"{BLUE}Removed ADC file: {adc_file}{NC}")
|
946
|
+
except Exception as e:
|
947
|
+
errors.append(f"Failed to delete ADC file: {e}")
|
948
|
+
|
949
|
+
if errors:
|
950
|
+
print(f"{YELLOW}Logged out with some warnings:{NC}")
|
951
|
+
for err in errors:
|
952
|
+
print(f"{YELLOW} - {err}{NC}")
|
953
|
+
else:
|
954
|
+
print(f"{GREEN}Successfully logged out from GCP.{NC}")
|
955
|
+
|
956
|
+
# Always show how to log back in
|
957
|
+
print(f"\n{BLUE}To log back in:{NC}")
|
958
|
+
print(f" {YELLOW}dh gcp login{NC}")
|
959
|
+
|
960
|
+
# Show current (now-cleared) status
|
961
|
+
print(f"\n{BLUE}Current status:{NC}")
|
962
|
+
gcp_status()
|
963
|
+
|
964
|
+
except Exception as e:
|
965
|
+
print(f"{RED}Error during logout: {e}{NC}", file=sys.stderr)
|
966
|
+
print(f"{YELLOW}You may need to manually run:{NC}")
|
967
|
+
print(f" {YELLOW}gcloud auth revoke --all{NC}")
|
968
|
+
print(f" {YELLOW}gcloud auth application-default revoke{NC}")
|
969
|
+
|
970
|
+
|
905
971
|
# === End NEW ADC Commands ===
|
906
972
|
|
907
973
|
|
@@ -2,7 +2,7 @@ dayhoff_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
dayhoff_tools/chemistry/standardizer.py,sha256=uMn7VwHnx02nc404eO6fRuS4rsl4dvSPf2ElfZDXEpY,11188
|
3
3
|
dayhoff_tools/chemistry/utils.py,sha256=jt-7JgF-GeeVC421acX-bobKbLU_X94KNOW24p_P-_M,2257
|
4
4
|
dayhoff_tools/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
dayhoff_tools/cli/cloud_commands.py,sha256=
|
5
|
+
dayhoff_tools/cli/cloud_commands.py,sha256=NGux28-cjDyCADF-L1tjdEMzkCMYX8V4xNvpK6EWcZA,40802
|
6
6
|
dayhoff_tools/cli/main.py,sha256=47EGb28ALaYFc7oAUGlY1D66AIDmc4RZiXxN-gPVrpQ,4519
|
7
7
|
dayhoff_tools/cli/swarm_commands.py,sha256=5EyKj8yietvT5lfoz8Zx0iQvVaNgc3SJX1z2zQR6o6M,5614
|
8
8
|
dayhoff_tools/cli/utility_commands.py,sha256=PRShdh4O35JfjVxTOsduZ8-grGF5-SfXihcptcFT-hk,23584
|
@@ -26,7 +26,7 @@ dayhoff_tools/intake/uniprot.py,sha256=BZYJQF63OtPcBBnQ7_P9gulxzJtqyorgyuDiPeOJq
|
|
26
26
|
dayhoff_tools/logs.py,sha256=DKdeP0k0kliRcilwvX0mUB2eipO5BdWUeHwh-VnsICs,838
|
27
27
|
dayhoff_tools/sqlite.py,sha256=jV55ikF8VpTfeQqqlHSbY8OgfyfHj8zgHNpZjBLos_E,18672
|
28
28
|
dayhoff_tools/warehouse.py,sha256=TqV8nex1AluNaL4JuXH5zuu9P7qmE89lSo6f_oViy6U,14965
|
29
|
-
dayhoff_tools-1.1.
|
30
|
-
dayhoff_tools-1.1.
|
31
|
-
dayhoff_tools-1.1.
|
32
|
-
dayhoff_tools-1.1.
|
29
|
+
dayhoff_tools-1.1.18.dist-info/METADATA,sha256=9uJXFcLDGpuxssU_xBvmehDR58gPs-gFtKShHhEw4u4,2225
|
30
|
+
dayhoff_tools-1.1.18.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
31
|
+
dayhoff_tools-1.1.18.dist-info/entry_points.txt,sha256=iAf4jteNqW3cJm6CO6czLxjW3vxYKsyGLZ8WGmxamSc,49
|
32
|
+
dayhoff_tools-1.1.18.dist-info/RECORD,,
|
File without changes
|
File without changes
|