~mpontillo/maas/dns-template-changes-1.7

« back to all changes in this revision

Viewing changes to src/maasserver/models/bootresource.py

  • Committer: MaaS Lander
  • Author(s): Raphael Badin
  • Date: 2014-10-17 16:21:20 UTC
  • mfrom: (3263.2.1 revert-r-3263)
  • Revision ID: maas_lander-20141017162120-2f1sa7apve0uiryq
[r=andreserl][bug=][author=rvb] Revert revision 3263;  this change broke the CI: nodes cannot be commissioned (no-such-image error) with this change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
186
186
            else:
187
187
                rtypes = [BOOT_RESOURCE_TYPE.UPLOADED]
188
188
                name = image['release']
189
 
            matching_resources = resources.filter(
 
189
            resource = resources.filter(
190
190
                rtype__in=rtypes, name=name,
191
 
                architecture__startswith=image['architecture'])
192
 
            for resource in matching_resources:
193
 
                if resource is None:
194
 
                    # This shouldn't happen at all, but just to be sure.
195
 
                    continue
196
 
                if not resource.supports_subarch(image['subarchitecture']):
197
 
                    # This matching resource doesn't support the images
198
 
                    # subarchitecture, so its not a matching resource.
199
 
                    continue
200
 
                resource_set = resource.get_latest_complete_set()
201
 
                if resource_set is None:
202
 
                    # Possible that the import just started, and there is no
203
 
                    # set. Making it not a matching resource, as it cannot
204
 
                    # exist on the cluster unless it has a set.
205
 
                    continue
206
 
                if resource_set.label != image['label']:
207
 
                    # The label is different so the cluster has a different
208
 
                    # version of this set.
209
 
                    continue
210
 
                matched_resources.add(resource)
 
191
                architecture__startswith=image['architecture']).first()
 
192
            if resource is None:
 
193
                continue
 
194
            if not resource.supports_subarch(image['subarchitecture']):
 
195
                continue
 
196
            resource_set = resource.get_latest_complete_set()
 
197
            if resource_set is None:
 
198
                continue
 
199
            if resource_set.label != image['label']:
 
200
                continue
 
201
            matched_resources.add(resource)
211
202
        return list(matched_resources)
212
203
 
213
204
    def boot_images_are_in_sync(self, images):