aprsd 3.4.3__py3-none-any.whl → 4.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. aprsd/cli_helper.py +12 -5
  2. aprsd/client/aprsis.py +68 -17
  3. aprsd/client/base.py +60 -12
  4. aprsd/client/drivers/aprsis.py +11 -5
  5. aprsd/client/drivers/fake.py +15 -20
  6. aprsd/client/factory.py +6 -3
  7. aprsd/client/fake.py +5 -4
  8. aprsd/client/kiss.py +43 -7
  9. aprsd/client/stats.py +2 -22
  10. aprsd/cmds/completion.py +7 -4
  11. aprsd/cmds/dev.py +39 -43
  12. aprsd/cmds/fetch_stats.py +221 -69
  13. aprsd/cmds/healthcheck.py +7 -5
  14. aprsd/cmds/list_plugins.py +140 -134
  15. aprsd/cmds/listen.py +102 -11
  16. aprsd/cmds/server.py +71 -37
  17. aprsd/conf/__init__.py +1 -2
  18. aprsd/conf/client.py +3 -4
  19. aprsd/conf/common.py +29 -92
  20. aprsd/conf/log.py +2 -4
  21. aprsd/conf/opts.py +5 -4
  22. aprsd/conf/plugin_common.py +11 -121
  23. aprsd/exception.py +2 -0
  24. aprsd/log/log.py +7 -46
  25. aprsd/main.py +19 -9
  26. aprsd/packets/__init__.py +14 -4
  27. aprsd/packets/core.py +82 -91
  28. aprsd/packets/log.py +8 -8
  29. aprsd/packets/packet_list.py +18 -25
  30. aprsd/plugin.py +33 -15
  31. aprsd/plugins/fortune.py +2 -2
  32. aprsd/plugins/notify.py +1 -4
  33. aprsd/plugins/weather.py +10 -8
  34. aprsd/stats/__init__.py +0 -2
  35. aprsd/stats/collector.py +11 -3
  36. aprsd/threads/__init__.py +3 -2
  37. aprsd/threads/aprsd.py +57 -10
  38. aprsd/threads/{keep_alive.py → keepalive.py} +14 -37
  39. aprsd/threads/registry.py +3 -3
  40. aprsd/threads/rx.py +48 -17
  41. aprsd/threads/stats.py +2 -2
  42. aprsd/threads/tx.py +34 -10
  43. aprsd/utils/__init__.py +62 -15
  44. aprsd/utils/counter.py +15 -12
  45. aprsd/utils/json.py +9 -4
  46. aprsd/utils/keepalive_collector.py +55 -0
  47. aprsd/utils/trace.py +4 -4
  48. aprsd-4.0.0.dist-info/AUTHORS +1 -0
  49. aprsd-4.0.0.dist-info/METADATA +293 -0
  50. aprsd-4.0.0.dist-info/RECORD +74 -0
  51. {aprsd-3.4.3.dist-info → aprsd-4.0.0.dist-info}/WHEEL +1 -1
  52. aprsd/cmds/webchat.py +0 -674
  53. aprsd/conf/plugin_email.py +0 -105
  54. aprsd/plugins/email.py +0 -709
  55. aprsd/plugins/location.py +0 -179
  56. aprsd/threads/log_monitor.py +0 -121
  57. aprsd/web/__init__.py +0 -0
  58. aprsd/web/admin/__init__.py +0 -0
  59. aprsd/web/admin/static/css/index.css +0 -84
  60. aprsd/web/admin/static/css/prism.css +0 -4
  61. aprsd/web/admin/static/css/tabs.css +0 -35
  62. aprsd/web/admin/static/images/Untitled.png +0 -0
  63. aprsd/web/admin/static/images/aprs-symbols-16-0.png +0 -0
  64. aprsd/web/admin/static/images/aprs-symbols-16-1.png +0 -0
  65. aprsd/web/admin/static/images/aprs-symbols-64-0.png +0 -0
  66. aprsd/web/admin/static/images/aprs-symbols-64-1.png +0 -0
  67. aprsd/web/admin/static/images/aprs-symbols-64-2.png +0 -0
  68. aprsd/web/admin/static/js/charts.js +0 -235
  69. aprsd/web/admin/static/js/echarts.js +0 -465
  70. aprsd/web/admin/static/js/logs.js +0 -26
  71. aprsd/web/admin/static/js/main.js +0 -231
  72. aprsd/web/admin/static/js/prism.js +0 -12
  73. aprsd/web/admin/static/js/send-message.js +0 -114
  74. aprsd/web/admin/static/js/tabs.js +0 -28
  75. aprsd/web/admin/templates/index.html +0 -196
  76. aprsd/web/chat/static/css/chat.css +0 -115
  77. aprsd/web/chat/static/css/index.css +0 -66
  78. aprsd/web/chat/static/css/style.css.map +0 -1
  79. aprsd/web/chat/static/css/tabs.css +0 -41
  80. aprsd/web/chat/static/css/upstream/bootstrap.min.css +0 -6
  81. aprsd/web/chat/static/css/upstream/font.woff2 +0 -0
  82. aprsd/web/chat/static/css/upstream/google-fonts.css +0 -23
  83. aprsd/web/chat/static/css/upstream/jquery-ui.css +0 -1311
  84. aprsd/web/chat/static/css/upstream/jquery.toast.css +0 -28
  85. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  86. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  87. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  88. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  89. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/icons.woff +0 -0
  90. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/icons.woff2 +0 -0
  91. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/outline-icons.woff +0 -0
  92. aprsd/web/chat/static/css/upstream/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  93. aprsd/web/chat/static/images/Untitled.png +0 -0
  94. aprsd/web/chat/static/images/aprs-symbols-16-0.png +0 -0
  95. aprsd/web/chat/static/images/aprs-symbols-16-1.png +0 -0
  96. aprsd/web/chat/static/images/aprs-symbols-64-0.png +0 -0
  97. aprsd/web/chat/static/images/aprs-symbols-64-1.png +0 -0
  98. aprsd/web/chat/static/images/aprs-symbols-64-2.png +0 -0
  99. aprsd/web/chat/static/images/globe.svg +0 -3
  100. aprsd/web/chat/static/js/gps.js +0 -84
  101. aprsd/web/chat/static/js/main.js +0 -45
  102. aprsd/web/chat/static/js/send-message.js +0 -585
  103. aprsd/web/chat/static/js/tabs.js +0 -28
  104. aprsd/web/chat/static/js/upstream/bootstrap.bundle.min.js +0 -7
  105. aprsd/web/chat/static/js/upstream/jquery-3.7.1.min.js +0 -2
  106. aprsd/web/chat/static/js/upstream/jquery-ui.min.js +0 -13
  107. aprsd/web/chat/static/js/upstream/jquery.toast.js +0 -374
  108. aprsd/web/chat/static/js/upstream/semantic.min.js +0 -11
  109. aprsd/web/chat/static/js/upstream/socket.io.min.js +0 -7
  110. aprsd/web/chat/templates/index.html +0 -139
  111. aprsd/wsgi.py +0 -315
  112. aprsd-3.4.3.dist-info/AUTHORS +0 -13
  113. aprsd-3.4.3.dist-info/METADATA +0 -793
  114. aprsd-3.4.3.dist-info/RECORD +0 -133
  115. {aprsd-3.4.3.dist-info → aprsd-4.0.0.dist-info}/LICENSE +0 -0
  116. {aprsd-3.4.3.dist-info → aprsd-4.0.0.dist-info}/entry_points.txt +0 -0
  117. {aprsd-3.4.3.dist-info → aprsd-4.0.0.dist-info}/top_level.txt +0 -0
