make code execution happen in the end
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
4e4d648593
commit
34ae8c2926
1 changed files with 13 additions and 4 deletions
15
bin/cdist
15
bin/cdist
|
@ -516,6 +516,12 @@ class Cdist:
|
|||
self.shell_run_or_debug_fail(bin, [bin], env=env, stdout=outfile_fd)
|
||||
outfile_fd.close()
|
||||
|
||||
status = os.stat(outfile)
|
||||
|
||||
# Remove output if empty, else make it executable
|
||||
if status.st_size == 0:
|
||||
os.unlink(outfile)
|
||||
else:
|
||||
os.chmod(outfile, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)
|
||||
|
||||
if mode == "code":
|
||||
|
@ -527,9 +533,12 @@ class Cdist:
|
|||
if os.path.isfile(bin):
|
||||
self.run_or_fail([bin], remote=False)
|
||||
|
||||
if os.path.isfile(os.path.join(local_dir, "code-remote")):
|
||||
remote_code = os.path.join(remote_dir, "code-remote")
|
||||
self.run_or_fail([remote_code], remote=True)
|
||||
|
||||
local_remote_code = os.path.join(local_dir, "code-remote")
|
||||
remote_remote_code = os.path.join(remote_dir, "code-remote")
|
||||
if os.path.isfile(local_remote_code):
|
||||
self.transfer_file(local_remote_code, remote_remote_code)
|
||||
self.run_or_fail([remote_remote_code], remote=True)
|
||||
|
||||
def deploy_to(self):
|
||||
"""Mimic the old deploy to: Deploy to one host"""
|
||||
|
|
Loading…
Reference in a new issue