From e93f076856a8292003865be35d4b6a043121be1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 1 Feb 2015 01:34:11 +0100 Subject: [PATCH] [fix] Ooops, so much yolo kills yolo and actionsmap --- data/actionsmap/yunohost.yml | 1207 ++++++++++++++++++++++++++++++++++ 1 file changed, 1207 insertions(+) create mode 100644 data/actionsmap/yunohost.yml diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml new file mode 100644 index 000000000..ca5ce6d3a --- /dev/null +++ b/data/actionsmap/yunohost.yml @@ -0,0 +1,1207 @@ +########################################################################## +# Category/actions/arguments file +# +# +# Except for general_arguments, this file contains 3 levels +# as in this sample command line: +# +# yunohost monitor info --cpu --ram +# ^ ^ ^ ^ +# (script) | category | action | parameters +# +# +# Above example will lead to the function 'monitor_info(args)' +# in the file 'yunohost_monitor.py' with 'cpu' and 'ram' +# stored in an 'args' dictionnary. +# +# Usage: +# You can add a category at the first level, action at the second one, +# and arguments at the third one. +# If a connexion is needed for the action, don't forget to add it to +# the action parameters (ldap, repo, dns or firewall). +# +# Documentation: +# You can see all arguments settings at the argparse documentation: +# http://docs.python.org/dev/library/argparse.html +# #argparse.ArgumentParser.add_argument +# +# Don't forget to turn argument yaml style (setting: value) +# +########################################################################## + +############################# +# Global parameters # +############################# +_global: + configuration: + authenticate: + - api + authenticator: + default: + vendor: ldap + help: admin_password + parameters: + uri: ldap://localhost:389 + base_dn: dc=yunohost,dc=org + user_rdn: cn=admin + ldap-anonymous: + vendor: ldap + parameters: + uri: ldap://localhost:389 + base_dn: dc=yunohost,dc=org + argument_auth: true + lock: true + arguments: + -v: + full: --version + help: Display moulinette version + action: version + version: moulinette %version% + +############################# +# User # +############################# +user: + category_help: Manage users + actions: + + ### user_list() + list: + action_help: List users + api: GET /users + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + --fields: + help: fields to fetch + nargs: "+" + -f: + full: --filter + help: LDAP filter used to search + -l: + full: --limit + help: Maximum number of user fetched + type: int + -o: + full: --offset + help: Starting number for user fetching + type: int + + ### user_create() + create: + action_help: Create user + api: POST /users + configuration: + authenticate: all + arguments: + username: + help: The unique username to create + extra: + pattern: &pattern_username + - !!str ^[a-z0-9_]+$ + - "pattern_username" + -f: + full: --firstname + extra: + ask: ask_firstname + required: True + pattern: &pattern_firstname + - !!str ^([^\W\d_]{2,30}[ ,.'-]{0,3})+$ + - "pattern_firstname" + -l: + full: --lastname + extra: + ask: ask_lastname + required: True + pattern: &pattern_lastname + - !!str ^([^\W\d_]{2,30}[ ,.']{0,3})+$ + - "pattern_lastname" + -m: + full: --mail + help: Main unique email address + extra: + ask: ask_email + required: True + pattern: &pattern_email + - !!str ^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$ + - "pattern_email" + -p: + full: --password + help: User password + extra: + password: ask_password + required: True + pattern: &pattern_password + - !!str ^.{3,}$ + - "pattern_password" + + ### user_delete() + delete: + action_help: Delete user + api: DELETE /users/ + configuration: + authenticate: all + arguments: + username: + help: Username to delete + extra: + pattern: *pattern_username + --purge: + action: store_true + + ### user_update() + update: + action_help: Update user informations + api: PUT /users/ + configuration: + authenticate: all + arguments: + username: + help: Username to update + -f: + full: --firstname + extra: + pattern: *pattern_firstname + -l: + full: --lastname + extra: + pattern: *pattern_lastname + -m: + full: --mail + extra: + pattern: *pattern_email + -p: + full: --change-password + help: New password to set + metavar: PASSWORD + extra: + pattern: *pattern_password + --add-mailforward: + help: Mailforward addresses to add + nargs: "*" + metavar: MAIL + extra: + pattern: *pattern_email + --remove-mailforward: + help: Mailforward addresses to remove + nargs: "*" + metavar: MAIL + --add-mailalias: + help: Mail aliases to add + nargs: "*" + metavar: MAIL + extra: + pattern: *pattern_email + --remove-mailalias: + help: Mail aliases to remove + nargs: "*" + metavar: MAIL + + ### user_info() + info: + action_help: Get user information + api: GET /users/ + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + username: + help: Username or email to get information + + +############################# +# Domain # +############################# +domain: + category_help: Manage domains + actions: + + ### domain_list() + list: + action_help: List domains + api: GET /domains + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + -f: + full: --filter + help: LDAP filter used to search + -l: + full: --limit + help: Maximum number of domain fetched + type: int + -o: + full: --offset + help: Starting number for domain fetching + type: int + + ### domain_add() + add: + action_help: Create a custom domain + api: POST /domains + configuration: + authenticate: all + arguments: + domain: + help: Domain name to add + extra: + pattern: &pattern_domain + - !!str ^([^\W_A-Z]+([-]*[^\W_A-Z]+)*\.)+[a-z]{2,}$ + - "pattern_domain" + -d: + full: --dyndns + help: Subscribe to the DynDNS service + action: store_true + + ### domain_remove() + remove: + action_help: Delete domains + api: DELETE /domains/ + configuration: + authenticate: all + arguments: + domain: + help: Domain to delete + extra: + pattern: *pattern_domain + + ### domain_info() +# info: +# action_help: Get domain informations +# api: GET /domains/ +# arguments: +# domain: +# help: "" +# extra: +# pattern: +# - '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$' +# - "Must be a valid domain name (e.g. my-domain.org)" + + +############################# +# App # +############################# +app: + category_help: Manage apps + actions: + + ### app_fetchlist() + fetchlist: + action_help: Fetch application list from app server + api: PUT /appslists + arguments: + -u: + full: --url + help: URL of remote JSON list (default http://fapp.yunohost.org/app/list/raw) + -n: + full: --name + help: Name of the list (default fapp) + extra: + pattern: &pattern_listname + - !!str ^[a-z0-9_]+$ + - "pattern_listname" + + ### app_listlists() + listlists: + action_help: List fetched lists + api: GET /appslists + + ### app_removelist() + removelist: + action_help: Remove list from the repositories + api: DELETE /appslists + arguments: + name: + help: Name of the list to remove + extra: + ask: ask_list_to_remove + pattern: *pattern_listname + + ### app_list() + list: + action_help: List apps + api: GET /apps + arguments: + -l: + full: --limit + help: Maximum number of app fetched + -o: + full: --offset + help: Starting number for app fetching + -f: + full: --filter + help: Name filter of app_id or app_name + -r: + full: --raw + help: Return the full app_dict + action: store_true + + ### app_info() + info: + action_help: Get app info + api: GET /apps/ + arguments: + app: + help: Specific app ID + -r: + full: --raw + help: Return the full app_dict + action: store_true + + ### app_map() + map: + action_help: List apps by domain + api: GET /appsmap + arguments: + -a: + full: --app + help: Specific app to map + -r: + full: --raw + help: Return complete dict + action: store_true + -u: + full: --user + help: Allowed app map for a user + extra: + pattern: *pattern_username + + ### app_install() + install: + action_help: Install apps + api: POST /apps + configuration: + authenticate: all + authenticator: ldap-anonymous + lock: false + arguments: + app: + help: Name, local path or git URL of the app to install + -l: + full: --label + help: Custom name for the app + -a: + full: --args + help: Serialize arguments for app installation + + ### app_remove() TODO: Write help + remove: + action_help: Remove app + api: DELETE /apps/ + configuration: + authenticate: all + authenticator: ldap-anonymous + lock: false + arguments: + app: + help: App(s) to delete + + ### app_upgrade() + upgrade: + action_help: Upgrade app + api: PUT /upgrade/apps + configuration: + authenticate: all + authenticator: ldap-anonymous + lock: false + arguments: + app: + help: App(s) to upgrade (default all) + nargs: "*" + -u: + full: --url + help: Git url to fetch for upgrade + -f: + full: --file + help: Folder or tarball for upgrade + + ### app_setting() + setting: + action_help: Set ou get an app setting value + api: GET /apps//settings + arguments: + app: + help: App ID + key: + help: Key to get/set + -v: + full: --value + help: Value to set + -d: + full: --delete + help: Delete the key + action: store_true + + ### app_checkport() + checkport: + action_help: Check availability of a local port + api: GET /tools/checkport + arguments: + port: + help: Port to check + extra: + pattern: &pattern_port + - !!str ^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ + - "pattern_port" + + ### app_checkurl() + checkurl: + action_help: Check availability of a web path + api: GET /tools/checkurl + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + url: + help: Url to check + -a: + full: --app + help: Write domain & path to app settings for further checks + + ### app_initdb() + initdb: + action_help: Create database and initialize it with optionnal attached script + api: POST /tools/initdb + arguments: + user: + help: Name of the DB user + -p: + full: --password + help: Password of the DB (generated unless set) + -d: + full: --db + help: DB name (user unless set) + -s: + full: --sql + help: Initial SQL file + + ### app_makedefault() + makedefault: + action_help: Redirect domain root to an app + api: PUT /apps//default + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + app: + help: App name to put on domain root + -d: + full: --domain + help: Specific domain to put app on (the app domain by default) + + ### app_ssowatconf() + ssowatconf: + action_help: Regenerate SSOwat configuration file + api: PUT /ssowatconf + configuration: + authenticate: all + authenticator: ldap-anonymous + + ### app_addaccess() TODO: Write help + addaccess: + action_help: Grant access right to users (everyone by default) + api: PUT /access + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + apps: + nargs: "+" + -u: + full: --users + nargs: "+" + + ### app_removeaccess() TODO: Write help + removeaccess: + action_help: Revoke access right to users (everyone by default) + api: DELETE /access + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + apps: + nargs: "+" + -u: + full: --users + nargs: "+" + + ### app_clearaccess() + clearaccess: + action_help: Reset access rights for the app + api: POST /access + configuration: + authenticate: all + authenticator: ldap-anonymous + arguments: + apps: + nargs: "+" + +############################# +# Backup # +############################# +backup: + category_help: Manage backups + actions: + + ### backup_create() + create: + action_help: Create a backup local archive + api: POST /backup + configuration: + lock: false + arguments: + -n: + full: --name + help: Name of the backup archive + extra: + pattern: &pattern_backup_archive_name + - !!str ^[\w\-\.]{1,30}(? + configuration: + lock: false + arguments: + name: + help: Name of the local backup archive + + +############################# +# Monitor # +############################# +monitor: + category_help: Monitor the server + actions: + + ### monitor_disk() + disk: + action_help: Monitor disk space and usage + api: GET /monitor/disk + arguments: + -f: + full: --filesystem + help: Show filesystem disk space + action: append_const + const: filesystem + dest: units + -t: + full: --io + help: Show I/O throughput + action: append_const + const: io + dest: units + -m: + full: --mountpoint + help: Monitor only the device mounted on MOUNTPOINT + action: store + -H: + full: --human-readable + help: Print sizes in human readable format + action: store_true + + ### monitor_network() + network: + action_help: Monitor network interfaces + api: GET /monitor/network + arguments: + -u: + full: --usage + help: Show interfaces bit rates + action: append_const + const: usage + dest: units + -i: + full: --infos + help: Show network informations + action: append_const + const: infos + dest: units + -H: + full: --human-readable + help: Print sizes in human readable format + action: store_true + + ### monitor_system() + system: + action_help: Monitor system informations and usage + api: GET /monitor/system + arguments: + -m: + full: --memory + help: Show memory usage + action: append_const + const: memory + dest: units + -c: + full: --cpu + help: Show CPU usage and load + action: append_const + const: cpu + dest: units + -p: + full: --process + help: Show processes summary + action: append_const + const: process + dest: units + -u: + full: --uptime + help: Show the system uptime + action: append_const + const: uptime + dest: units + -i: + full: --infos + help: Show system informations + action: append_const + const: infos + dest: units + -H: + full: --human-readable + help: Print sizes in human readable format + action: store_true + + ### monitor_updatestats() + update-stats: + action_help: Update monitoring statistics + api: POST /monitor/stats + arguments: + period: + help: Time period to update + choices: + - day + - week + - month + + ### monitor_showstats() + show-stats: + action_help: Show monitoring statistics + api: GET /monitor/stats + arguments: + period: + help: Time period to show + choices: + - day + - week + - month + + ### monitor_enable() + enable: + action_help: Enable server monitoring + api: PUT /monitor + arguments: + -n: + full: --no-stats + help: Disable monitoring statistics + action: store_true + + ### monitor_disable() + disable: + api: DELETE /monitor + action_help: Disable server monitoring + + +############################# +# Service # +############################# +service: + category_help: Manage services + actions: + + ### service_add() + add: + action_help: Add a service + # api: POST /services + arguments: + name: + help: Service name to add + -s: + full: --status + help: Custom status command + -l: + full: --log + help: Absolute path to log file to display + nargs: "+" + -r: + full: --runlevel + help: Runlevel priority of the service + type: int + + ### service_remove() + remove: + action_help: Remove a service + # api: DELETE /services + arguments: + name: + help: Service name to remove + + ### service_start() + start: + action_help: Start one or more services + api: PUT /services/ + arguments: + names: + help: Service name to start + nargs: "+" + metavar: NAME + + ### service_stop() + stop: + action_help: Stop one or more services + api: DELETE /services/ + arguments: + names: + help: Service name to stop + nargs: "+" + metavar: NAME + + ### service_enable() + enable: + action_help: Enable one or more services + api: PUT /services//enable + arguments: + names: + help: Service name to enable + nargs: "+" + metavar: NAME + + ### service_disable() + disable: + action_help: Disable one or more services + api: DELETE /services//enable + arguments: + names: + help: Service name to disable + nargs: "+" + metavar: NAME + + ### service_status() + status: + action_help: Show status information about one or more services (all by default) + api: + - GET /services + - GET /services/ + arguments: + names: + help: Service name to show + nargs: "*" + metavar: NAME + + ### service_log() + log: + action_help: Log every log files of a service + api: GET /services//log + arguments: + name: + help: Service name to log + -n: + full: --number + help: Number of lines to display + default: 50 + type: int + + +############################# +# Firewall # +############################# +firewall: + category_help: Manage firewall rules + actions: + + ### firewall_list() + list: + action_help: List all firewall rules + api: GET /firewall + arguments: + -r: + full: --raw + help: Return the complete YAML dict + action: store_true + -i: + full: --by-ip-version + help: List rules by IP version + action: store_true + -f: + full: --list-forwarded + help: List forwarded ports with UPnP + action: store_true + + ### firewall_reload() + reload: + action_help: Reload all firewall rules + api: PUT /firewall + + ### firewall_allow() + allow: + action_help: Allow connections on a port + api: POST /firewall/port + arguments: + port: + help: Port or range of ports to open + extra: + pattern: &pattern_port_or_range + - !!str ((^|(?!\A):)([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])){1,2}?$ + - "pattern_port_or_range" + -p: + full: --protocol + help: "Protocol type to allow (default: TCP)" + choices: + - TCP + - UDP + - Both + default: TCP + -4: + full: --ipv4-only + help: Only add a rule for IPv4 connections + action: store_true + -6: + full: --ipv6-only + help: Only add a rule for IPv6 connections + action: store_true + --no-upnp: + help: Do not add forwarding of this port with UPnP + action: store_true + --no-reload: + help: Do not reload firewall rules + action: store_true + + + ### firewall_disallow() + disallow: + action_help: Disallow connections on a port + api: DELETE /firewall/port + arguments: + port: + help: Port or range of ports to close + extra: + pattern: *pattern_port_or_range + -p: + full: --protocol + help: "Protocol type to allow (default: TCP)" + choices: + - TCP + - UDP + - Both + default: TCP + -4: + full: --ipv4-only + help: Only remove the rule for IPv4 connections + action: store_true + -6: + full: --ipv6-only + help: Only remove the rule for IPv6 connections + action: store_true + --upnp-only: + help: Only remove forwarding of this port with UPnP + action: store_true + --no-reload: + help: Do not reload firewall rules + action: store_true + + + ### firewall_upnp() + upnp: + action_help: Manage port forwarding using UPnP + api: GET /firewall/upnp + arguments: + action: + choices: + - enable + - disable + - status + - reload + nargs: "?" + default: status + --no-refresh: + help: Do not refresh port forwarding + action: store_true + + ### firewall_stop() + stop: + action_help: Stop iptables and ip6tables + api: DELETE /firewall + + + +############################# +# DynDNS # +############################# +dyndns: + category_help: Subscribe and Update DynDNS Hosts + actions: + + ### dyndns_subscribe() + subscribe: + action_help: Subscribe to a DynDNS service + api: POST /dyndns + arguments: + --subscribe-host: + help: Dynette HTTP API to subscribe to + default: "dyndns.yunohost.org" + -d: + full: --domain + help: Full domain to subscribe with + extra: + pattern: *pattern_domain + -k: + full: --key + help: Public DNS key + + ### dyndns_update() + update: + action_help: Update IP on DynDNS platform + api: PUT /dyndns + arguments: + --dyn-host: + help: Dynette DNS server to inform + default: "dynhost.yunohost.org" + -d: + full: --domain + help: Full domain to subscribe with + extra: + pattern: *pattern_domain + -k: + full: --key + help: Public DNS key + -i: + full: --ip + help: IP address to send + + ### dyndns_installcron() + installcron: + action_help: Install IP update cron + api: POST /dyndns/cron + + ### dyndns_removecron() + removecron: + action_help: Remove IP update cron + api: DELETE /dyndns/cron + + +############################# +# Tools # +############################# +tools: + category_help: Specific tools + actions: + + ### tools_ldapinit() + ldapinit: + action_help: YunoHost LDAP initialization + api: POST /ldap + configuration: + authenticate: all + + ### tools_adminpw() + adminpw: + action_help: Change admin password + api: PUT /adminpw + configuration: + authenticate: all + arguments: + -n: + full: --new-password + extra: + password: ask_new_admin_password + pattern: *pattern_password + required: True + + ### tools_maindomain() + maindomain: + action_help: Main domain change tool + api: PUT /domains/main + configuration: + authenticate: all + arguments: + -o: + full: --old-domain + extra: + pattern: *pattern_domain + -n: + full: --new-domain + extra: + pattern: *pattern_domain + + ### tools_postinstall() + postinstall: + action_help: YunoHost post-install + api: POST /postinstall + configuration: + authenticate: false + lock: false + arguments: + -d: + full: --domain + help: YunoHost main domain + extra: + ask: ask_main_domain + pattern: *pattern_domain + required: True + -p: + full: --password + help: YunoHost admin password + extra: + password: ask_new_admin_password + pattern: *pattern_password + required: True + --ignore-dyndns: + help: Do not subscribe domain to a DynDNS service + action: store_true + + ### tools_update() + update: + action_help: YunoHost update + api: PUT /update + configuration: + lock: false + arguments: + --ignore-apps: + help: Ignore apps cache update and changelog + action: store_true + --ignore-packages: + help: Ignore APT cache update and changelog + action: store_true + + ### tools_upgrade() + upgrade: + action_help: YunoHost upgrade + api: PUT /upgrade + configuration: + authenticate: all + authenticator: ldap-anonymous + lock: false + arguments: + --ignore-apps: + help: Ignore apps upgrade + action: store_true + --ignore-packages: + help: Ignore APT packages upgrade + action: store_true + + +############################# +# Hook # +############################# +hook: + category_help: Manage hooks + actions: + + ### hook_add() + add: + action_help: Store hook script to filesystem + api: PUT /hook + arguments: + app: + help: App to link with + file: + help: Script to add + + ### hook_remove() + remove: + action_help: Remove hook scripts from filesystem + api: DELETE /hook + arguments: + app: + help: Scripts related to app will be removed + + ### hook_list() + list: + action_help: List available hooks for an action + api: GET /hooks/ + arguments: + action: + help: Action name + -l: + full: --list-by + help: Property to list hook by + choices: + - name + - priority + - folder + default: name + -i: + full: --show-info + help: Show hook information + action: store_true + + ### hook_callback() + callback: + action_help: Execute all scripts binded to an action + api: GET /hooks + arguments: + action: + help: Action name + -n: + full: --hooks + help: List of hooks names to execute + nargs: "*" + -a: + full: --args + help: Ordered list of arguments to pass to the script + nargs: "*" + + ### hook_check() + check: + action_help: Parse the script file and get arguments + api: GET /hook/check + arguments: + file: + help: File to check + + ### hook_exec() + exec: + action_help: Execute hook from a file with arguments + api: GET /hook + arguments: + file: + help: Script to execute + -a: + full: --args + help: Arguments to pass to the script