insightconnect-plugin-runtime 5.4.1__tar.gz → 5.4.2__tar.gz

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 (91) hide show
  1. {insightconnect-plugin-runtime-5.4.1/insightconnect_plugin_runtime.egg-info → insightconnect-plugin-runtime-5.4.2}/PKG-INFO +3 -3
  2. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/README.md +2 -1
  3. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/server.py +1 -21
  4. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2/insightconnect_plugin_runtime.egg-info}/PKG-INFO +3 -3
  5. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime.egg-info/requires.txt +0 -1
  6. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/setup.py +2 -3
  7. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_server_cloud_plugins.py +8 -22
  8. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/MANIFEST.in +0 -0
  9. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect-plugin-swagger.json +0 -0
  10. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/__init__.py +0 -0
  11. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/action.py +0 -0
  12. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/api/__init__.py +0 -0
  13. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/api/endpoints.py +0 -0
  14. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/api/schemas.py +0 -0
  15. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/cli.py +0 -0
  16. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/clients/__init__.py +0 -0
  17. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/clients/aws_client.py +0 -0
  18. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/clients/oauth.py +0 -0
  19. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/connection.py +0 -0
  20. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/data/input_message_schema.json +0 -0
  21. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/data/output_message_schema.json +0 -0
  22. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/dispatcher.py +0 -0
  23. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/exceptions.py +0 -0
  24. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/helper.py +0 -0
  25. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/metrics.py +0 -0
  26. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/plugin.py +0 -0
  27. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/schema.py +0 -0
  28. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/step.py +0 -0
  29. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/task.py +0 -0
  30. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/trigger.py +0 -0
  31. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/util.py +0 -0
  32. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime/variables.py +0 -0
  33. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime.egg-info/SOURCES.txt +0 -0
  34. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime.egg-info/dependency_links.txt +0 -0
  35. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/insightconnect_plugin_runtime.egg-info/top_level.txt +0 -0
  36. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/setup.cfg +0 -0
  37. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/__init__.py +0 -0
  38. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/__init__.py +0 -0
  39. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/__init__.py +0 -0
  40. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/__init__.py +0 -0
  41. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/__init__.py +0 -0
  42. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/__init__.py +0 -0
  43. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/__init__.py +0 -0
  44. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/action.py +0 -0
  45. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/hello/schema.py +0 -0
  46. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/__init__.py +0 -0
  47. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/action.py +0 -0
  48. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/return_bad_json/schema.py +0 -0
  49. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/__init__.py +0 -0
  50. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/action.py +0 -0
  51. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/actions/throw_exception/schema.py +0 -0
  52. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/__init__.py +0 -0
  53. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/connection.py +0 -0
  54. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/connection/schema.py +0 -0
  55. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/__init__.py +0 -0
  56. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/__init__.py +0 -0
  57. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/schema.py +0 -0
  58. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/tasks/monitor_events/task.py +0 -0
  59. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/__init__.py +0 -0
  60. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/__init__.py +0 -0
  61. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/schema.py +0 -0
  62. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/hello_trigger/trigger.py +0 -0
  63. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/__init__.py +0 -0
  64. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/schema.py +0 -0
  65. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/return_bad_json_trigger/trigger.py +0 -0
  66. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/__init__.py +0 -0
  67. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/schema.py +0 -0
  68. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/triggers/throw_exception_trigger/trigger.py +0 -0
  69. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/komand_hello_world/util/__init__.py +0 -0
  70. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/hello_world/setup.py +0 -0
  71. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/tests/__init__.py +0 -0
  72. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/tests/conftest.py +0 -0
  73. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/tests/test_cli.py +0 -0
  74. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/tests/test_hello_world.py +0 -0
  75. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/plugin/hello_world/tests/test_server.py +0 -0
  76. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/__init__.py +0 -0
  77. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_action.py +0 -0
  78. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_api.py +0 -0
  79. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_aws_action.py +0 -0
  80. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_custom_encoder.py +0 -0
  81. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_endpoints.py +0 -0
  82. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_exceptions.py +0 -0
  83. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_helpers.py +0 -0
  84. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_metrics.py +0 -0
  85. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_oauth.py +0 -0
  86. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_plugin.py +0 -0
  87. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_schema.py +0 -0
  88. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_server_spec.py +0 -0
  89. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_trigger.py +0 -0
  90. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/test_variables.py +0 -0
  91. {insightconnect-plugin-runtime-5.4.1 → insightconnect-plugin-runtime-5.4.2}/tests/unit/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: insightconnect-plugin-runtime
