Ejemplo n.º 1
0
 def render_GET(self, request):
     include_job_runs = requestargs.get_bool(
         request,
         'include_job_runs',
         default=False,
     )
     include_action_runs = requestargs.get_bool(
         request,
         'include_action_runs',
         default=False,
     )
     include_action_graph = requestargs.get_bool(
         request,
         'include_action_graph',
         default=True,
     )
     include_node_pool = requestargs.get_bool(
         request,
         'include_node_pool',
         default=True,
     )
     response = dict(
         jobs=self.get_data(
             include_job_runs,
             include_action_runs,
             include_action_graph,
             include_node_pool,
         ),
     )
     return respond(request=request, response=response)
Ejemplo n.º 2
0
 def render_GET(self, request):
     include_job_runs = requestargs.get_bool(request, 'include_job_runs')
     include_action_runs = requestargs.get_bool(request,
                                                'include_action_runs')
     output = dict(
         jobs=self.get_data(include_job_runs, include_action_runs))
     return respond(request, output)
Ejemplo n.º 3
0
 def render_GET(self, request):
     include_job_runs = requestargs.get_bool(
         request,
         'include_job_runs',
         default=False,
     )
     include_action_runs = requestargs.get_bool(
         request,
         'include_action_runs',
         default=False,
     )
     include_action_graph = requestargs.get_bool(
         request,
         'include_action_graph',
         default=True,
     )
     include_node_pool = requestargs.get_bool(
         request,
         'include_node_pool',
         default=True,
     )
     response = dict(
         jobs=self.get_data(
             include_job_runs,
             include_action_runs,
             include_action_graph,
             include_node_pool,
         ),
     )
     return respond(request=request, response=response)
Ejemplo n.º 4
0
 def render_GET(self, request):
     include_job_runs = requestargs.get_bool(request, 'include_job_runs')
     include_action_runs = requestargs.get_bool(request, 'include_action_runs')
     namespace = requestargs.get_string(request, 'namespace')
     output = dict(jobs=self.get_data(include_job_runs, include_action_runs,
         namespace))
     return respond(request, output)
Ejemplo n.º 5
0
 def render_GET(self, request):
     include_runs = requestargs.get_bool(request, "include_action_runs")
     include_graph = requestargs.get_bool(request, "include_action_graph")
     run_adapter = adapter.JobRunAdapter(
         self.job_run, include_action_runs=include_runs, include_action_graph=include_graph
     )
     return respond(request, run_adapter.get_repr())
Ejemplo n.º 6
0
 def render_GET(self, request):
     include_runs = requestargs.get_bool(request, 'include_action_runs')
     include_graph = requestargs.get_bool(request, 'include_action_graph')
     run_adapter = adapter.JobRunAdapter(self.job_run,
                                         include_action_runs=include_runs,
                                         include_action_graph=include_graph)
     return respond(request, run_adapter.get_repr())
Ejemplo n.º 7
0
 def render_GET(self, request):
     run_adapter = adapter.ActionRunAdapter(
         self.action_run,
         self.job_run,
         requestargs.get_integer(request, 'num_lines'),
         include_stdout=requestargs.get_bool(request, 'include_stdout'),
         include_stderr=requestargs.get_bool(request, 'include_stderr'))
     return respond(request, run_adapter.get_repr())
Ejemplo n.º 8
0
 def render_GET(self, request):
     run_adapter = adapter.ActionRunAdapter(
         self.action_run,
         self.job_run,
         requestargs.get_integer(request, 'num_lines'),
         include_stdout=requestargs.get_bool(request, 'include_stdout'),
         include_stderr=requestargs.get_bool(request, 'include_stderr'))
     return respond(request, run_adapter.get_repr())
Ejemplo n.º 9
0
 def render_GET(self, request):
     include_action_runs = requestargs.get_bool(request, 'include_action_runs')
     include_graph = requestargs.get_bool(request, 'include_action_graph')
     num_runs = requestargs.get_integer(request, 'num_runs')
     job_adapter = adapter.JobAdapter(
             self.job_scheduler.get_job(),
             include_job_runs=True,
             include_action_runs=include_action_runs,
             include_action_graph=include_graph,
             num_runs=num_runs)
     return respond(request, job_adapter.get_repr())
