Update for aprsd 3.0.0

This patch adds the new conf settings for slack plugin
This commit is contained in:
Hemna 2023-01-10 14:10:46 -05:00
parent 8367cc8fd2
commit e74585f4e7
6 changed files with 153 additions and 28 deletions

View File

@ -1,10 +1,7 @@
import logging
from oslo_config import cfg
from aprsd_slack_plugin.conf import slack
CONF = cfg.CONF
slack.register_opts(CONF)

View File

@ -64,9 +64,10 @@ def _import_modules(module_names):
for modname in module_names:
mod = importlib.import_module("aprsd_slack_plugin.conf." + modname)
if not hasattr(mod, LIST_OPTS_FUNC_NAME):
msg = "The module 'aprsd_slack_plugin.conf.%s' should have a '%s' "\
"function which returns the config options." % \
(modname, LIST_OPTS_FUNC_NAME)
msg = (
"The module 'aprsd_slack_plugin.conf.%s' should have a '%s' "
"function which returns the config options." % (modname, LIST_OPTS_FUNC_NAME)
)
raise Exception(msg)
else:
imported_modules.append(mod)

View File

@ -11,8 +11,8 @@ slack_opts = [
"signing_secret",
default=None,
help="Your Slack account signing secret"
"You have to create a slack bot account first. "
"https://api.slack.com/start/building/bolt-python",
"You have to create a slack bot account first. "
"https://api.slack.com/start/building/bolt-python",
),
cfg.StrOpt(
"bot_token",
@ -23,13 +23,11 @@ slack_opts = [
"channels",
default=None,
help="The channels you want messages sent to. This is a CSV list"
"of slack channel names.",
"of slack channel names.",
),
]
ALL_OPTS = (
slack_opts
)
ALL_OPTS = slack_opts
def register_opts(cfg):

View File

