Beispiel #1
0
 def run(self):
     errors = []
     if repo_utils.rebalance_sync_schedule(errors):
         return "Sync schedule rebalanced"
     else:
         return TaskExecutionError("Error(s) rebalancing sync schedule: %s" %
                                   ", ".join(errors))
Beispiel #2
0
 def handle(self, *args, **options):
     errors = []
     self.setup_pulp()
     if rebalance_sync_schedule(errors=errors):
         self.stdout.write("Successfully rebalanced sync schedules\n")
     else:
         self.stderr.write("Encountered errors while rebalancing sync schedules:\n")
         self.stderr.write("\n".join(errors))
Beispiel #3
0
            self.update("Repository %s synced, adding filters" % repo_id)
        except Exception, err:
            self.update("Repository %s failed to sync: %s" % (repo_id, err),
                        state="ERROR")

        repo = repo_utils.get_repo(repo_id)
        errors = []
        if repo_utils.set_filters(repo, filters, errors=errors):
            self.update("Filters added to %s" % repo_id)
        else:
            self.update("Error adding filters to %s: %s" % (repo_id,
                                                            ", ".join(errors)),
                        state="ERROR")

        errors = []
        if not repo_utils.rebalance_sync_schedule(errors):
            for error in errors:
                self.update(error, state="ERROR")

        if self.errors:
            raise TaskExecutionError("Created %s (%s), but encountered errors: "
                                     "%s" %
                                     (name, repo_id, self.errors))
        else:
            return "Successfully created repo %s" % repo['name']

tasks.register(CreateRepo)


class CloneRepo(TrackedTask):
    def run(self, clone_id, name=None, parent=None, groups=None, filters=None):