aprsd/cmds/server.py CHANGED
@@ -6,22 +6,54 @@ import click
6
6
  from oslo_config import cfg
7
7
 
8
8
  import aprsd
9
- from aprsd import cli_helper
9
+ from aprsd import cli_helper, plugin, threads, utils
10
10
  from aprsd import main as aprsd_main
11
- from aprsd import plugin, threads, utils
12
11
  from aprsd.client import client_factory
13
12
  from aprsd.main import cli
14
13
  from aprsd.packets import collector as packet_collector
15
14
  from aprsd.packets import seen_list
16
- from aprsd.threads import keep_alive, log_monitor, registry, rx
15
+ from aprsd.threads import aprsd as aprsd_threads
16
+ from aprsd.threads import keepalive, registry, rx, tx
17
17
  from aprsd.threads import stats as stats_thread
18
- from aprsd.threads import tx
19
-
18
+ from aprsd.utils import singleton
20
19
 
21
20
  CONF = cfg.CONF
22
21
  LOG = logging.getLogger("APRSD")
23
22
 
24
23
 
24
+ @singleton
25
+ class ServerThreads:
26
+ """Registry for threads that the server command runs.
27
+
28
+ This enables extensions to register a thread to run during
29
+ the server command.
30
+
31
+ """
32
+
33
+ def __init__(self):
34
+ self.threads: list[aprsd_threads.APRSDThread] = []
35
+
36
+ def register(self, thread: aprsd_threads.APRSDThread):
37
+ if not isinstance(thread, aprsd_threads.APRSDThread):
38
+ raise TypeError(f"Thread {thread} is not an APRSDThread")
39
+ self.threads.append(thread)
40
+
41
+ def unregister(self, thread: aprsd_threads.APRSDThread):
42
+ if not isinstance(thread, aprsd_threads.APRSDThread):
43
+ raise TypeError(f"Thread {thread} is not an APRSDThread")
44
+ self.threads.remove(thread)
45
+
46
+ def start(self):
47
+ """Start all threads in the list."""
48
+ for thread in self.threads:
49
+ thread.start()
50
+
51
+ def join(self):
52
+ """Join all the threads in the list"""
53
+ for thread in self.threads:
54
+ thread.join()
55
+
56
+
25
57
  # main() ###