3
- Version: 5.4.1
3
+ Version: 5.4.2
4
4
  Summary: InsightConnect Plugin Runtime
5
5
  Home-page: https://github.com/rapid7/komand-plugin-sdk-python
6
6
  Author: Rapid7 Integrations Alliance
@@ -26,7 +26,6 @@ Requires-Dist: apispec-webframeworks==1.0.0
26
26
  Requires-Dist: blinker==1.7.0
27
27
  Requires-Dist: structlog==24.1.0
28
28
  Requires-Dist: python-json-logger==2.0.7
29
- Requires-Dist: APScheduler==3.10.4
30
29
 
31
30
 
32
31
  # InsightConnect Python Plugin Runtime ![Build Status](https://github.com/rapid7/komand-plugin-sdk-python/workflows/Continuous%20Integration/badge.svg)
@@ -186,7 +185,7 @@ Running a specific test file:
186
185
  | | Plugin | Slim Plugin |
187
186
  |:------------------|:-------:|:-----------:|
188
187
  | Python Version | 3.9.18 | 3.9.18 |
189
- | OS | Alpine | Bookworm |
188
+ | OS | Alpine | Bullseye |
190
189
  | Package installer | apk | apt |
191
190
  | Shell | /bin/sh | /bin/bash |
192
191
  | Image Size | ~350MB | ~180MB |
@@ -213,6 +212,7 @@ after cloning this repository.
213
212
 
214
213
  ## Changelog
215
214
 
215
+ * 5.4.2 - Remove background scheduler to simplify when the server gets custom_config values | Revert to use `bullseye` for slim image.
216
216
  * 5.4.1 - Retry logic added to get values from external API for custom_config values.
217
217
  * 5.4.0 - Implementation of custom_config parameter for plugin tasks | Alpine image updated OpenSSL and expat | Use `bookworm` for slim image.
218
218
  * 5.3.2 - Updated OpenSSL in alpine image and core packages to latest versions.
@@ -156,7 +156,7 @@ Running a specific test file:
156
156
  | | Plugin | Slim Plugin |
157
157
  |:------------------|:-------:|:-----------:|
158
158
  | Python Version | 3.9.18 | 3.9.18 |
159
- | OS | Alpine | Bookworm |
159
+ | OS | Alpine | Bullseye |
160
160
  | Package installer | apk | apt |
161
161
  | Shell | /bin/sh | /bin/bash |
162
162
  | Image Size | ~350MB | ~180MB |
@@ -183,6 +183,7 @@ after cloning this repository.
183
183
 
184
184
  ## Changelog
185
185
 
186
+ * 5.4.2 - Remove background scheduler to simplify when the server gets custom_config values | Revert to use `bullseye` for slim image.
186
187
  * 5.4.1 - Retry logic added to get values from external API for custom_config values.
187
188
  * 5.4.0 - Implementation of custom_config parameter for plugin tasks | Alpine image updated OpenSSL and expat | Use `bookworm` for slim image.
188
189
  * 5.3.2 - Updated OpenSSL in alpine image and core packages to latest versions.
@@ -6,8 +6,6 @@ import logging
6
6
  from apispec import APISpec
7
7
  from apispec.ext.marshmallow import MarshmallowPlugin
8
8
  from apispec_webframeworks.flask import FlaskPlugin
9
- from apscheduler.schedulers.background import BackgroundScheduler
10
-
11
9
 
12
10
  from flask import Flask, request_started, request
13
11
  import gunicorn.app.base
