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
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
def _build(self, session): session = utils.create_dict(**session) scheduling = {} utils.assign_and_remove(session, scheduling, 'schedule_start_date') utils.assign_and_remove(session, scheduling, 'schedule_interval') utils.assign_and_remove(session, scheduling, 'schedule_end_date') session['jobs'] = {} session['schedule'] = scheduling return self.client.sessions.create(session)
def _build(self, session): session = utils.create_dict(**session) scheduling = {} utils.assign_and_remove(session, scheduling, 'schedule_start_date') utils.assign_and_remove(session, scheduling, 'schedule_interval') utils.assign_and_remove(session, scheduling, 'schedule_end_date') session['jobs'] = {} session['schedule'] = scheduling return self.client.sessions.create(session)
def _build(self, action): """Get a flat action dict and convert it to a freezer action format """ action_rules = {} utils.assign_and_remove(action, action_rules, 'max_retries') utils.assign_and_remove(action, action_rules, 'max_retries_interval') utils.assign_and_remove(action, action_rules, 'mandatory') action = utils.create_dict(**action) action.pop('action_id', None) # if the backup name has spaces the tar metadata file cannot be found # so we replace " " for "_" backup_name = action.pop('backup_name', None) action['backup_name'] = backup_name.replace(' ', '_') action = {'freezer_action': action} return self.client.actions.create(action)
def _build(self, action): """Get a flat action dict and convert it to a freezer action format """ action_rules = {} utils.assign_and_remove(action, action_rules, 'max_retries') utils.assign_and_remove(action, action_rules, 'max_retries_interval') utils.assign_and_remove(action, action_rules, 'mandatory') action = utils.create_dict(**action) action.pop('action_id', None) # if the backup name has spaces the tar metadata file cannot be found # so we replace " " for "_" backup_name = action.pop('backup_name', None) action['backup_name'] = backup_name.replace(' ', '_') action = {'freezer_action': action} action.update(action_rules) return self.client.actions.create(action)
def update(self, action, action_id): updated_action = {} updated_action['freezer_action'] = utils.create_dict(**action) try: if action['mandatory'] != '': updated_action['mandatory'] = action['mandatory'] except KeyError: pass try: if action['max_retries'] != '': updated_action['max_retries'] = action['max_retries'] except KeyError: pass try: if action['max_retries_interval'] != '': updated_action['max_retries_interval'] =\ action['max_retries_interval'] except KeyError: pass return self.client.actions.update(action_id, updated_action)
def update(self, action, action_id): updated_action = {} updated_action['freezer_action'] = utils.create_dict(**action) try: if action['mandatory'] != '': updated_action['mandatory'] = action['mandatory'] except KeyError: pass try: if action['max_retries'] != '': updated_action['max_retries'] = action['max_retries'] except KeyError: pass try: if action['max_retries_interval'] != '': updated_action['max_retries_interval'] =\ action['max_retries_interval'] except KeyError: pass return self.client.actions.update(action_id, updated_action)