[ 
https://issues.apache.org/jira/browse/NIFI-15341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18046740#comment-18046740
 ] 

David Handermann commented on NIFI-15341:
-----------------------------------------

[~jgresock] After taking a closer look at the current Resolver implementation, 
it appears that this can be resolved by adjusting the matching strategy for the 
External Controller Service reference.

The current approach uses a Map of current property name to Controller Service 
API. When the Resolver uses the old property name to look at that Map, the 
lookup returns null, causing the reference to be unresolved.

Instead of this approach, a revised strategy can take Name of the External 
Controller Service reference, find a matching name in the available Controller 
Services, confirm it implements the expected Controller Service API, and then 
use the matched Controller Service ID to update the component properties. After 
that resolution succeeds, the existing property migration logic works as 
expected.

The following commit implements the change, and includes a flow definition from 
NiFi 2.0.0 using the StandardWebClientServiceProvider with a reference to a 
Provided SSL Context Service to validate the behavior.

[https://github.com/exceptionfactory/nifi/commit/7c6c93abe2d357d8af1033e06788fd7b082237ea]

Can you take a look at that approach and see if it works from your perspective?

> External Controller Service resolution can break with property migration
> ------------------------------------------------------------------------
>
>                 Key: NIFI-15341
>                 URL: https://issues.apache.org/jira/browse/NIFI-15341
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 2.7.1
>            Reporter: Joe Gresock
>            Assignee: Joe Gresock
>            Priority: Minor
>         Attachments: CS_Resolution.json
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> When importing or replacing a Process Group, External Controller Services can 
> fail to resolve if a component property was renamed between the versioned 
> flow and the currently installed bundle using property migration.
> To reproduce in 2.4.0 or later, download attached JSON file representing a 
> Process Group Replace request.  Then log into NiFi and copy the Bearer token. 
>  Then create a new blank process group in NiFi and copy its identifier for 
> below.
> Next, create a new StandardRestrictedSSLContextService at the root canvas and 
> name it "SSL Context Service".
> {code:java}
> BEARER_TOKEN=<paste bearer token>
> PG_ID=<pg id>
> curl -k -vv -X POST 
> https://localhost:8443/nifi-api/process-groups/$PG_ID/replace-requests -H 
> "Content-Type: application/json" -H "Authorization: Bearer $BEARER_TOKEN" -d 
> @CS_Resolution.json
> {code}
> Observe that the SSL Context Service property in the MongoDBControllerService 
> now references a UUID instead of the "SSL Context Service" service.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to