@ -0,0 +1,120 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# by the following command:
#
# pip-compile --annotation-style=line --resolver=backtracking requirements-dev.in
#
alabaster==0.7.12 # via sphinx
aprsd==3.0.0 # via -r requirements-dev.in
aprslib==0.7.2 # via aprsd
attrs==22.2.0 # via aprsd, ax253, kiss3, pytest
ax253==0.1.5.post1 # via aprsd, kiss3
babel==2.11.0 # via sphinx
beautifulsoup4==4.11.1 # via aprsd
bidict==0.22.1 # via aprsd, python-socketio
bitarray==2.6.2 # via aprsd, ax253, kiss3
black==22.12.0 # via -r requirements-dev.in
build==0.9.0 # via pip-tools
cachetools==5.2.1 # via tox
certifi==2022.12.7 # via aprsd, requests
cffi==1.15.1 # via aprsd, cryptography
cfgv==3.3.1 # via pre-commit
chardet==5.1.0 # via tox
charset-normalizer==2.1.1 # via aprsd, requests
click==8.1.3 # via aprsd, black, click-completion, flask, pip-tools
click-completion==0.5.2 # via aprsd
colorama==0.4.6 # via tox
commonmark==0.9.1 # via aprsd, rich
coverage[toml]==7.0.4 # via pytest-cov
cryptography==38.0.1 # via aprsd, pyopenssl
dacite2==2.0.0 # via aprsd
dataclasses==0.6 # via aprsd
debtcollector==2.5.0 # via aprsd, oslo-config
distlib==0.3.6 # via virtualenv
dnspython==2.2.1 # via aprsd, eventlet
docutils==0.19 # via sphinx
eventlet==0.33.2 # via aprsd
exceptiongroup==1.1.0 # via pytest
filelock==3.9.0 # via tox, virtualenv
flake8==6.0.0 # via -r requirements-dev.in, pep8-naming
flask==2.1.2 # via aprsd, flask-classful, flask-httpauth, flask-socketio
flask-classful==0.14.2 # via aprsd
flask-httpauth==4.7.0 # via aprsd
flask-socketio==5.3.2 # via aprsd
greenlet==2.0.1 # via aprsd, eventlet
identify==2.5.12 # via pre-commit
idna==3.4 # via aprsd, requests
imagesize==1.4.1 # via sphinx
imapclient==2.3.1 # via aprsd
importlib-metadata==6.0.0 # via aprsd, ax253, flask, kiss3, sphinx
iniconfig==2.0.0 # via pytest
isort==5.11.4 # via -r requirements-dev.in
itsdangerous==2.1.2 # via aprsd, flask
jinja2==3.1.2 # via aprsd, click-completion, flask, sphinx
kiss3==8.0.0 # via aprsd
markupsafe==2.1.1 # via aprsd, jinja2
mccabe==0.7.0 # via flake8
mypy==0.991 # via -r requirements-dev.in
mypy-extensions==0.4.3 # via black, mypy
netaddr==0.8.0 # via aprsd, oslo-config
nodeenv==1.7.0 # via pre-commit
oslo-config==9.1.0 # via aprsd
oslo-i18n==5.1.0 # via aprsd, oslo-config
packaging==23.0 # via build, pyproject-api, pytest, sphinx, tox
pathspec==0.10.3 # via black
pbr==5.11.0 # via -r requirements-dev.in, aprsd, oslo-i18n, stevedore
pep517==0.13.0 # via build
pep8-naming==0.13.3 # via -r requirements-dev.in
pip-tools==6.12.1 # via -r requirements-dev.in
platformdirs==2.6.2 # via black, tox, virtualenv
pluggy==1.0.0 # via aprsd, pytest, tox
plumbum==1.8.1 # via aprsd, rpyc
pre-commit==2.21.0 # via -r requirements-dev.in
pycodestyle==2.10.0 # via flake8
pycparser==2.21 # via aprsd, cffi
pyflakes==3.0.1 # via flake8
pygments==2.14.0 # via aprsd, rich, sphinx
pyopenssl==23.0.0 # via aprsd
pyproject-api==1.4.0 # via tox
pyserial==3.5 # via aprsd, pyserial-asyncio
pyserial-asyncio==0.6 # via aprsd, kiss3
pytest==7.2.0 # via -r requirements-dev.in, pytest-cov
pytest-cov==4.0.0 # via -r requirements-dev.in
python-engineio==4.3.4 # via aprsd, python-socketio
python-socketio==5.7.2 # via aprsd, flask-socketio
pytz==2022.7 # via aprsd, babel
pyyaml==6.0 # via aprsd, oslo-config, pre-commit
requests==2.28.1 # via aprsd, oslo-config, sphinx, update-checker
rfc3986==2.0.0 # via aprsd, oslo-config
rich==12.6.0 # via aprsd
rpyc==5.3.0 # via aprsd
shellingham==1.5.0.post1 # via aprsd, click-completion
six==1.16.0 # via aprsd, click-completion, eventlet, imapclient
snowballstemmer==2.2.0 # via sphinx
soupsieve==2.3.2.post1 # via aprsd, beautifulsoup4
sphinx==6.1.3 # via -r requirements-dev.in
sphinxcontrib-applehelp==1.0.3 # via sphinx
sphinxcontrib-devhelp==1.0.2 # via sphinx
sphinxcontrib-htmlhelp==2.0.0 # via sphinx
sphinxcontrib-jsmath==1.0.1 # via sphinx
sphinxcontrib-qthelp==1.0.3 # via sphinx
sphinxcontrib-serializinghtml==1.1.5 # via sphinx
stevedore==4.1.1 # via aprsd, oslo-config
tabulate==0.9.0 # via aprsd
thesmuggler==1.0.1 # via aprsd
tomli==2.0.1 # via black, build, coverage, mypy, pep517, pyproject-api, pytest, tox
tox==4.2.6 # via -r requirements-dev.in
typing-extensions==4.4.0 # via black, mypy
ua-parser==0.16.1 # via aprsd, user-agents
update-checker==0.18.0 # via aprsd
urllib3==1.26.13 # via aprsd, requests
user-agents==2.2.0 # via aprsd
virtualenv==20.17.1 # via pre-commit, tox
werkzeug==2.1.2 # via aprsd, flask
wheel==0.38.4 # via pip-tools
wrapt==1.14.1 # via aprsd, debtcollector
zipp==3.11.0 # via aprsd, importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools

View File

