mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
configpanel: Implement 'hidden' domain_action_run route
This commit is contained in:
parent
c39f0ae3bc
commit
40ad8ce25e
3 changed files with 29 additions and 7 deletions
|
@ -563,6 +563,20 @@ domain:
|
|||
path:
|
||||
help: The path to check (e.g. /coffee)
|
||||
|
||||
### domain_action_run()
|
||||
action-run:
|
||||
hide_in_help: True
|
||||
action_help: Run domain action
|
||||
api: PUT /domain/<domain>/actions/<action>
|
||||
arguments:
|
||||
domain:
|
||||
help: Domain name
|
||||
action:
|
||||
help: action id
|
||||
-a:
|
||||
full: --args
|
||||
help: Serialized arguments for action (i.e. "foo=bar&lorem=ipsum")
|
||||
|
||||
subcategories:
|
||||
|
||||
config:
|
||||
|
|
|
@ -106,7 +106,6 @@ i18n = "domain_config"
|
|||
style = "success"
|
||||
visible = "issuer != 'letsencrypt'"
|
||||
enabled = "acme_eligible or cert_no_checks"
|
||||
# ??? api = "PUT /domains/{domain}/cert?force&"
|
||||
|
||||
[cert.cert.cert_renew]
|
||||
ask = "Renew Let's Encrypt certificate"
|
||||
|
|
|
@ -530,14 +530,23 @@ class DomainConfigPanel(ConfigPanel):
|
|||
self.values["cert_issuer"] = self.cert_status["CA_type"]
|
||||
self.values["acme_eligible"] = self.cert_status["ACME_eligible"]
|
||||
|
||||
def _run_action(self, action):
|
||||
|
||||
if action == "cert_install":
|
||||
from yunohost.certificate import certificate_install as action_func
|
||||
elif action == "cert_renew":
|
||||
from yunohost.certificate import certificate_renew as action_func
|
||||
@is_unit_operation()
|
||||
def domain_action_run(
|
||||
operation_logger, domain, action, args=None
|
||||
):
|
||||
|
||||
action_func([self.entity], force=True, no_checks=self.new_values["cert_no_checks"])
|
||||
import urllib.parse
|
||||
|
||||
if action == "cert.cert.cert_install":
|
||||
from yunohost.certificate import certificate_install as action_func
|
||||
elif action == "cert.cert.cert_renew":
|
||||
from yunohost.certificate import certificate_renew as action_func
|
||||
|
||||
args = dict(urllib.parse.parse_qsl(args or "", keep_blank_values=True))
|
||||
no_checks = bool(args["cert_no_checks"])
|
||||
|
||||
action_func([domain], force=True, no_checks=no_checks)
|
||||
|
||||
|
||||
def _get_domain_settings(domain: str) -> dict:
|
||||
|
|
Loading…
Add table
Reference in a new issue