mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
add status command and delete last script
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools>=61", "setuptools_scm>=6.2"]
|
requires = ["setuptools>=61"]
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ dependencies = [
|
|||||||
[project.scripts]
|
[project.scripts]
|
||||||
cmdeploy = "deploy_chatmail.cmdeploy:main"
|
cmdeploy = "deploy_chatmail.cmdeploy:main"
|
||||||
|
|
||||||
[tool.setuptools_scm]
|
|
||||||
write_to = "src/deploy_chatmail/_version.py"
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "-v -ra --strict-markers"
|
addopts = "-v -ra --strict-markers"
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ def get_parser():
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_subcommand(subparsers, dns_cmd)
|
add_subcommand(subparsers, dns_cmd)
|
||||||
|
add_subcommand(subparsers, status_cmd)
|
||||||
add_subcommand(subparsers, bench_cmd)
|
add_subcommand(subparsers, bench_cmd)
|
||||||
add_subcommand(subparsers, test_cmd)
|
add_subcommand(subparsers, test_cmd)
|
||||||
add_subcommand(subparsers, webdev_cmd)
|
add_subcommand(subparsers, webdev_cmd)
|
||||||
@@ -112,6 +113,28 @@ def run_cmd(args, out, config):
|
|||||||
subprocess.check_call(popen_args, env=env)
|
subprocess.check_call(popen_args, env=env)
|
||||||
|
|
||||||
|
|
||||||
|
def status_cmd(args, out, config):
|
||||||
|
"""Display status for online chatmail instance."""
|
||||||
|
|
||||||
|
ssh = f"ssh root@{config.mailname}"
|
||||||
|
|
||||||
|
def shell_output(arg):
|
||||||
|
return subprocess.check_output(arg, shell=True).decode()
|
||||||
|
|
||||||
|
out.green(f"chatmail domain: {config.mailname}")
|
||||||
|
if config.privacy_mail:
|
||||||
|
out.green("privacy settings: present")
|
||||||
|
else:
|
||||||
|
out.red("no privacy settings")
|
||||||
|
|
||||||
|
out(f"[retrieving info by invoking {ssh}]", file=sys.stderr)
|
||||||
|
|
||||||
|
s1 = "systemctl --type=service --state=running"
|
||||||
|
for line in shell_output(f"{ssh} -- {s1}").split("\n"):
|
||||||
|
if line.startswith(" "):
|
||||||
|
print(line)
|
||||||
|
|
||||||
|
|
||||||
def webdev_cmd(args, out, config):
|
def webdev_cmd(args, out, config):
|
||||||
"""Run local web development loop for static web pages."""
|
"""Run local web development loop for static web pages."""
|
||||||
from .www import main
|
from .www import main
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import os
|
|
||||||
import time
|
|
||||||
import imaplib
|
|
||||||
|
|
||||||
domain = os.environ.get("CHATMAIL_DOMAIN", "c3.testrun.org")
|
|
||||||
|
|
||||||
print("connecting")
|
|
||||||
conn = imaplib.IMAP4_SSL(domain)
|
|
||||||
print("logging in")
|
|
||||||
conn.login(f"imapcapa", "pass")
|
|
||||||
status, res = conn.capability()
|
|
||||||
for capa in sorted(res[0].decode().split()):
|
|
||||||
print(capa)
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user