You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "lordgamez (via GitHub)" <gi...@apache.org> on 2024/09/20 13:10:22 UTC
[PR] MINIFICPP-2378 Add support for parameters in controller services [nifi-minifi-cpp]
lordgamez opened a new pull request, #1868:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1868
https://issues.apache.org/jira/browse/MINIFICPP-2378
---------------------
Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
- [ ] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file?
- [ ] If applicable, have you updated the NOTICE file?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2378 Add support for parameters in controller services [nifi-minifi-cpp]
Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits closed pull request #1868: MINIFICPP-2378 Add support for parameters in controller services
URL: https://github.com/apache/nifi-minifi-cpp/pull/1868
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2378 Add support for parameters in controller services [nifi-minifi-cpp]
Posted by "szaszm (via GitHub)" <gi...@apache.org>.
szaszm closed pull request #1868: MINIFICPP-2378 Add support for parameters in controller services
URL: https://github.com/apache/nifi-minifi-cpp/pull/1868
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2378 Add support for parameters in controller services [nifi-minifi-cpp]
Posted by "lordgamez (via GitHub)" <gi...@apache.org>.
lordgamez commented on code in PR #1868:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1868#discussion_r1802613505
##########
extensions/standard-processors/tests/unit/FlowJsonTests.cpp:
##########
@@ -1028,4 +1028,124 @@ TEST_CASE("NiFi flow json can use alternative targetUris field") {
REQUIRE(port->getProperty("Port UUID") == "00000000-0000-0000-0000-000000000005");
}
+
+TEST_CASE("Test parameters in controller services") {
+ ConfigurationTestController test_controller;
+ auto context = test_controller.getContext();
+ auto encrypted_parameter_value = minifi::utils::crypto::property_encryption::encrypt("secret1!!1!", *context.sensitive_values_encryptor);
+ auto encrypted_sensitive_property_value = minifi::utils::crypto::property_encryption::encrypt("#{my_value_1}", *context.sensitive_values_encryptor);
+ core::flow::AdaptiveConfiguration json_config(context);
+
+ static const std::string CONFIG_JSON =
+ fmt::format(R"(
+{{
+ "parameterContexts": [
+ {{
+ "identifier": "721e10b7-8e00-3188-9a27-476cca376978",
+ "name": "my-context",
+ "description": "my parameter context",
+ "parameters": [
+ {{
+ "name": "my_value_1",
+ "description": "",
+ "sensitive": true,
+ "value": "{}"
+ }},
+ {{
+ "name": "my_value_2",
+ "description": "",
+ "sensitive": false,
+ "value": "/opt/secrets/private-key.pem"
+ }}
+ ]
+ }}
+ ],
+ "rootGroup": {{
+ "name": "MiNiFi Flow",
+ "processors": [],
+ "controllerServices": [{{
+ "identifier": "a00f8722-2419-44ee-929c-ad68644ad557",
+ "name": "SSLContextService",
+ "type": "org.apache.nifi.minifi.controllers.SSLContextService",
+ "properties": {{
+ "Passphrase": "{}",
+ "Private Key": "#{{my_value_2}}",
+ "Use System Cert Store": "true"
+ }}
+ }}],
+ "parameterContextName": "my-context"
+ }}
+}})", encrypted_parameter_value, encrypted_sensitive_property_value);
Review Comment:
Updated in a9a1ad9d4b2bc4b20d2b937828ac2ec39cc8185c
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINIFICPP-2378 Add support for parameters in controller services [nifi-minifi-cpp]
Posted by "fgerlits (via GitHub)" <gi...@apache.org>.
fgerlits commented on code in PR #1868:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1868#discussion_r1801056176
##########
extensions/standard-processors/tests/unit/FlowJsonTests.cpp:
##########
@@ -1028,4 +1028,124 @@ TEST_CASE("NiFi flow json can use alternative targetUris field") {
REQUIRE(port->getProperty("Port UUID") == "00000000-0000-0000-0000-000000000005");
}
+
+TEST_CASE("Test parameters in controller services") {
+ ConfigurationTestController test_controller;
+ auto context = test_controller.getContext();
+ auto encrypted_parameter_value = minifi::utils::crypto::property_encryption::encrypt("secret1!!1!", *context.sensitive_values_encryptor);
+ auto encrypted_sensitive_property_value = minifi::utils::crypto::property_encryption::encrypt("#{my_value_1}", *context.sensitive_values_encryptor);
+ core::flow::AdaptiveConfiguration json_config(context);
+
+ static const std::string CONFIG_JSON =
+ fmt::format(R"(
+{{
+ "parameterContexts": [
+ {{
+ "identifier": "721e10b7-8e00-3188-9a27-476cca376978",
+ "name": "my-context",
+ "description": "my parameter context",
+ "parameters": [
+ {{
+ "name": "my_value_1",
+ "description": "",
+ "sensitive": true,
+ "value": "{}"
+ }},
+ {{
+ "name": "my_value_2",
+ "description": "",
+ "sensitive": false,
+ "value": "/opt/secrets/private-key.pem"
+ }}
+ ]
+ }}
+ ],
+ "rootGroup": {{
+ "name": "MiNiFi Flow",
+ "processors": [],
+ "controllerServices": [{{
+ "identifier": "a00f8722-2419-44ee-929c-ad68644ad557",
+ "name": "SSLContextService",
+ "type": "org.apache.nifi.minifi.controllers.SSLContextService",
+ "properties": {{
+ "Passphrase": "{}",
+ "Private Key": "#{{my_value_2}}",
+ "Use System Cert Store": "true"
+ }}
+ }}],
+ "parameterContextName": "my-context"
+ }}
+}})", encrypted_parameter_value, encrypted_sensitive_property_value);
Review Comment:
I think this would be more readable with named fmt arguments:
```
...
"value": "{encrypted_parameter}"
...
"Passphrase": "{encrypted_passphrase}"
...
}})", fmt::arg("encrypted_parameter", encrypted_parameter_value), fmt::arg("encrypted_passphrase", encrypted_sensitive_property_value));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org