Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xlrelease]ImportError: cannot import name PasswordEncrypter in <script> #3

Open
mannepu opened this issue Jul 2, 2020 · 4 comments

Comments

@mannepu
Copy link

mannepu commented Jul 2, 2020

I am trying to import PasswordEncrypter in xlrelease jython script task as given below:
from com.xebialabs.deployit.util import PasswordEncrypter

and getting
Exception during execution: ImportError: cannot import name PasswordEncrypter in <script> at line number 1

@amitmohleji
Copy link
Contributor

What version of XL Release are you using @mannepu

@mannepu
Copy link
Author

mannepu commented Jul 28, 2020

9.6.1

@briandesousa
Copy link

I am also encountering this error. We have multiple instances of XL Release running and oddly enough I encounter this error when trying to use the PasswordEncrypter class in a Script task on one instance, and it works perfectly fine in a Script task on the other instance. I suspect we have some sort of configuration difference between the instances.

Regardless, as I was investigating this, I came across a code comment in one of the examples on the Digital.ai (XebiaLabs) documentation site that seems to suggest that this class is only accessible to "packaged scripts" which I assume refers to scripts packaged in custom XLR plugins:

# required to decrypt password properties. Can only be used by packaged scripts.
from com.xebialabs.deployit.util import PasswordEncrypter

Reference: https://docs.xebialabs.com/v.9.5/release/webhooks/webhook-plugins/#custom-authentication-method-url-parameter-token

@Aaouad123
Copy link

is your XLR instance running in sandbox mode or not? If it is it won't be able to access the password encryptor class by default.
On versions older than 9 you have to add a permission in the script.policy file in order to be able to access this class:
permission  com.xebialabs.xlrelease.script.security.RuntimePermission "accessClass.com.xebialabs.deployit.util.PasswordEncrypter";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants