~juju-deployers/juju-deployer/trunk

« back to all changes in this revision

Viewing changes to deployer/service.py

  • Committer: Tim Van Steenburgh
  • Date: 2016-10-31 14:12:44 UTC
  • Revision ID: tvansteenburgh@gmail.com-20161031141244-rgfff5ev3dpj93q5
Fix sorting of unit names

Show diffs side-by-side

added added

removed removed

Lines of Context:
114
114
                svc.name, placement, u_idx)
115
115
            return None
116
116
        unit_names = list(svc_units.keys())
117
 
        unit_names.sort()
 
117
        unit_names.sort(key=lambda unit: int(unit.split('/')[1]))
118
118
        machine = (
119
119
            svc_units[unit_names[int(u_idx)]].get('Machine') or
120
120
            svc_units[unit_names[int(u_idx)]].get('machine')
121
121
        )
122
122
        if not machine:
123
123
            self.deployment.log.warning(
124
 
                "Application:%s deploy-with unit missing machine %s",
 
124
                "Application:%s deploy-with unit missing machine for %s",
125
125
                svc.name, unit_names[int(u_idx)])
126
126
            return None
127
127
        return self._format_placement(machine, container)