Skip to content

Commit 521f1b4

Browse files
authored
fix: automatically determine NiFi version create reporting task script (#1189)
* fix: determine nifi version in nifi 1 create reporting task script * chore: changelog * chore: formatting
1 parent 5485644 commit 521f1b4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ All notable changes to this project will be documented in this file.
114114
- hive: Patch for postgres CVE-2024-1597 ([#1100]).
115115
- bump image-tools (for `bake`) and nixpkgs (for `nodejs_20`, used by pre-commit) ([#1100]).
116116
- bump image-tools (for `bake`) to fix `RELEASE` arg ([#1188]).
117+
- nifi: automatically determine NiFi version create reporting task script ([#1189]).
117118

118119
### Removed
119120

@@ -211,6 +212,7 @@ All notable changes to this project will be documented in this file.
211212
[#1184]: https://github.com/stackabletech/docker-images/pull/1184
212213
[#1185]: https://github.com/stackabletech/docker-images/pull/1185
213214
[#1188]: https://github.com/stackabletech/docker-images/pull/1188
215+
[#1189]: https://github.com/stackabletech/docker-images/pull/1189
214216

215217
## [25.3.0] - 2025-03-21
216218

nifi/python/create_nifi_reporting_task.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,19 @@ def find_reporting_task(name: str, port: str):
4747
return None
4848

4949

50-
def create_reporting_task(name: str, port: str, version: str):
50+
def create_reporting_task(name: str, port: str):
5151
"""Create a ReportingTask"""
52+
nifi_version = nipyapi.system.get_system_diagnostics().system_diagnostics.aggregate_snapshot.version_info.ni_fi_version
5253
task = nipyapi.nifi.models.reporting_task_entity.ReportingTaskEntity(
5354
revision=nipyapi.nifi.models.revision_dto.RevisionDTO(version=0),
5455
disconnected_node_acknowledged=False,
5556
component=nipyapi.nifi.models.reporting_task_dto.ReportingTaskDTO(
5657
name=name,
5758
type="org.apache.nifi.reporting.prometheus.PrometheusReportingTask",
5859
bundle=nipyapi.nifi.models.bundle_dto.BundleDTO(
59-
group="org.apache.nifi", artifact="nifi-prometheus-nar", version=version
60+
group="org.apache.nifi",
61+
artifact="nifi-prometheus-nar",
62+
version=nifi_version,
6063
),
6164
properties={
6265
"prometheus-reporting-task-metrics-endpoint-port": port,
@@ -158,9 +161,7 @@ def main():
158161
reporting_task = find_reporting_task(name=task_name, port=port)
159162

160163
if reporting_task is None:
161-
reporting_task = create_reporting_task(
162-
name=task_name, port=port, version=args["nifi_version"]
163-
)
164+
reporting_task = create_reporting_task(name=task_name, port=port)
164165
print(
165166
get_reporting_task_name(task=reporting_task)
166167
+ " [%s] -> CREATED" % reporting_task.id

0 commit comments

Comments
 (0)