~rodsmith/checkbox/ipmi_pxe_test_removal

« back to all changes in this revision

Viewing changes to plainbox/plainbox/impl/secure/providers/v1.py

  • Committer: Tarmac
  • Author(s): Zygmunt Krynicki
  • Date: 2013-12-23 18:45:15 UTC
  • mfrom: (2578.1.2 launchpad/load-all-jobs)
  • Revision ID: tarmac-20131223184515-0hovz9zqlkasfm86
"automatic merge by tarmac [r=zkrynicki][bug=][author=zkrynicki]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
"""
24
24
 
25
25
import errno
26
 
import io
27
26
import itertools
28
27
import logging
29
28
import os
273
272
            if there were any problems accessing files or directories.
274
273
            Note that OSError is silently ignored when the `jobs_dir`
275
274
            directory is missing.
 
275
 
 
276
        ..note::
 
277
            This method should not be used anymore. Consider transitioning your
 
278
            code to :meth:`load_all_jobs()` which is more reliable.
 
279
        """
 
280
        job_list, problem_list = self.load_all_jobs()
 
281
        if problem_list:
 
282
            raise problem_list[0]
 
283
        else:
 
284
            return job_list
 
285
 
 
286
    def load_all_jobs(self):
 
287
        """
 
288
        Load and parse all of the job definitions of this provider.
 
289
 
 
290
        Unlike :meth:`get_builtin_jobs()` this method does not stop after the
 
291
        first problem encountered and instead collects all of the problems into
 
292
        a list which is returned alongside the job list.
 
293
 
 
294
        :returns:
 
295
            Pair (job_list, problem_list) where each job_list is a sorted list
 
296
            of JobDefinition objects and each item from problem_list is an
 
297
            exception.
276
298
        """
277
299
        self._job_collection.load()
278
 
        if self._job_collection.problem_list:
279
 
            raise self._job_collection.problem_list[0]
280
 
        else:
281
 
            return sorted(
282
 
                itertools.chain(
283
 
                    *self._job_collection.get_all_plugin_objects()),
284
 
                key=lambda job: job.name)
 
300
        job_list = sorted(
 
301
            itertools.chain(
 
302
                *self._job_collection.get_all_plugin_objects()),
 
303
            key=lambda job: job.name)
 
304
        problem_list = self._job_collection.problem_list
 
305
        return job_list, problem_list
285
306
 
286
307
    def get_all_executables(self):
287
308
        """