about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFranck Cuny <fcuny@roblox.com>2024-05-06 16:35:59 -0700
committerFranck Cuny <fcuny@roblox.com>2024-05-06 16:35:59 -0700
commit7e25a2499a5d62c8efc17f0540097a9608bb083c (patch)
treed93c5b133da6493c1d3d7df28e837a5e757b85b4 /src
parentmove ghabilling to python (diff)
downloadworld-7e25a2499a5d62c8efc17f0540097a9608bb083c.tar.gz
lint and fmt
Diffstat (limited to '')
-rwxr-xr-xsrc/cli/hashi_env.py16
-rwxr-xr-xsrc/cli/nomad_allocs.py8
2 files changed, 7 insertions, 17 deletions
diff --git a/src/cli/hashi_env.py b/src/cli/hashi_env.py
index aeac5ef..57708a8 100755
--- a/src/cli/hashi_env.py
+++ b/src/cli/hashi_env.py
@@ -1,9 +1,9 @@
 #!/usr/bin/env python3
 
-import datetime
-import hashlib
-import json
 import os
+import json
+import hashlib
+import datetime
 
 import click
 import requests
@@ -53,11 +53,7 @@ def get_ldap_password() -> str:
     """Return the LDAP password.
     The password is expected to be in 1password, under `LDAP'.
     """
-    return (
-        os.popen(f"/usr/local/bin/op read op://{op_vault}/LDAP/password")
-        .read()
-        .rstrip()
-    )
+    return os.popen(f"/usr/local/bin/op read op://{op_vault}/LDAP/password").read().rstrip()
 
 
 def _get_token_from_cache(addr: str) -> str | None:
@@ -109,9 +105,7 @@ def _vault_login(addr: str) -> str:
     except Exception as e:
         print("{} returned {}".format(url, str(e)))
 
-    expires_after = datetime.datetime.now() + datetime.timedelta(
-        seconds=resp.json()["auth"]["lease_duration"]
-    )
+    expires_after = datetime.datetime.now() + datetime.timedelta(seconds=resp.json()["auth"]["lease_duration"])
     token = resp.json()["auth"]["client_token"]
 
     _set_token_to_cache(addr, token, expires_after)
diff --git a/src/cli/nomad_allocs.py b/src/cli/nomad_allocs.py
index f2369bb..868fea9 100755
--- a/src/cli/nomad_allocs.py
+++ b/src/cli/nomad_allocs.py
@@ -28,13 +28,9 @@ def cli(job, dc, token):
     for task in resp.json():
         task_name = list(task["TaskStates"].keys())[0]
         if task["TaskStates"][task_name]["State"] == "running":
-            running_tasks.append(
-                f"https://{dc}-nomad.simulprod.com/ui/allocations/{task['ID']}/{task_name}/logs"
-            )
+            running_tasks.append(f"https://{dc}-nomad.simulprod.com/ui/allocations/{task['ID']}/{task_name}/logs")
         else:
-            terminated_tasks.append(
-                f"https://{dc}-nomad.simulprod.com/ui/allocations/{task['ID']}/{task_name}/logs"
-            )
+            terminated_tasks.append(f"https://{dc}-nomad.simulprod.com/ui/allocations/{task['ID']}/{task_name}/logs")
 
     if len(running_tasks) > 0:
         print("running tasks")