def __iter__(self):
        self._iter_next_list = []
        # look through all resources and build capability to uri index
        uris = {}
        for uri in self.keys():
            cap = self[uri].capability
            if (cap not in uris):
                uris[cap]=[]
            uris[cap].append(uri)
        # build list or uris in defined order for iterator
        for cap in self.order:
            if (cap in uris):
                for uri in sorted(uris[cap]):
                    self._iter_next_list.append(uri)
                del uris[cap]
        # add any left over capabilities we don't know about in alphabetical order
        for cap in uris:
            for uri in sorted(uris[cap]):
                self._iter_next_list.append(uri)
        self._iter_next_list.reverse()
        return(iter(self._iter_next, None))
Tests that a SaltCloudSystemExit is raised when something other than
dataset/ETHPy150Open resync/resync/resync/capability_list.py/CapabilitySet.__iter__--crossover with--dataset/ETHPy150Open saltstack/salt/tests/unit/cloud/clouds/opennebula_test.py/OpenNebulaTestCase.test_vm_monitoring_action_error