Created on 03-21-2017 07:51 PM - edited 08-18-2019 03:59 AM
I'm trying to add in a password field to an execute script processor, how do I make this field "sensitive"?
Created 03-21-2017 08:12 PM
With the ExecuteScript processor, you are likely just adding Dynamic Properties (also known as User-Defined Properties), which are not sensitive. To add your own sensitive properties to a scripted processor, you would need to use InvokeScriptedProcessor. There's an example from the NiFi mailing list (though not with sensitive properties, you'd just need to add .sensitive(true) to your PropertyDescriptor.Builder, and I have another example (with no added properties) on my blog.
Created 03-21-2017 08:12 PM
With the ExecuteScript processor, you are likely just adding Dynamic Properties (also known as User-Defined Properties), which are not sensitive. To add your own sensitive properties to a scripted processor, you would need to use InvokeScriptedProcessor. There's an example from the NiFi mailing list (though not with sensitive properties, you'd just need to add .sensitive(true) to your PropertyDescriptor.Builder, and I have another example (with no added properties) on my blog.
Created 03-21-2017 08:51 PM
Hi thanks for the response, I'm Trying to use this inside the custom processor script, but it is not showing up as a required parameter in InvokeScriptedProcessor. I currently have this in "script body", along with the rest of the class.
def password = new PropertyDescriptor.Builder() .name('Password') .description("Password used to connect") .required(true) .sensitive(true) .build()
Created 03-23-2017 07:50 PM
Check the getPropertyDescriptor() and getPropertyDescriptors() methods from the example in the mailing list (link above). You have to look up the descriptor by name in the former, and return a List of the PropertyDescriptors in the latter.
Created 03-22-2017 02:05 PM
Hi,
Your example is showing an error: "Unable to resolve class ProcessorLog"
I did a direct import of your template.
Created 03-23-2017 07:46 PM
That example was written against NiFi 0.x. In NiFi 1.x you can use ComponentLog rather than ProcessorLog.
Created 03-23-2017 05:40 PM
@Matt Burgess Is there anyway of not using the password in your examples if I had already setup password-less SSH. The groovy script is throwing an error if I try to not use the password.
Created 03-23-2017 07:48 PM
You can set .required(false) on your password property. Later on when the script would try to use the value (if it is set), you can call context.getProperty(password).isSet() to see if anything has been entered.