@@ -108,7 +106,7 @@ class PluginServer(gunicorn.app.base.BaseApplication):
108
106
  self.workers = workers
109
107
  self.threads = threads
110
108
  # initialise before reaching out to CPS for configured values
111
- self.config_options, self.schedule_interval = {}, None
109
+ self.config_options = {}
112
110
  self.get_plugin_properties_from_cps()
113
111
  self.app, self.blueprints = self.create_flask_app()
114
112
 
@@ -195,7 +193,6 @@ class PluginServer(gunicorn.app.base.BaseApplication):
195
193
  plugin_config = resp_json.get("plugins", {}).get(plugin, {})
196
194
 
197
195
  self.config_options = plugin_config
198
- self.schedule_interval = resp_json.get("config", {}).get("interval", DEFAULT_SCHEDULE_INTERVAL_MINUTES)
199
196
  self.logger.info("Plugin configuration successfully retrieved...")
200
197
  break
201
198
  except MissingSchema as missing_schema:
@@ -260,21 +257,6 @@ class PluginServer(gunicorn.app.base.BaseApplication):
260
257
  blueprint, url_prefix=VERSION_MAPPING[blueprint.name]
261
258
  )
262
259
 
263
- def register_scheduled_tasks(self):
264
- # Once Flask server is up and running also start the get_plugin_configs
265
- try:
266
- if self.plugin.tasks and self.schedule_interval:
267
- self.logger.info(f"Starting scheduled task(s) to run at interval of {self.schedule_interval} minutes...")
268
- scheduler = BackgroundScheduler(daemon=True)
269
- scheduler.add_job(self.get_plugin_properties_from_cps, 'interval', minutes=self.schedule_interval)
270
- scheduler.start()
271
- else:
272
- reason = "No tasks found found within plugin," if self.schedule_interval else "No schedule defined,"
273
- self.logger.info(f"{reason} not starting scheduled tasks...")
274
- except Exception as exception:
275
- self.logger.error("Unable to start up scheduler, plugin will not be refreshing these configuration values."
276
- f"Error={exception}", exc_info=True)
277
-
278
260
  @staticmethod
279
261
  def bind_request_details(sender: Flask, **extras) -> None:
