Example #1
0
    def _build(self, job):
        action_ids = utils.get_action_ids(job.pop('actions'))
        job = utils.create_dict(**job)
        clients = job.pop('clients', [])
        scheduling = {}
        new_job = {}
        utils.assign_and_remove(job, scheduling, 'schedule_start_date')
        utils.assign_and_remove(job, scheduling, 'schedule_interval')
        utils.assign_and_remove(job, scheduling, 'schedule_end_date')

        actions = self._get_actions_in_job(action_ids)

        new_job['description'] = job.get('description')
        new_job['job_actions'] = actions
        new_job['job_schedule'] = scheduling

        for client_id in clients:

            search = client_id
            client = Client(self.request).list(search=search)

            new_job['client_id'] = client[0].id
            job_id = self.client.jobs.create(new_job)
            self.stop(job_id)
        return True
Example #2
0
    def _build(self, job):
        action_ids = utils.get_action_ids(job.pop('actions'))
        job = utils.create_dict(**job)
        clients = job.pop('clients', [])
        scheduling = {}
        new_job = {}
        utils.assign_and_remove(job, scheduling, 'schedule_start_date')
        utils.assign_and_remove(job, scheduling, 'schedule_interval')
        utils.assign_and_remove(job, scheduling, 'schedule_end_date')

        actions = self._get_actions_in_job(action_ids)

        new_job['description'] = job.get('description')
        new_job['job_actions'] = actions
        new_job['job_schedule'] = scheduling

        for client_id in clients:

            search = client_id
            client = Client(self.request).list(search=search)

            new_job['client_id'] = client[0].id
            job_id = self.client.jobs.create(new_job)
            self.stop(job_id)
        return True
Example #3
0
 def update_actions(self, job_id, action_ids):
     ids = utils.get_action_ids(action_ids)
     job = self.get(job_id, json=True)
     job.pop('job_actions', None)
     actions = self._get_actions_in_job(ids)
     job['job_actions'] = actions
     return self.client.jobs.update(job_id, job)
Example #4
0
 def update_actions(self, job_id, action_ids):
     ids = utils.get_action_ids(action_ids)
     job = self.get(job_id, json=True)
     job.pop('job_actions', None)
     actions = self._get_actions_in_job(ids)
     job['job_actions'] = actions
     return self.client.jobs.update(job_id, job)