Exemple #1
0
  def _start_release(self, api, context):
    package, config_content = get_config(
        context.options.jobspec, context.options.version or 'latest')

    config = AuroraConfig.loads_json(config_content)
    resp = api.start_job_update(config, message='Release started by %s.' % getpass.getuser())

    if not resp.result:
      return package, None

    return package, resp.result.startJobUpdateResult.key.id
Exemple #2
0
 def _job_diff(self, api, context, config_content):
   # return true if jobs are diff, false if not
   config = AuroraConfig.loads_json(config_content)
   role, env, name = config.role(), config.environment(), config.name()
   resp = api.query(api.build_query(role, name, env=env, statuses=ACTIVE_STATES))
   context.log_response_and_raise(resp, err_code=EXIT_INVALID_PARAMETER,
       err_msg="Could not find job to diff against")
   if resp.result.scheduleStatusResult.tasks is None:
     context.print_err("No tasks found for job %s" % context.options.jobspec)
     return True
   else:
     remote_tasks = [t.assignedTask.task for t in resp.result.scheduleStatusResult.tasks]
   resp = api.populate_job_config(config)
   context.log_response_and_raise(resp, err_code=EXIT_INVALID_CONFIGURATION,
         err_msg="Error loading configuration")
   local_tasks = [resp.result.populateJobResult.taskConfig] * config.instances()
   if len(remote_tasks) != len(local_tasks):
     return True
   for task1, task2 in zip(remote_tasks, local_tasks):
     if task1 != task2:
       return True
   return False