2020-04-03 05:11:02 -04:00
|
|
|
#!/usr/bin/env python3
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:00:04 -04:00
|
|
|
import argparse
|
2018-03-08 09:06:36 -05:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import textwrap
|
2020-04-18 19:03:39 -04:00
|
|
|
import urllib.parse
|
2021-05-28 05:00:04 -04:00
|
|
|
import zipfile
|
|
|
|
from typing import Any, Callable, Dict, List
|
|
|
|
|
|
|
|
import requests
|
2018-05-06 05:20:45 -04:00
|
|
|
from requests import Response
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:05:11 -04:00
|
|
|
red = "\033[91m" # type: str
|
|
|
|
green = "\033[92m" # type: str
|
|
|
|
end_format = "\033[0m" # type: str
|
|
|
|
bold = "\033[1m" # type: str
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:05:11 -04:00
|
|
|
bots_dir = ".bots" # type: str
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def pack(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
# Basic sanity checks for input.
|
|
|
|
if not options.path:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: Path to bot folder not specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
if not options.config:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: Path to zuliprc not specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
if not options.main:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: No main bot file specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
if not os.path.isfile(options.config):
|
2021-05-28 05:05:11 -04:00
|
|
|
print("pack: Config file not found at path: {}.".format(options.config))
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
if not os.path.isdir(options.path):
|
2021-05-28 05:05:11 -04:00
|
|
|
print("pack: Bot folder not found at path: {}.".format(options.path))
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
main_path = os.path.join(options.path, options.main)
|
|
|
|
if not os.path.isfile(main_path):
|
2021-05-28 05:05:11 -04:00
|
|
|
print("pack: Bot main file not found at path: {}.".format(main_path))
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
# Main logic for packing the bot.
|
|
|
|
if not os.path.exists(bots_dir):
|
|
|
|
os.makedirs(bots_dir)
|
|
|
|
zip_file_path = os.path.join(bots_dir, options.botname + ".zip")
|
2021-05-28 05:05:11 -04:00
|
|
|
zip_file = zipfile.ZipFile(zip_file_path, "w", zipfile.ZIP_DEFLATED)
|
2018-03-08 09:06:36 -05:00
|
|
|
# Pack the complete bot folder
|
|
|
|
for root, dirs, files in os.walk(options.path):
|
|
|
|
for file in files:
|
|
|
|
file_path = os.path.join(root, file)
|
|
|
|
zip_file.write(file_path, os.path.relpath(file_path, options.path))
|
|
|
|
# Pack the zuliprc
|
2021-05-28 05:05:11 -04:00
|
|
|
zip_file.write(options.config, "zuliprc")
|
2018-03-08 09:06:36 -05:00
|
|
|
# Pack the config file for the botfarm.
|
2021-05-28 05:03:46 -04:00
|
|
|
bot_config = textwrap.dedent(
|
2021-05-28 05:05:11 -04:00
|
|
|
"""\
|
2018-03-08 09:06:36 -05:00
|
|
|
[deploy]
|
|
|
|
bot={}
|
|
|
|
zuliprc=zuliprc
|
2021-05-28 05:05:11 -04:00
|
|
|
""".format(
|
2021-05-28 05:03:46 -04:00
|
|
|
options.main
|
|
|
|
)
|
|
|
|
)
|
2021-05-28 05:05:11 -04:00
|
|
|
zip_file.writestr("config.ini", bot_config)
|
2018-03-08 09:06:36 -05:00
|
|
|
zip_file.close()
|
2021-05-28 05:05:11 -04:00
|
|
|
print("pack: Created zip file at: {}.".format(zip_file_path))
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def check_common_options(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
if not options.server:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: URL to Botfarm server not specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
2018-05-02 18:19:10 -04:00
|
|
|
if not options.token:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: Botfarm deploy token not specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
|
|
|
def handle_common_response_without_data(
|
|
|
|
response: Response, operation: str, success_message: str
|
|
|
|
) -> bool:
|
2018-05-06 05:20:45 -04:00
|
|
|
return handle_common_response(
|
|
|
|
response=response,
|
|
|
|
operation=operation,
|
2021-05-28 05:05:11 -04:00
|
|
|
success_handler=lambda r: print("{}: {}".format(operation, success_message)),
|
2018-05-06 05:20:45 -04:00
|
|
|
)
|
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
|
|
|
def handle_common_response(
|
|
|
|
response: Response, operation: str, success_handler: Callable[[Dict[str, Any]], Any]
|
|
|
|
) -> bool:
|
2018-05-06 05:20:45 -04:00
|
|
|
if response.status_code == requests.codes.ok:
|
|
|
|
response_data = response.json()
|
2021-05-28 05:05:11 -04:00
|
|
|
if response_data["status"] == "success":
|
2018-05-06 05:20:45 -04:00
|
|
|
success_handler(response_data)
|
|
|
|
return True
|
2021-05-28 05:05:11 -04:00
|
|
|
elif response_data["status"] == "error":
|
|
|
|
print("{}: {}".format(operation, response_data["message"]))
|
2018-05-06 05:20:45 -04:00
|
|
|
return False
|
|
|
|
else:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("{}: Unexpected success response format".format(operation))
|
2018-05-06 05:20:45 -04:00
|
|
|
return False
|
|
|
|
if response.status_code == requests.codes.unauthorized:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("{}: Authentication error with the server. Aborting.".format(operation))
|
2018-05-06 05:20:45 -04:00
|
|
|
else:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("{}: Error {}. Aborting.".format(operation, response.status_code))
|
2018-05-06 05:20:45 -04:00
|
|
|
return False
|
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def upload(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
file_path = os.path.join(bots_dir, options.botname + ".zip")
|
2018-03-08 09:06:36 -05:00
|
|
|
if not os.path.exists(file_path):
|
2021-05-28 05:05:11 -04:00
|
|
|
print("upload: Could not find bot package at {}.".format(file_path))
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
2021-05-28 05:05:11 -04:00
|
|
|
files = {"file": open(file_path, "rb")}
|
|
|
|
headers = {"key": options.token}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/upload")
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.post(url, files=files, headers=headers)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response_without_data(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "upload", "Uploaded the bot package to botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def clean(options: argparse.Namespace) -> None:
|
2021-05-28 05:05:11 -04:00
|
|
|
file_path = os.path.join(bots_dir, options.botname + ".zip")
|
2018-03-08 09:06:36 -05:00
|
|
|
if os.path.exists(file_path):
|
|
|
|
os.remove(file_path)
|
2021-05-28 05:05:11 -04:00
|
|
|
print("clean: Removed {}.".format(file_path))
|
2018-03-08 09:06:36 -05:00
|
|
|
else:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("clean: File '{}' not found.".format(file_path))
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def process(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/process")
|
|
|
|
payload = {"name": options.botname}
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.post(url, headers=headers, json=payload)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response_without_data(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "process", "The bot has been processed by the botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def start(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/start")
|
|
|
|
payload = {"name": options.botname}
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.post(url, headers=headers, json=payload)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response_without_data(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "start", "The bot has been started by the botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def stop(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/stop")
|
|
|
|
payload = {"name": options.botname}
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.post(url, headers=headers, json=payload)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response_without_data(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "stop", "The bot has been stopped by the botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def prepare(options: argparse.Namespace) -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
pack(options)
|
|
|
|
upload(options)
|
|
|
|
clean(options)
|
|
|
|
process(options)
|
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-04-04 03:27:17 -04:00
|
|
|
def log(options: argparse.Namespace) -> None:
|
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
2018-04-04 03:27:17 -04:00
|
|
|
if options.lines:
|
|
|
|
lines = options.lines
|
|
|
|
else:
|
|
|
|
lines = None
|
2021-05-28 05:05:11 -04:00
|
|
|
payload = {"name": options.botname, "lines": lines}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/logs/" + options.botname)
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.get(url, json=payload, headers=headers)
|
2021-05-28 05:05:11 -04:00
|
|
|
result = handle_common_response(response, "log", lambda r: print(r["logs"]["content"]))
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-04-04 03:27:17 -04:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-05-02 05:40:16 -04:00
|
|
|
def delete(options: argparse.Namespace) -> None:
|
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
|
|
|
url = urllib.parse.urljoin(options.server, "bots/delete")
|
|
|
|
payload = {"name": options.botname}
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.post(url, headers=headers, json=payload)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response_without_data(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "delete", "The bot has been removed from the botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-05-02 05:40:16 -04:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-05-02 18:04:00 -04:00
|
|
|
def list_bots(options: argparse.Namespace) -> None:
|
|
|
|
check_common_options(options)
|
2021-05-28 05:05:11 -04:00
|
|
|
headers = {"key": options.token}
|
2018-05-02 18:04:00 -04:00
|
|
|
if options.format:
|
|
|
|
pretty_print = True
|
|
|
|
else:
|
|
|
|
pretty_print = False
|
2021-05-28 05:05:11 -04:00
|
|
|
url = urllib.parse.urljoin(options.server, "bots/list")
|
2018-05-06 05:20:45 -04:00
|
|
|
response = requests.get(url, headers=headers)
|
2021-05-28 05:03:46 -04:00
|
|
|
result = handle_common_response(
|
2021-05-28 05:05:11 -04:00
|
|
|
response, "ls", lambda r: print_bots(r["bots"]["list"], pretty_print)
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-05-06 05:20:45 -04:00
|
|
|
if result is False:
|
|
|
|
sys.exit(1)
|
2018-05-02 18:04:00 -04:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-05-02 18:04:00 -04:00
|
|
|
def print_bots(bots: List[Any], pretty_print: bool) -> None:
|
|
|
|
if pretty_print:
|
|
|
|
print_bots_pretty(bots)
|
|
|
|
else:
|
|
|
|
for bot in bots:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("{}\t{}\t{}\t{}".format(bot["name"], bot["status"], bot["email"], bot["site"]))
|
2018-05-02 18:04:00 -04:00
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-05-02 18:04:00 -04:00
|
|
|
def print_bots_pretty(bots: List[Any]) -> None:
|
|
|
|
if len(bots) == 0:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("ls: No bots found on the botfarm")
|
2018-05-02 18:04:00 -04:00
|
|
|
else:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("ls: There are the following bots on the botfarm:")
|
2018-05-02 18:04:00 -04:00
|
|
|
name_col_len, status_col_len, email_col_len, site_col_len = 25, 15, 35, 35
|
2021-05-28 05:05:11 -04:00
|
|
|
row_format = "{0} {1} {2} {3}"
|
2018-05-02 18:04:00 -04:00
|
|
|
header = row_format.format(
|
2021-05-28 05:05:11 -04:00
|
|
|
"NAME".rjust(name_col_len),
|
|
|
|
"STATUS".rjust(status_col_len),
|
|
|
|
"EMAIL".rjust(email_col_len),
|
|
|
|
"SITE".rjust(site_col_len),
|
2018-05-02 18:04:00 -04:00
|
|
|
)
|
|
|
|
header_bottom = row_format.format(
|
2021-05-28 05:05:11 -04:00
|
|
|
"-" * name_col_len,
|
|
|
|
"-" * status_col_len,
|
|
|
|
"-" * email_col_len,
|
|
|
|
"-" * site_col_len,
|
2018-05-02 18:04:00 -04:00
|
|
|
)
|
|
|
|
print(header)
|
|
|
|
print(header_bottom)
|
|
|
|
for bot in bots:
|
|
|
|
row = row_format.format(
|
2021-05-28 05:05:11 -04:00
|
|
|
bot["name"].rjust(name_col_len),
|
|
|
|
bot["status"].rjust(status_col_len),
|
|
|
|
bot["email"].rjust(email_col_len),
|
|
|
|
bot["site"].rjust(site_col_len),
|
2018-05-02 18:04:00 -04:00
|
|
|
)
|
|
|
|
print(row)
|
|
|
|
|
2021-05-28 05:03:46 -04:00
|
|
|
|
2018-03-17 08:08:04 -04:00
|
|
|
def main() -> None:
|
2018-03-08 09:06:36 -05:00
|
|
|
usage = """tools/deploy <command> <bot-name> [options]
|
|
|
|
|
|
|
|
This is tool meant to easily deploy bots to a Zulip Bot Farm.
|
|
|
|
|
|
|
|
First, get your deploy token from the Botfarm server. We recommend saving your
|
2018-05-02 18:19:10 -04:00
|
|
|
deploy-token as $TOKEN and the bot-farm server as $SERVER. If you want to manually
|
|
|
|
provide the SERVER and TOKEN values, use the --server="https://my-server.com"
|
|
|
|
and --token="my-access-token" flags with each command. To deploy, run:
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy prepare mybot \\
|
2018-03-08 09:06:36 -05:00
|
|
|
--path=/path/to/bot/directory --config=/path/to/zuliprc --main=main_bot_file.py
|
|
|
|
|
|
|
|
Now, your bot is ready to start.
|
|
|
|
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy start mybot
|
2018-03-08 09:06:36 -05:00
|
|
|
|
|
|
|
To stop the bot, use:
|
|
|
|
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy stop mybot
|
2018-03-08 09:06:36 -05:00
|
|
|
|
2018-04-04 03:27:17 -04:00
|
|
|
To get logs of the bot, use:
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy log mybot
|
2018-04-04 03:27:17 -04:00
|
|
|
|
2018-05-02 05:40:16 -04:00
|
|
|
To delete the bot, use:
|
|
|
|
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy delete mybot
|
2018-05-02 05:40:16 -04:00
|
|
|
|
2018-05-02 18:04:00 -04:00
|
|
|
To list user's bots, use:
|
|
|
|
|
2018-05-02 18:19:10 -04:00
|
|
|
tools/deploy ls
|
2018-05-02 18:04:00 -04:00
|
|
|
|
2018-03-08 09:06:36 -05:00
|
|
|
"""
|
|
|
|
parser = argparse.ArgumentParser(usage=usage)
|
2021-05-28 05:05:11 -04:00
|
|
|
parser.add_argument("command", help="Command to run.")
|
|
|
|
parser.add_argument("botname", nargs="?", help="Name of bot to operate on.")
|
2021-05-28 05:03:46 -04:00
|
|
|
parser.add_argument(
|
2021-05-28 05:05:11 -04:00
|
|
|
"--server",
|
|
|
|
"-s",
|
|
|
|
metavar="SERVERURL",
|
|
|
|
default=os.environ.get("SERVER", ""),
|
|
|
|
help="Url of the Zulip Botfarm server.",
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
|
|
|
parser.add_argument(
|
2021-05-28 05:05:11 -04:00
|
|
|
"--token", "-t", default=os.environ.get("TOKEN", ""), help="Deploy Token for the Botfarm."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2021-05-28 05:05:11 -04:00
|
|
|
parser.add_argument("--path", "-p", help="Path to the bot directory.")
|
|
|
|
parser.add_argument("--config", "-c", help="Path to the zuliprc file.")
|
2021-05-28 05:03:46 -04:00
|
|
|
parser.add_argument(
|
2021-05-28 05:05:11 -04:00
|
|
|
"--main", "-m", help="Path to the bot's main file, relative to the bot's directory."
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2021-05-28 05:05:11 -04:00
|
|
|
parser.add_argument("--lines", "-l", help="Number of lines in log required.")
|
2021-05-28 05:03:46 -04:00
|
|
|
parser.add_argument(
|
2021-05-28 05:05:11 -04:00
|
|
|
"--format", "-f", action="store_true", help="Print user's bots in human readable format"
|
2021-05-28 05:03:46 -04:00
|
|
|
)
|
2018-03-08 09:06:36 -05:00
|
|
|
options = parser.parse_args()
|
|
|
|
if not options.command:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: No command specified.")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
2021-05-28 05:05:11 -04:00
|
|
|
if not options.botname and options.command not in ["ls"]:
|
|
|
|
print("tools/deploy: No bot name specified. Please specify a name like 'my-custom-bot'")
|
2018-03-08 09:06:36 -05:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
commands = {
|
2021-05-28 05:05:11 -04:00
|
|
|
"pack": pack,
|
|
|
|
"upload": upload,
|
|
|
|
"clean": clean,
|
|
|
|
"prepare": prepare,
|
|
|
|
"process": process,
|
|
|
|
"start": start,
|
|
|
|
"stop": stop,
|
|
|
|
"log": log,
|
|
|
|
"delete": delete,
|
|
|
|
"ls": list_bots,
|
2018-03-08 09:06:36 -05:00
|
|
|
}
|
|
|
|
if options.command in commands:
|
|
|
|
commands[options.command](options)
|
|
|
|
else:
|
2021-05-28 05:05:11 -04:00
|
|
|
print("tools/deploy: No command '{}' found.".format(options.command))
|
2021-05-28 05:03:46 -04:00
|
|
|
|
|
|
|
|
2021-05-28 05:05:11 -04:00
|
|
|
if __name__ == "__main__":
|
2018-03-08 09:06:36 -05:00
|
|
|
main()
|