~frankban/juju-deployer/unit-placement-fix

« back to all changes in this revision

Viewing changes to deployer/action/importer.py

  • Committer: Francesco Banconi
  • Date: 2015-08-06 14:16:54 UTC
  • Revision ID: francesco.banconi@canonical.com-20150806141654-5g2kp0husctfmws1
Remove the reloading logic in importer.add_unit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
        self.log.debug("Adding units...")
20
20
        # Add units to existing services that don't match count.
21
21
        env_status = self.env.status()
22
 
        reloaded = False
23
22
 
24
23
        # Workaround an issue where watch output doesn't include subordinate
25
24
        # services right away, and add_unit would fail while attempting to add
58
57
                # Reload status before each placed unit is deployed, so that
59
58
                # co-location to other units can take place properly.
60
59
                env_status = self.env.status()
61
 
 
62
 
                # Reload status once after non placed services units are done.
63
 
                # XXX frankban: what is this for? Don't we already sleep above,
64
 
                # at the beginning of this for block? And why do we need the
65
 
                # reloaded logic?
66
 
                if reloaded is False:
67
 
                    # Improved crappy workaround juju-core api inconsistency
68
 
                    delay = time.time() + 60
69
 
                    while delay > time.time():
70
 
                        if svc.name in env_status['services']:
71
 
                            break
72
 
                        time.sleep(5.1)
73
 
                        env_status = self.env.status()
74
 
                    reloaded = True
75
 
 
76
60
                placement = self.deployment.get_unit_placement(svc, env_status)
77
61
                for mid in range(cur_units, svc.num_units):
78
62
                    self.env.add_unit(svc.name, placement.get(mid))