From f987e7872c9f09bc7320bed2aa16360a72a1ccb1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 28 Aug 2018 23:33:22 +0000 Subject: [PATCH] Skeleton / draft of API --- data/actionsmap/yunohost.yml | 50 ++++++++++++++++++++++++++++++++++++ src/yunohost/diagnosis.py | 44 +++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 src/yunohost/diagnosis.py diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index 22037f05f..4f849160f 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -1861,3 +1861,53 @@ log: --share: help: Share the full log using yunopaste action: store_true + + +############################# +# Diagnosis # +############################# +diagnosis: + category_help: Look for possible issues on the server + actions: + + list: + action_help: List diagnosis categories + api: GET /diagnosis/list + + report: + action_help: Show most recents diagnosis results + api: GET /diagnosis/report + arguments: + categories: + help: Diagnosis categories to display (all by default) + nargs: "*" + --full: + help: Display additional information + action: store_true + + run: + action_help: Show most recents diagnosis results + api: POST /diagnosis/run + arguments: + categories: + help: Diagnosis categories to run (all by default) + nargs: "*" + --force: + help: Display additional information + action: store_true + -a: + help: Serialized arguments for diagnosis scripts (e.g. "domain=domain.tld") + full: --args + + ignore: + action_help: Configure some diagnosis results to be ignored + api: PUT /diagnosis/ignore + arguments: + category: + help: Diagnosis category to be affected + -a: + help: Arguments, to be used to ignore only some parts of a report (e.g. "domain=domain.tld") + full: --args + --unignore: + help: Unignore a previously ignored report + action: store_true diff --git a/src/yunohost/diagnosis.py b/src/yunohost/diagnosis.py new file mode 100644 index 000000000..aafbdcec3 --- /dev/null +++ b/src/yunohost/diagnosis.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +""" License + + Copyright (C) 2018 YunoHost + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, see http://www.gnu.org/licenses + +""" + +""" diagnosis.py + + Look for possible issues on the server +""" + +from moulinette import m18n +from moulinette.core import MoulinetteError +from moulinette.utils import log + +logger = log.getActionLogger('yunohost.diagnosis') + +def diagnosis_list(): + pass + +def diagnosis_report(categories=[], full=False): + pass + +def diagnosis_run(categories=[], force=False, args=""): + pass + +def diagnosis_ignore(category, args="", unignore=False): + pass +