Ejemplo n.º 10
0
 def render_GET(self, request):
     include_action_runs = requestargs.get_bool(request,
                                                'include_action_runs')
     include_graph = requestargs.get_bool(request, 'include_action_graph')
     num_runs = requestargs.get_integer(request, 'num_runs')
     job_adapter = adapter.JobAdapter(
         self.job_scheduler.get_job(),
         include_job_runs=True,
         include_action_runs=include_action_runs,
         include_action_graph=include_graph,
         num_runs=num_runs)
     return respond(request, job_adapter.get_repr())
Ejemplo n.º 11
0
    def render_POST(self, request):
        config_content = requestargs.get_string(request, 'config')
        name = requestargs.get_string(request, 'name')
        config_hash = requestargs.get_string(request, 'hash')
        check = requestargs.get_bool(request, 'check')

        if not name:
            return respond(
                request=request,
                response={'error': "'name' for config is required."},
                code=http.BAD_REQUEST,
            )

        response = {'status': "Active"}

        if check:
            fn = self.controller.check_config
            req = "configure check"
        elif config_content == "":
            fn = self.controller.delete_config
            req = "configuration delete"
        else:
            fn = self.controller.update_config
            req = "reconfigure"

        log.info("Handling %s request: %s, %s" % (req, name, config_hash))
        error = fn(name, config_content, config_hash)

        if error:
            response['error'] = error
        return respond(request=request, response=response)
Ejemplo n.º 12
0
    def render_POST(self, request):
        config_content = requestargs.get_string(request, 'config')
        name = requestargs.get_string(request, 'name')
        config_hash = requestargs.get_string(request, 'hash')
        check = requestargs.get_bool(request, 'check')

        if not name:
            return respond(
                request=request,
                response={'error': "'name' for config is required."},
                code=http.BAD_REQUEST,
            )

        response = {'status': "Active"}

        if check:
            fn = self.controller.check_config
            req = "configure check"
        elif config_content == "":
            fn = self.controller.delete_config
            req = "configuration delete"
        else:
            fn = self.controller.update_config
            req = "reconfigure"

        log.info("Handling %s request: %s, %s" % (req, name, config_hash))
        error = fn(name, config_content, config_hash)

        if error:
            response['error'] = error
        return respond(request=request, response=response)
Ejemplo n.º 13
0
 def render_GET(self, request):
     config_name = requestargs.get_string(request, "name")
     no_header = requestargs.get_bool(request, "no_header")
     if not config_name:
         return respond(request, {"error": "'name' for config is required."})
     response = self.controller.read_config(config_name, add_header=not no_header)
     return respond(request, response)
Ejemplo n.º 14
0
 def render_GET(self, request):
     config_name = requestargs.get_string(request, 'name')
     no_header = requestargs.get_bool(request, 'no_header')
     if not config_name:
         return respond(request,
                        {'error': "'name' for config is required."})
     response = self.controller.read_config(config_name,
                                            add_header=not no_header)
     return respond(request, response)
Ejemplo n.º 15
0
 def test_get_bool_missing(self):
     assert not get_bool(self.request, 'missing')
Ejemplo n.º 16
0
 def test_get_bool_false(self):
     self._add_arg('false', '0')
     assert not get_bool(self.request, 'false')
Ejemplo n.º 17
0
 def test_get_bool(self):
     assert get_bool(self.request, 'boolean')
Ejemplo n.º 18
0
 def test_get_bool_false(self):
     self._add_arg('false', '0')
     assert not get_bool(self.request, 'false')
Ejemplo n.º 19
0
 def test_get_bool_missing(self):
     assert not get_bool(self.request, 'missing')
Ejemplo n.º 20
0
Archivo: www.py Proyecto: Bklyn/Tron
 def render_GET(self, request):
     include_action_runs = requestargs.get_bool(request, "include_action_runs")
     job_adapter = adapter.JobAdapter(self._job_sched.job, True, include_action_runs)
     return respond(request, job_adapter.get_repr())
Ejemplo n.º 21
0
 def test_get_bool(self):
     assert get_bool(self.request, 'boolean')
Ejemplo n.º 22
0
Archivo: www.py Proyecto: Bklyn/Tron
 def render_GET(self, request):
     include_job_runs = requestargs.get_bool(request, "include_job_runs")
     include_action_runs = requestargs.get_bool(request, "include_action_runs")
     output = dict(jobs=self.get_data(include_job_runs, include_action_runs))
     return respond(request, output)
Ejemplo n.º 23
0
 def render_POST(self, request):
     use_latest_command = requestargs.get_bool(request, 'use_latest_command', False)
     return handle_command(request, self.controller, self.action_run, use_latest_command=use_latest_command)