26
58
  @cli.command()
27
59
  @cli_helper.add_options(cli_helper.common_options)
@@ -41,6 +73,8 @@ def server(ctx, flush):
41
73
  signal.signal(signal.SIGINT, aprsd_main.signal_handler)
42
74
  signal.signal(signal.SIGTERM, aprsd_main.signal_handler)
43
75
 
76
+ server_threads = ServerThreads()
77
+
44
78
  level, msg = utils._check_version()
45
79
  if level:
46
80
  LOG.warning(msg)
@@ -54,10 +88,27 @@ def server(ctx, flush):
54
88
  LOG.error("No Clients are enabled in config.")
55
89
  sys.exit(-1)
56
90
 
91
+ # Make sure we have 1 client transport enabled
92
+ if not client_factory.is_client_enabled():
93
+ LOG.error("No Clients are enabled in config.")
94
+ sys.exit(-1)
95
+
96
+ if not client_factory.is_client_configured():
97
+ LOG.error("APRS client is not properly configured in config file.")
98
+ sys.exit(-1)
99
+
57
100
  # Creates the client object
58
101
  LOG.info("Creating client connection")
59
102
  aprs_client = client_factory.create()
60
103
  LOG.info(aprs_client)
104
+ if not aprs_client.login_success:
105
+ # We failed to login, will just quit!
106
+ msg = f"Login Failure: {aprs_client.login_failure}"
107
+ LOG.error(msg)
108
+ print(msg)
109
+ sys.exit(-1)
110
+
111
+ # Check to make sure the login worked.
61
112
 
62
113
  # Create the initial PM singleton and Register plugins
63
114
  # We register plugins first here so we can register each
@@ -65,7 +116,7 @@ def server(ctx, flush):
65
116
  # log file output.
66
117
  LOG.info("Loading Plugin Manager and registering plugins")
67
118
  plugin_manager = plugin.PluginManager()
68
- plugin_manager.setup_plugins()
119
+ plugin_manager.setup_plugins(load_help_plugin=CONF.load_help_plugin)
69
120
 
70
121
  # Dump all the config options now.
71
122
  CONF.log_opt_values(LOG, logging.DEBUG)
@@ -78,15 +129,6 @@ def server(ctx, flush):
78
129
  for p in watchlist_plugins:
79
130
  LOG.info(p)
80
131
 
81
- # Make sure we have 1 client transport enabled
82
- if not client_factory.is_client_enabled():
83
- LOG.error("No Clients are enabled in config.")
84
- sys.exit(-1)
85
-
86
- if not client_factory.is_client_configured():
87
- LOG.error("APRS client is not properly configured in config file.")
88
- sys.exit(-1)
89
-
90
132
  if not CONF.enable_seen_list:
91
133
  # just deregister the class from the packet collector
92
134
  packet_collector.PacketCollector().unregister(seen_list.SeenList)
@@ -102,36 +144,28 @@ def server(ctx, flush):
102
144
 
103
145
  # Now start all the main processing threads.
104
146
 
