Skip to content

Commit

Permalink
import subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
akaBotelho committed Oct 3, 2024
1 parent 4317bd5 commit 59acf79
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pipelines/serpro/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import os
# import os
import subprocess

from prefect.engine.state import State

Expand All @@ -10,10 +11,18 @@
def setup_serpro(secret_path: str = "radar_serpro"):
data = get_secret(secret_path=secret_path)["setup.sh"]
log("Got Secret")
os.popen("touch setup.sh")
# os.popen("touch setup.sh")
subprocess.run(["touch", "setup.sh"])
with open("setup.sh", "w") as f:
f.write(data)
return os.popen("sh setup.sh")

result = subprocess.run(["sh", "setup.sh"])

if result.returncode == 0:
log("setup.sh executou corretamente")

return result
# return os.popen("sh setup.sh")


def handler_setup_serpro(obj, old_state: State, new_state: State) -> State:
Expand Down

0 comments on commit 59acf79

Please sign in to comment.