Ejemplo n.º 1
0
    def action(self) -> ActionResult:
        try:
            transactions.check_transaction()
            user.save_file("parentscan", dict(self._settings._asdict()))

            self._job.set_function(self._job.do_execute, self._settings, self._get_tasks())
            self._job.start()
        except Exception as e:
            if active_config.debug:
                raise
            logger.exception("Failed to start parent scan")
            raise MKUserError(
                None, _("Failed to start parent scan: %s") % ("%s" % e).replace("\n", "\n<br>")
            )

        raise HTTPRedirect(self._job.detail_url())
Ejemplo n.º 2
0
def ajax_set_snapin_site():
    response.set_content_type("application/json")
    ident = request.var("ident")
    if ident not in snapin_registry:
        raise MKUserError(None, _("Invalid ident"))

    site = request.var("site")
    site_choices = dict([(SiteId(""), _("All sites"))] +
                        user_sites.get_configured_site_choices())

    if site not in site_choices:
        raise MKUserError(None, _("Invalid site"))

    snapin_sites = user.load_file("sidebar_sites", {}, lock=True)
    snapin_sites[ident] = site
    user.save_file("sidebar_sites", snapin_sites)
Ejemplo n.º 3
0
 def _save_user_settings(self):
     user.save_file("virtual_host_tree", {
         "tree": self._current_tree_id,
         "cwd": self._cwds
     })
Ejemplo n.º 4
0
def save_graph_pin() -> None:
    try:
        pin_timestamp = request.get_integer_input("pin")
    except ValueError:
        pin_timestamp = None
    user.save_file("graph_pin", None if pin_timestamp == -1 else pin_timestamp)