105
- keepalive = keep_alive.KeepAliveThread()
106
- keepalive.start()
107
-
108
- stats_store_thread = stats_thread.APRSDStatsStoreThread()
109
- stats_store_thread.start()
110
-
111
- rx_thread = rx.APRSDPluginRXThread(
112
- packet_queue=threads.packet_queue,
147
+ server_threads.register(keepalive.KeepAliveThread())
148
+ server_threads.register(stats_thread.APRSDStatsStoreThread())
149
+ server_threads.register(
150
+ rx.APRSDPluginRXThread(
151
+ packet_queue=threads.packet_queue,
152
+ ),
113
153
  )
114
- process_thread = rx.APRSDPluginProcessPacketThread(
115
- packet_queue=threads.packet_queue,
154
+ server_threads.register(
155
+ rx.APRSDPluginProcessPacketThread(
156
+ packet_queue=threads.packet_queue,
157
+ ),
116
158
  )
117
- rx_thread.start()
118
- process_thread.start()
119
159
 
120
160
  if CONF.enable_beacon:
121
161
  LOG.info("Beacon Enabled. Starting Beacon thread.")
122
- bcn_thread = tx.BeaconSendThread()
123
- bcn_thread.start()
162
+ server_threads.register(tx.BeaconSendThread())
124
163
 
125
164
  if CONF.aprs_registry.enabled:
126
165
  LOG.info("Registry Enabled. Starting Registry thread.")
127
- registry_thread = registry.APRSRegistryThread()
128
- registry_thread.start()
129
-
130
- if CONF.admin.web_enabled:
131
- log_monitor_thread = log_monitor.LogMonitorThread()
132
- log_monitor_thread.start()
166
+ server_threads.register(registry.APRSRegistryThread())
133
167
 
134
- rx_thread.join()
135
- process_thread.join()
168
+ server_threads.start()
169
+ server_threads.join()
136
170
 
137
171
  return 0
aprsd/conf/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from oslo_config import cfg
2
2
 
3
- from aprsd.conf import client, common, log, plugin_common, plugin_email
3
+ from aprsd.conf import client, common, log, plugin_common
4
4
 
5
5
 
6
6
  CONF = cfg.CONF
@@ -11,7 +11,6 @@ client.register_opts(CONF)
11
11
 
12
12
  # plugins
13
13
  plugin_common.register_opts(CONF)
14
- plugin_email.register_opts(CONF)
15
14
 
16
15
 
17
16
  def set_lib_defaults():
aprsd/conf/client.py CHANGED
@@ -4,7 +4,6 @@ The options for log setup
4
4
 
5
5
  from oslo_config import cfg
6
6
 
7
-
8
7
  DEFAULT_LOGIN = "NOCALL"
9
8
 
10
9
  aprs_group = cfg.OptGroup(
@@ -31,7 +30,7 @@ aprs_opts = [
31
30
  "enabled",
32
31
  default=True,
33
32
  help="Set enabled to False if there is no internet connectivity."
34
- "This is useful for a direwolf KISS aprs connection only.",
33
+ "This is useful for a direwolf KISS aprs connection only.",
35
34
  ),
36
35
  cfg.StrOpt(
37
36
  "login",
@@ -42,8 +41,8 @@ aprs_opts = [
42
41
  "password",
43
42
  secret=True,
44
43
  help="APRS Password "
45
- "Get the passcode for your callsign here: "
46
- "https://apps.magicbug.co.uk/passcode",
44
+ "Get the passcode for your callsign here: "
45
+ "https://apps.magicbug.co.uk/passcode",
47
46
  ),
48
47
  cfg.HostAddressOpt(
49
48
  "host",
aprsd/conf/common.py CHANGED
@@ -2,30 +2,20 @@ from pathlib import Path
2
2
 
3
3
  from oslo_config import cfg
4
4
 
5
-
6
5
  home = str(Path.home())
7
6
  DEFAULT_CONFIG_DIR = f"{home}/.config/aprsd/"
8
7
  APRSD_DEFAULT_MAGIC_WORD = "CHANGEME!!!"
9
8
 
10
- admin_group = cfg.OptGroup(
11
- name="admin",
12
- title="Admin web interface settings",
13
- )
14
9
  watch_list_group = cfg.OptGroup(
15
10
  name="watch_list",
16
11
  title="Watch List settings",
17
12
  )
18
- webchat_group = cfg.OptGroup(
19
- name="webchat",
20
- title="Settings specific to the webchat command",
21
- )
22
13
 
23
14
  registry_group = cfg.OptGroup(
24
15
  name="aprs_registry",
25
16
  title="APRS Registry settings",
26
17
  )
27
18
 
28
-
29
19
  aprsd_opts = [
30
20
  cfg.StrOpt(
31
21
  "callsign",
@@ -56,15 +46,15 @@ aprsd_opts = [
56
46
  "ack_rate_limit_period",
57
47
  default=1,
58
48
  help="The wait period in seconds per Ack packet being sent."
59
- "1 means 1 ack packet per second allowed."
60
- "2 means 1 pack packet every 2 seconds allowed",
49
+ "1 means 1 ack packet per second allowed."
50
+ "2 means 1 pack packet every 2 seconds allowed",
61
51
  ),
62
52
  cfg.IntOpt(
63
53
  "msg_rate_limit_period",
64
54
  default=2,
65
55
  help="Wait period in seconds per non AckPacket being sent."
66
- "2 means 1 packet every 2 seconds allowed."
67
- "5 means 1 pack packet every 5 seconds allowed",
56
+ "2 means 1 packet every 2 seconds allowed."
57
+ "5 means 1 pack packet every 5 seconds allowed",
68
58
  ),
69
59
  cfg.IntOpt(
70
60
  "packet_dupe_timeout",
@@ -75,7 +65,7 @@ aprsd_opts = [
75
65
  "enable_beacon",
76
66
  default=False,
77
67
  help="Enable sending of a GPS Beacon packet to locate this service. "
78
- "Requires latitude and longitude to be set.",
68
+ "Requires latitude and longitude to be set.",
79
69
  ),
80
70
  cfg.IntOpt(
81
71
  "beacon_interval",
@@ -102,8 +92,8 @@ aprsd_opts = [
102
92
  choices=["compact", "multiline", "both"],
103
93
  default="compact",
104
94
  help="When logging packets 'compact' will use a single line formatted for each packet."
105
- "'multiline' will use multiple lines for each packet and is the traditional format."
106
- "both will log both compact and multiline.",
95
+ "'multiline' will use multiple lines for each packet and is the traditional format."
96
+ "both will log both compact and multiline.",
107
97
  ),
108
98
  cfg.IntOpt(
109
99
  "default_packet_send_count",
@@ -129,13 +119,24 @@ aprsd_opts = [
129
119
  "enable_seen_list",
130
120
  default=True,
131
121
  help="Enable the Callsign seen list tracking feature. This allows aprsd to keep track of "
132
- "callsigns that have been seen and when they were last seen.",
122
+ "callsigns that have been seen and when they were last seen.",
133
123
  ),
134
124
  cfg.BoolOpt(
135
125
  "enable_packet_logging",
136
126
  default=True,
137
127
  help="Set this to False, to disable logging of packets to the log file.",
138
128
  ),
129
+ cfg.BoolOpt(
130
+ "load_help_plugin",
131
+ default=True,
132
+ help="Set this to False to disable the help plugin.",
133
+ ),
134
+ cfg.BoolOpt(
135
+ "enable_sending_ack_packets",
136
+ default=True,
137
+ help="Set this to False, to disable sending of ack packets. This will entirely stop"
138
+ "APRSD from sending ack packets.",
139
+ ),
139
140
  ]
140
141
 
141
142
  watch_list_opts = [
@@ -143,8 +144,8 @@ watch_list_opts = [
143
144
  "enabled",
144
145
  default=False,
145
146
  help="Enable the watch list feature. Still have to enable "
146
- "the correct plugin. Built-in plugin to use is "
147
- "aprsd.plugins.notify.NotifyPlugin",
147
+ "the correct plugin. Built-in plugin to use is "
148
+ "aprsd.plugins.notify.NotifyPlugin",
148
149
  ),
149
150
  cfg.ListOpt(
150
151
  "callsigns",
@@ -163,36 +164,7 @@ watch_list_opts = [
163
164
  "alert_time_seconds",
164
165
  default=3600,
165
166
  help="Time to wait before alert is sent on new message for "
166
- "users in callsigns.",
167
- ),
168
- ]
169
-
170
- admin_opts = [
171
- cfg.BoolOpt(
172
- "web_enabled",
173
- default=False,
174
- help="Enable the Admin Web Interface",
175
- ),
176
- cfg.StrOpt(
177
- "web_ip",
178
- default="0.0.0.0",
179
- help="The ip address to listen on",
180
- ),
181
- cfg.PortOpt(
182
- "web_port",
183
- default=8001,
184
- help="The port to listen on",
185
- ),
186
- cfg.StrOpt(
187
- "user",
188
- default="admin",
189
- help="The admin user for the admin web interface",
190
- ),
191
- cfg.StrOpt(
192
- "password",
193
- default="password",
194
- secret=True,
195
- help="Admin interface password",
167
+ "users in callsigns.",
196
168
  ),
197
169
  ]
198
170
 
@@ -201,7 +173,6 @@ enabled_plugins_opts = [
201
173
  cfg.ListOpt(
202
174
  "enabled_plugins",
203
175
  default=[
204
- "aprsd.plugins.email.EmailPlugin",
205
176
  "aprsd.plugins.fortune.FortunePlugin",
206
177
  "aprsd.plugins.location.LocationPlugin",
207
178
  "aprsd.plugins.ping.PingPlugin",
@@ -211,36 +182,8 @@ enabled_plugins_opts = [
211
182
  "aprsd.plugins.notify.NotifySeenPlugin",
212
183
  ],
213
184
  help="Comma separated list of enabled plugins for APRSD."
214
- "To enable installed external plugins add them here."
215
- "The full python path to the class name must be used",
216
- ),
217
- ]
218
-
219
- webchat_opts = [
220
- cfg.StrOpt(
221
- "web_ip",
222
- default="0.0.0.0",
223
- help="The ip address to listen on",
224
- ),
225
- cfg.PortOpt(
226
- "web_port",
227
- default=8001,
228
- help="The port to listen on",
229
- ),
230
- cfg.StrOpt(
231
- "latitude",
232
- default=None,
233
- help="Latitude for the GPS Beacon button. If not set, the button will not be enabled.",
234
- ),
235
- cfg.StrOpt(
236
- "longitude",
237
- default=None,
238
- help="Longitude for the GPS Beacon button. If not set, the button will not be enabled.",
239
- ),
240
- cfg.BoolOpt(
241
- "disable_url_request_logging",
242
- default=False,
243
- help="Disable the logging of url requests in the webchat command.",
185
+ "To enable installed external plugins add them here."
186
+ "The full python path to the class name must be used",
244
187
  ),
245
188
  ]
246
189
 
@@ -249,16 +192,16 @@ registry_opts = [
249
192
  "enabled",
250
193
  default=False,
251
194
  help="Enable sending aprs registry information. This will let the "
252
- "APRS registry know about your service and it's uptime. "
253
- "No personal information is sent, just the callsign, uptime and description. "
254
- "The service callsign is the callsign set in [DEFAULT] section.",
195
+ "APRS registry know about your service and it's uptime. "
196
+ "No personal information is sent, just the callsign, uptime and description. "
197
+ "The service callsign is the callsign set in [DEFAULT] section.",
255
198
  ),
256
199
  cfg.StrOpt(
257
200
  "description",
258
201
  default=None,
259
202
  help="Description of the service to send to the APRS registry. "
260
- "This is what will show up in the APRS registry."
261
- "If not set, the description will be the same as the callsign.",
203
+ "This is what will show up in the APRS registry."
204
+ "If not set, the description will be the same as the callsign.",
262
205
  ),
263
206
  cfg.StrOpt(
264
207
  "registry_url",
@@ -281,12 +224,8 @@ registry_opts = [
281
224
  def register_opts(config):
282
225
  config.register_opts(aprsd_opts)
283
226
  config.register_opts(enabled_plugins_opts)
284
- config.register_group(admin_group)
285
- config.register_opts(admin_opts, group=admin_group)
286
227
  config.register_group(watch_list_group)
287
228
  config.register_opts(watch_list_opts, group=watch_list_group)
288
- config.register_group(webchat_group)
289
- config.register_opts(webchat_opts, group=webchat_group)
290
229
  config.register_group(registry_group)
291
230
  config.register_opts(registry_opts, group=registry_group)
292
231
 
@@ -294,8 +233,6 @@ def register_opts(config):
294
233
  def list_opts():
295
234
  return {
296
235
  "DEFAULT": (aprsd_opts + enabled_plugins_opts),
297
- admin_group.name: admin_opts,
298
236
  watch_list_group.name: watch_list_opts,
299
- webchat_group.name: webchat_opts,
300
237
  registry_group.name: registry_opts,
301
238
  }
aprsd/conf/log.py CHANGED
@@ -1,11 +1,11 @@
1
1
  """
2
2
  The options for log setup
3
3
  """
4
+
4
5
  import logging
5
6
 
6
7
  from oslo_config import cfg
7
8
 
8
-
9
9
  LOG_LEVELS = {
10
10
  "CRITICAL": logging.CRITICAL,
11
11
  "ERROR": logging.ERROR,
@@ -59,7 +59,5 @@ def register_opts(config):
59
59
 
60
60
  def list_opts():
61
61
  return {
62
- logging_group.name: (
63
- logging_opts
64
- ),
62
+ logging_group.name: (logging_opts),
65
63
  }
aprsd/conf/opts.py CHANGED
@@ -31,7 +31,6 @@ import importlib
31
31
  import os
32
32
  import pkgutil
33
33
 
34
-
35
34
  LIST_OPTS_FUNC_NAME = "list_opts"
36
35
 
37
36
 
@@ -64,9 +63,11 @@ def _import_modules(module_names):
64
63
  for modname in module_names:
65
64
  mod = importlib.import_module("aprsd.conf." + modname)
66
65
  if not hasattr(mod, LIST_OPTS_FUNC_NAME):
67
- msg = "The module 'aprsd.conf.%s' should have a '%s' "\
68
- "function which returns the config options." % \
69
- (modname, LIST_OPTS_FUNC_NAME)
66
+ msg = (
67
+ "The module 'aprsd.conf.%s' should have a '%s' "
68
+ "function which returns the config options."
69
+ % (modname, LIST_OPTS_FUNC_NAME)
70
+ )
70
71
  raise Exception(msg)
71
72
  else:
72
73
  imported_modules.append(mod)
@@ -1,6 +1,5 @@
1
1
  from oslo_config import cfg
2
2
 
3
-
4
3
  aprsfi_group = cfg.OptGroup(
5
4
  name="aprs_fi",
6
5
  title="APRS.FI website settings",
@@ -18,16 +17,10 @@ owm_wx_group = cfg.OptGroup(
18
17
  title="Options for the OWMWeatherPlugin",
19
18
  )
20
19
 
21
- location_group = cfg.OptGroup(
22
- name="location_plugin",
23
- title="Options for the LocationPlugin",
24
- )
25
-
26
20
  aprsfi_opts = [
27
21
  cfg.StrOpt(
28
22
  "apiKey",
29
- help="Get the apiKey from your aprs.fi account here:"
30
- "http://aprs.fi/account",
23
+ help="Get the apiKey from your aprs.fi account here:" "http://aprs.fi/account",
31
24
  ),
32
25
  ]
33
26
 
@@ -35,11 +28,11 @@ owm_wx_opts = [
35
28
  cfg.StrOpt(
36
29
  "apiKey",
37
30
  help="OWMWeatherPlugin api key to OpenWeatherMap's API."
38
- "This plugin uses the openweathermap API to fetch"
39
- "location and weather information."
40
- "To use this plugin you need to get an openweathermap"
41
- "account and apikey."
42
- "https://home.openweathermap.org/api_keys",
31
+ "This plugin uses the openweathermap API to fetch"
32
+ "location and weather information."
33
+ "To use this plugin you need to get an openweathermap"
34
+ "account and apikey."
35
+ "https://home.openweathermap.org/api_keys",
43
36
  ),
44
37
  ]
45
38
 
@@ -47,116 +40,16 @@ avwx_opts = [
47
40
  cfg.StrOpt(
48
41
  "apiKey",
49
42
  help="avwx-api is an opensource project that has"
50
- "a hosted service here: https://avwx.rest/"
51
- "You can launch your own avwx-api in a container"
52
- "by cloning the githug repo here:"
53
- "https://github.com/avwx-rest/AVWX-API",
43
+ "a hosted service here: https://avwx.rest/"
44
+ "You can launch your own avwx-api in a container"
45
+ "by cloning the githug repo here:"
46
+ "https://github.com/avwx-rest/AVWX-API",
54
47
  ),
55
48
  cfg.StrOpt(
56
49
  "base_url",
57
50
  default="https://avwx.rest",
58
51
  help="The base url for the avwx API. If you are hosting your own"
59
- "Here is where you change the url to point to yours.",
60
- ),
61
- ]
62
-
63
- location_opts = [
64
- cfg.StrOpt(
65
- "geopy_geocoder",
66
- choices=[
67
- "ArcGIS", "AzureMaps", "Baidu", "Bing", "GoogleV3", "HERE",
68
- "Nominatim", "OpenCage", "TomTom", "USGov", "What3Words", "Woosmap",
69
- ],
70
- default="Nominatim",
71
- help="The geopy geocoder to use. Default is Nominatim."
72
- "See https://geopy.readthedocs.io/en/stable/#module-geopy.geocoders"
73
- "for more information.",
74
- ),
75
- cfg.StrOpt(
76
- "user_agent",
77
- default="APRSD",
78
- help="The user agent to use for the Nominatim geocoder."
79
- "See https://geopy.readthedocs.io/en/stable/#module-geopy.geocoders"
80
- "for more information.",
81
- ),
82
- cfg.StrOpt(
83
- "arcgis_username",
84
- default=None,
85
- help="The username to use for the ArcGIS geocoder."
86
- "See https://geopy.readthedocs.io/en/latest/#arcgis"
87
- "for more information."
88
- "Only used for the ArcGIS geocoder.",
89
- ),
90
- cfg.StrOpt(
91
- "arcgis_password",
92
- default=None,
93
- help="The password to use for the ArcGIS geocoder."
94
- "See https://geopy.readthedocs.io/en/latest/#arcgis"
95
- "for more information."
96
- "Only used for the ArcGIS geocoder.",
97
- ),
98
- cfg.StrOpt(
99
- "azuremaps_subscription_key",
100
- help="The subscription key to use for the AzureMaps geocoder."
101
- "See https://geopy.readthedocs.io/en/latest/#azuremaps"
102
- "for more information."
103
- "Only used for the AzureMaps geocoder.",
104
- ),
105
- cfg.StrOpt(
106
- "baidu_api_key",
107
- help="The API key to use for the Baidu geocoder."
108
- "See https://geopy.readthedocs.io/en/latest/#baidu"
109
- "for more information."
110
- "Only used for the Baidu geocoder.",
111
- ),
112
- cfg.StrOpt(
113
- "bing_api_key",
114
- help="The API key to use for the Bing geocoder."
115
- "See https://geopy.readthedocs.io/en/latest/#bing"
116
- "for more information."
117
- "Only used for the Bing geocoder.",
118
- ),
119
- cfg.StrOpt(
120
- "google_api_key",
121
- help="The API key to use for the Google geocoder."
122
- "See https://geopy.readthedocs.io/en/latest/#googlev3"
123
- "for more information."
124
- "Only used for the Google geocoder.",
125
- ),
126
- cfg.StrOpt(
127
- "here_api_key",
128
- help="The API key to use for the HERE geocoder."
129
- "See https://geopy.readthedocs.io/en/latest/#here"
130
- "for more information."
131
- "Only used for the HERE geocoder.",
132
- ),
133
- cfg.StrOpt(
134
- "opencage_api_key",
135
- help="The API key to use for the OpenCage geocoder."
136
- "See https://geopy.readthedocs.io/en/latest/#opencage"
137
- "for more information."
138
- "Only used for the OpenCage geocoder.",
139
- ),
140
- cfg.StrOpt(
141
- "tomtom_api_key",
142
- help="The API key to use for the TomTom geocoder."
143
- "See https://geopy.readthedocs.io/en/latest/#tomtom"
144
- "for more information."
145
- "Only used for the TomTom geocoder.",
146
- ),
147
- cfg.StrOpt(
148
- "what3words_api_key",
149
- help="The API key to use for the What3Words geocoder."
150
- "See https://geopy.readthedocs.io/en/latest/#what3words"
151
- "for more information."
152
- "Only used for the What3Words geocoder.",
153
- ),
154
- cfg.StrOpt(
155
- "woosmap_api_key",
156
- help="The API key to use for the Woosmap geocoder."
157
- "See https://geopy.readthedocs.io/en/latest/#woosmap"
158
- "for more information."
159
- "Only used for the Woosmap geocoder.",
52
+ "Here is where you change the url to point to yours.",
160
53
  ),
161
54
  ]
162
55
 
@@ -169,8 +62,6 @@ def register_opts(config):
169
62
  config.register_opts(owm_wx_opts, group=owm_wx_group)
170
63
  config.register_group(avwx_group)
171
64
  config.register_opts(avwx_opts, group=avwx_group)
172
- config.register_group(location_group)
173
- config.register_opts(location_opts, group=location_group)
174
65
 
175
66
 
176
67
  def list_opts():
@@ -178,5 +69,4 @@ def list_opts():
178
69
  aprsfi_group.name: aprsfi_opts,
179
70
  owm_wx_group.name: owm_wx_opts,
180
71
  avwx_group.name: avwx_opts,
181
- location_group.name: location_opts,
182
72
  }
aprsd/exception.py CHANGED
@@ -1,11 +1,13 @@
1
1
  class MissingConfigOptionException(Exception):
2
2
  """Missing a config option."""
3
+
3
4
  def __init__(self, config_option):
4
5
  self.message = f"Option '{config_option}' was not in config file"
5
6
 
6
7
 
7
8
  class ConfigOptionBogusDefaultException(Exception):
8
9
  """Missing a config option."""
10
+
9
11
  def __init__(self, config_option, default_fail):
10
12
  self.message = (
11
13
  f"Config file option '{config_option}' needs to be "