Skip to content

Commit

Permalink
running scripts after tf
Browse files Browse the repository at this point in the history
  • Loading branch information
marlinspike committed Feb 3, 2022
1 parent df66926 commit bc0efd0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Binary file added img/tf_deployed2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added run_after_deploy.sh
Empty file.
16 changes: 10 additions & 6 deletions util/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@ def _run_terraform_init(self):
def _run_terraform(self):
args = ['terraform', f"-chdir={self.get_work_dir()}/example", 'apply', '-auto-approve']
res = self._run_process(args)
#with open(f"{self.get_work_dir()}/example/run_after_deploy.sh", 'r') as f:
# script = f.read()
#print(f"Running script:\n---\n {script}\n---\n")
#res = self._run_process(script,False, f"{self.get_work_dir()}/example", shell=True)
res = self._run_process(['source','./run_after_deploy.sh'], True, f"{self.get_work_dir()}/example", shell=True)
print(f"Executing run_after_deploy: {res}\n")
self._copy_scripts()
res = self._run_process('fetch-kubeconfig.sh', True, f"{self.get_work_dir()}/example", shell=False)
logger.debug(f"fetch-kubeconfig.sh: {res}\n")
res = self._run_process('fetch-ssh-key.sh', True, f"{self.get_work_dir()}/example", shell=False)
logger.debug(f"fetch-ssh-key.sh: {res}\n")
self.cout_success(res)

def _copy_scripts(self):
res = self._run_process(['cp', '/PyBuilder/working/dsop_rke2/scripts/*', '/PyBuilder/working/dsop_rke2/example'])
logger.debug(f"Copying script files to example directory")



def _run_process(self, args:list, read_output:bool=False, cwd:str="", shell:bool=False) -> str:
Expand Down

0 comments on commit bc0efd0

Please sign in to comment.