@ -9,15 +9,18 @@ aprslib==0.7.2 # via aprsd
attrs==22.2.0 # via aprsd, ax253, kiss3
ax253==0.1.5.post1 # via aprsd, kiss3
beautifulsoup4==4.11.1 # via aprsd
bidict==0.22.0 # via aprsd, python-socketio
bitarray==2.6.1 # via aprsd, ax253, kiss3
bidict==0.22.1 # via aprsd, python-socketio
bitarray==2.6.2 # via aprsd, ax253, kiss3
certifi==2022.12.7 # via aprsd, requests
cffi==1.15.1 # via aprsd, cryptography
charset-normalizer==2.1.1 # via aprsd, requests
click==8.1.3 # via aprsd, click-completion, flask
click-completion==0.5.2 # via aprsd
commonmark==0.9.1 # via aprsd, rich
cryptography==38.0.4 # via aprsd, pyopenssl
cryptography==38.0.1 # via aprsd, pyopenssl
dacite2==2.0.0 # via aprsd
dataclasses==0.6 # via aprsd
debtcollector==2.5.0 # via aprsd, oslo-config
dnspython==2.2.1 # via aprsd, eventlet
eventlet==0.33.2 # via aprsd
flask==2.1.2 # via aprsd, flask-classful, flask-httpauth, flask-socketio, slackeventsapi
@ -27,30 +30,37 @@ flask-socketio==5.3.2 # via aprsd
greenlet==2.0.1 # via aprsd, eventlet
idna==3.4 # via aprsd, requests
imapclient==2.3.1 # via aprsd
importlib-metadata==5.2.0 # via aprsd, ax253, flask, kiss3
importlib-metadata==6.0.0 # via aprsd, ax253, flask, kiss3
itsdangerous==2.1.2 # via aprsd, flask
jinja2==3.1.2 # via aprsd, click-completion, flask
kiss3==8.0.0 # via aprsd
markupsafe==2.1.1 # via aprsd, jinja2
pbr==5.11.0 # via -r requirements.in, aprsd
netaddr==0.8.0 # via aprsd, oslo-config
oslo-config==9.1.0 # via -r requirements.in, aprsd
oslo-i18n==5.1.0 # via aprsd, oslo-config
pbr==5.11.0 # via -r requirements.in, aprsd, oslo-i18n, stevedore
pluggy==1.0.0 # via aprsd
plumbum==1.8.1 # via aprsd, rpyc
pycparser==2.21 # via aprsd, cffi
pyee==9.0.4 # via slackeventsapi
pygments==2.13.0 # via aprsd, rich
pyopenssl==22.1.0 # via aprsd
pygments==2.14.0 # via aprsd, rich
pyopenssl==23.0.0 # via aprsd
pyserial==3.5 # via aprsd, pyserial-asyncio
pyserial-asyncio==0.6 # via aprsd, kiss3
python-engineio==4.3.4 # via aprsd, python-socketio
python-socketio==5.7.2 # via aprsd, flask-socketio
pytz==2022.7 # via aprsd
pyyaml==6.0 # via aprsd
requests==2.28.1 # via aprsd, update-checker
pyyaml==6.0 # via aprsd, oslo-config
requests==2.28.1 # via aprsd, oslo-config, update-checker
rfc3986==2.0.0 # via aprsd, oslo-config
rich==12.6.0 # via aprsd
shellingham==1.5.0 # via aprsd, click-completion
rpyc==5.3.0 # via aprsd
shellingham==1.5.0.post1 # via aprsd, click-completion
six==1.16.0 # via aprsd, click-completion, eventlet, imapclient
slack-sdk==3.19.5 # via -r requirements.in
slackeventsapi==3.0.1 # via -r requirements.in
soupsieve==2.3.2.post1 # via aprsd, beautifulsoup4
stevedore==4.1.1 # via aprsd, oslo-config
tabulate==0.9.0 # via aprsd
thesmuggler==1.0.1 # via aprsd
typing-extensions==4.4.0 # via pyee
@ -59,5 +69,5 @@ update-checker==0.18.0 # via aprsd
urllib3==1.26.13 # via aprsd, requests
user-agents==2.2.0 # via aprsd
werkzeug==2.1.2 # via aprsd, flask
wrapt==1.14.1 # via aprsd
wrapt==1.14.1 # via aprsd, debtcollector
zipp==3.11.0 # via aprsd, importlib-metadata

View File

@ -1,6 +1,9 @@
import unittest
from unittest import mock
from aprsd import conf # noqa
from aprsd_slack_plugin import conf as plugin_conf # noqa
from aprsd_slack_plugin import location_plugin
@ -9,10 +12,6 @@ class TestPlugin(unittest.TestCase):
def test_plugin(self, mock_command):
mock_command.return_value = ""
config = {
"slack": {"signing_secret": "something", "bot_token": "sometoken", "channel": "hemna"},
}
p = location_plugin.SlackLocationPlugin(config)
p = location_plugin.SlackLocationPlugin()
packet = {"from": "WB4BOR", "message_text": "location"}
p.filter(packet)