280
262
  """
@@ -306,8 +288,6 @@ class PluginServer(gunicorn.app.base.BaseApplication):
306
288
  try:
307
289
  self.register_blueprint()
308
290
  self.register_api_spec()
309
- if is_running_in_cloud():
310
- self.register_scheduled_tasks()
311
291
  self.arbiter.run()
312
292
  except RuntimeError as e:
313
293
  sys.stderr.write("\nError: %s\n" % e)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: insightconnect-plugin-runtime
3
- Version: 5.4.1
3
+ Version: 5.4.2
4
4
  Summary: InsightConnect Plugin Runtime
5
5
  Home-page: https://github.com/rapid7/komand-plugin-sdk-python
6
6
  Author: Rapid7 Integrations Alliance
@@ -26,7 +26,6 @@ Requires-Dist: apispec-webframeworks==1.0.0
26
26
  Requires-Dist: blinker==1.7.0
27
27
  Requires-Dist: structlog==24.1.0
28
28
  Requires-Dist: python-json-logger==2.0.7
29
- Requires-Dist: APScheduler==3.10.4
30
29
 
31
30
 
32
31
  # InsightConnect Python Plugin Runtime ![Build Status](https://github.com/rapid7/komand-plugin-sdk-python/workflows/Continuous%20Integration/badge.svg)
@@ -186,7 +185,7 @@ Running a specific test file:
186
185
  | | Plugin | Slim Plugin |
187
186
  |:------------------|:-------:|:-----------:|
188
187
  | Python Version | 3.9.18 | 3.9.18 |
189
- | OS | Alpine | Bookworm |
188
+ | OS | Alpine | Bullseye |
190
189
  | Package installer | apk | apt |
191
190
  | Shell | /bin/sh | /bin/bash |
192
191
  | Image Size | ~350MB | ~180MB |
@@ -213,6 +212,7 @@ after cloning this repository.
213
212
 
214
213
  ## Changelog
215
214
 
215
+ * 5.4.2 - Remove background scheduler to simplify when the server gets custom_config values | Revert to use `bullseye` for slim image.
216
216
  * 5.4.1 - Retry logic added to get values from external API for custom_config values.
217
217
  * 5.4.0 - Implementation of custom_config parameter for plugin tasks | Alpine image updated OpenSSL and expat | Use `bookworm` for slim image.
218
218
  * 5.3.2 - Updated OpenSSL in alpine image and core packages to latest versions.
@@ -12,4 +12,3 @@ apispec-webframeworks==1.0.0
12
12
  blinker==1.7.0
13
13
  structlog==24.1.0
14
14
  python-json-logger==2.0.7
15
- APScheduler==3.10.4
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setup(
7
7
  name="insightconnect-plugin-runtime",
8
- version="5.4.1",
8
+ version="5.4.2",
9
9
  description="InsightConnect Plugin Runtime",
10
10
  long_description=long_description,
11
11
  long_description_content_type="text/markdown",
@@ -27,8 +27,7 @@ setup(
27
27
  "apispec-webframeworks==1.0.0",
28
28
  "blinker==1.7.0",
29
29
  "structlog==24.1.0",
30
- "python-json-logger==2.0.7",
31
- "APScheduler==3.10.4"
30
+ "python-json-logger==2.0.7"
32
31
  ],
33
32
  tests_require=[
34
33
  "pytest",
@@ -1,9 +1,9 @@
1
1
  from requests.exceptions import HTTPError, Timeout, TooManyRedirects
2
2
  from parameterized import parameterized
3
- from unittest import TestCase
3
+ from unittest import TestCase, skip
4
4
  from unittest.mock import patch, MagicMock
5
5
 
6
- from insightconnect_plugin_runtime.server import PluginServer, DEFAULT_SCHEDULE_INTERVAL_MINUTES
6
+ from insightconnect_plugin_runtime.server import PluginServer
7
7
  from tests.plugin.hello_world import KomandHelloWorld
8
8
  from .utils import MockResponse, Logger
9
9
 
@@ -18,26 +18,20 @@ class TestServerCloudPlugins(TestCase):
18
18
  self.plugin_name = self.plugin.name.lower().replace(" ", "_")
19
19
 
20
20
  @parameterized.expand([["Set cloud to false", False], ["Set cloud to true", True]])
21
- @patch("insightconnect_plugin_runtime.server.PluginServer.register_scheduled_tasks")
22
21
  @patch("insightconnect_plugin_runtime.server.request_get")
23
- def test_cloud_plugin_no_tasks_ignore_cps(self, _test_name, cloud, mocked_req, mocked_scheduler, mock_cloud, _run):
22
+ def test_cloud_plugin_no_tasks_ignore_cps(self, _test_name, cloud, mocked_req, mock_cloud, _run):
24
23
  mock_cloud.return_value = cloud # Mock plugin running in cloud vs not
25
24
  self.plugin.tasks = None # ensure still no tasks as other tests edit this and could fail before reverting
26
25
  plugin_server = PluginServer(self.plugin) # this plugin has no tasks by default
27
26
 
28
27
  plugin_server.start()
29
28
  self.assertEqual(plugin_server.config_options, {})
30
- self.assertEqual(plugin_server.schedule_interval, None)
31
-
32
- # Depending on if we're running cloud or not this could be called but we only reach to CPS if we have tasks
33
- self.assertEquals(mocked_scheduler.called, cloud)
34
29
 
35
30
  # Plugin server never calls out to CPS as either we are not running in cloud mode or have no tasks.
36
31
  self.assertFalse(mocked_req.called)
37
32
 
38
- @patch("insightconnect_plugin_runtime.server.PluginServer.register_scheduled_tasks")
39
33
  @patch("insightconnect_plugin_runtime.server.request_get")
40
- def test_cloud_plugin_calls_cps(self, mocked_req, mocked_scheduler, _mock_cloud, _run):
34
+ def test_cloud_plugin_calls_cps(self, mocked_req, _mock_cloud, _run):
41
35
  mocked_req.return_value = MockResponse({"plugins":{self.plugin_name: PLUGIN_VALUE_1, 'plugin': PLUGIN_VALUE_2},
42
36
  "config": {"interval": 25}})
43
37
  self.plugin.tasks = 'fake tasks' # this plugin by default has no tasks so force it to have some
@@ -49,19 +43,15 @@ class TestServerCloudPlugins(TestCase):
49
43
 
50
44
  # We only save the plugin config for the current config and ignore `other_plugin`
51
45
  self.assertDictEqual(plugin_server.config_options, PLUGIN_VALUE_1)
52
- self.assertEqual(plugin_server.schedule_interval, SCHEDULE_INTERVAL)
53
46
 
54
- # We should now schedule this to run
55
- self.assertEquals(mocked_scheduler.called, True)
56
47
  self.plugin.tasks = None # reset tasks value
57
48
 
58
49
  @parameterized.expand([["error", HTTPError], ["error", Timeout], ["unexpected", TooManyRedirects]])
59
- @patch("insightconnect_plugin_runtime.server.PluginServer.register_scheduled_tasks")
60
50
  @patch("insightconnect_plugin_runtime.server.request_get")
61
51
  @patch("structlog.get_logger")
62
52
  @patch("insightconnect_plugin_runtime.server.CPS_RETRY", new=2) # reduce retries in unit tests
63
53
  @patch("insightconnect_plugin_runtime.server.RETRY_SLEEP", new=1) # reduce sleep in unit tests
64
- def test_cps_schedule_raises_an_error(self, test_cond, exception, log, mocked_req, _mocked_scheduler, _mock_cloud, _run):
54
+ def test_cps_raises_an_error(self, test_cond, exception, log, mocked_req, _mock_cloud, _run):
65
55
  log.return_value = Logger()
66
56
  # If we have successfully got config and scheduler options, and later this call fails we should keep values
67
57
  mocked_req.return_value = MockResponse({"plugins": {self.plugin_name: PLUGIN_VALUE_1, 'plugin': PLUGIN_VALUE_2},
@@ -72,9 +62,8 @@ class TestServerCloudPlugins(TestCase):
72
62
  plugin_server.start()
73
63
 
74
64
  self.assertDictEqual(plugin_server.config_options, PLUGIN_VALUE_2)
75
- self.assertEqual(plugin_server.schedule_interval, DEFAULT_SCHEDULE_INTERVAL_MINUTES) # no resp uses default
76
65
 
77
- # First call has happened and now successful - force scheduler to hit specific handled and unexpected errors.
66
+ # First call has happened and now successful - force to hit specific handled and unexpected errors.
78
67
  mocked_req.side_effect = exception("Warning HTTP error returned...")
79
68
  plugin_server.get_plugin_properties_from_cps()
80
69
  # we log error in all and `unexpected` in TooManyRedirects as there is no direct catch for this
@@ -82,16 +71,13 @@ class TestServerCloudPlugins(TestCase):
82
71
 
83
72
  # Values should not have changed
84
73
  self.assertDictEqual(plugin_server.config_options, PLUGIN_VALUE_2)
85
- self.assertEqual(plugin_server.schedule_interval, DEFAULT_SCHEDULE_INTERVAL_MINUTES)
86
74
 
87
- # Next schedule returns updated values, new schedule and no configurations for plugins
88
- new_schedule = 12345678
89
- mocked_req.return_value = MockResponse({"config": {"interval": new_schedule}})
75
+ # Next schedule returns no configurations for plugins
76
+ mocked_req.return_value = MockResponse({})
90
77
  mocked_req.side_effect = None
91
78
  plugin_server.get_plugin_properties_from_cps()
92
79
 
93
80
  # And this new values are now updated for the plugin server
94
81
  self.assertDictEqual(plugin_server.config_options, {})
95
- self.assertEqual(plugin_server.schedule_interval, new_schedule)
96
82
 
97
83
  self.plugin.tasks = None # reset tasks value