mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[mod] single variable for default domain
This commit is contained in:
parent
40d135bbd8
commit
d687f5593d
1 changed files with 8 additions and 6 deletions
14
cli.py
14
cli.py
|
@ -6,6 +6,8 @@ import requests
|
||||||
from argh.decorators import named
|
from argh.decorators import named
|
||||||
|
|
||||||
|
|
||||||
|
DOMAIN = "localhost:4242"
|
||||||
|
|
||||||
def require_token():
|
def require_token():
|
||||||
if os.path.exists("token") and open("token").read().strip():
|
if os.path.exists("token") and open("token").read().strip():
|
||||||
return
|
return
|
||||||
|
@ -42,7 +44,7 @@ def request_api(path, domain, verb, data):
|
||||||
assert response.content == b"ok", response.content
|
assert response.content == b"ok", response.content
|
||||||
|
|
||||||
|
|
||||||
def add(name, url_or_path, test_type="stable", yunohost_version="unstable", debian_version="stretch", revision="master", domain="localhost:4242"):
|
def add(name, url_or_path, test_type="stable", yunohost_version="unstable", debian_version="stretch", revision="master", domain=DOMAIN):
|
||||||
request_api(
|
request_api(
|
||||||
path="job",
|
path="job",
|
||||||
verb="post",
|
verb="post",
|
||||||
|
@ -59,11 +61,11 @@ def add(name, url_or_path, test_type="stable", yunohost_version="unstable", debi
|
||||||
|
|
||||||
|
|
||||||
@named("list")
|
@named("list")
|
||||||
def list_(all=False, domain="localhost:4242"): pass
|
def list_(all=False, domain=DOMAIN): pass
|
||||||
def delete(job_id, domain="localhost:4242"): pass
|
def delete(job_id, domain=DOMAIN): pass
|
||||||
def update(job_id, domain="localhost:4242"): pass
|
def update(job_id, domain=DOMAIN): pass
|
||||||
def cancel(job_id, domain="localhost:4242"): pass
|
def cancel(job_id, domain=DOMAIN): pass
|
||||||
def resume(job_id, domain="localhost:4242"): pass
|
def resume(job_id, domain=DOMAIN): pass
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
require_token()
|
require_token()
|
||||||
|
|
Loading…
Add table
Reference in a new issue