Skip to content

Commit

Permalink
Do not evaluate on 'nixops backup'. Allow backup to run on stopped/pa…
Browse files Browse the repository at this point in the history
…used machines.
  • Loading branch information
rbvermaa committed Jan 30, 2017
1 parent fc43d9c commit 4671155
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nixops/deployment.py
Expand Up @@ -802,15 +802,15 @@ def worker(m):


def backup(self, include=[], exclude=[]):
self.evaluate_active(include, exclude) # unnecessary?
backup_id = datetime.now().strftime("%Y%m%d%H%M%S")

def worker(m):
if not should_do(m, include, exclude): return
ssh_name = m.get_ssh_name()
res = subprocess.call(["ssh", "root@" + ssh_name] + m.get_ssh_flags() + ["sync"])
if res != 0:
m.logger.log("running sync failed on {0}.".format(m.name))
if m.state != m.STOPPED:
ssh_name = m.get_ssh_name()
res = subprocess.call(["ssh", "root@" + ssh_name] + m.get_ssh_flags() + ["sync"])
if res != 0:
m.logger.log("running sync failed on {0}.".format(m.name))
m.backup(self.definitions[m.name], backup_id)

nixops.parallel.run_tasks(nr_workers=5, tasks=self.active.itervalues(), worker_fun=worker)
Expand Down

0 comments on commit 4671155

Please sign in to comment.