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

Ansible role is failing during update from Nexus 3.71.1-06 to 3.72.0-04 #431

Open
uwehdaub opened this issue Oct 7, 2024 · 5 comments
Open

Comments

@uwehdaub
Copy link

uwehdaub commented Oct 7, 2024

During the update from Nexus 3.71.1 to 3.72.0 the role (v2.5.1) fails with the following error message:

TASK [ansible-thoteam.nexus3-oss : Create/Check blobstores] ********************************************************************************************************************
included: /home/uwe/.ansible/roles/ansible-thoteam.nexus3-oss/tasks/call_script.yml for dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io

TASK [ansible-thoteam.nexus3-oss : Calling Groovy script create_blobstores_from_list] ******************************************************************************************
fatal: [dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io]: FAILED! => {"changed": false, "connection": "close", "content_length": "278", "content_type": "application/json", "date": "Mon, 07 Oct 2024 10:58:08 GMT", "elapsed": 0, "failed_when_result": true, "json": {"name": "create_blobstores_from_list", "result": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "Nexus/3.72.0-04 (OSS)", "status": 400, "url": "http://localhost:8081/service/rest/v1/script/create_blobstores_from_list/run", "x_content_type_options": "nosniff"}

TASK [ansible-thoteam.nexus3-oss : Debug script result for global fail] ********************************************************************************************************
skipping: [dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io]

TASK [ansible-thoteam.nexus3-oss : Global script failure at nexus level] *******************************************************************************************************
skipping: [dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io]

TASK [ansible-thoteam.nexus3-oss : Debug script result for failed script actions] **********************************************************************************************
ok: [dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io] => {
    "msg": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"
}

TASK [ansible-thoteam.nexus3-oss : Script action failure] **********************************************************************************************************************
fatal: [dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io]: FAILED! => {"changed": false, "msg": "The script create_blobstores_from_list returned at least one of its actions has failed. See the degug message above for details"}

PLAY RECAP *********************************************************************************************************************************************************************
dxnexustest0.ciserver.dxnexus.test1.peng.be-gcw1.metroscales.io : ok=87   changed=1    unreachable=0    failed=1    skipped=56   rescued=1    ignored=0   

The playbook was running on Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1060-gcp x86_64).

Ansible role v2.5.2 fails with the same error message.

@ismoilovdevml
Copy link

I have the same problem

TASK [ansible-ThoTeam.nexus3-oss : Calling Groovy script create_blobstores_from_list] ********************************************************************************************************
fatal: [ubuntu]: FAILED! => {"changed": false, "connection": "close", "content_length": "278", "content_type": "application/json", "date": "Mon, 07 Oct 2024 21:02:25 GMT", "elapsed": 0, "failed_when_result": true, "json": {"name": "create_blobstores_from_list", "result": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "Nexus/3.72.0-04 (OSS)", "status": 400, "url": "http://localhost:8081/service/rest/v1/script/create_blobstores_from_list/run", "x_content_type_options": "nosniff"}
fatal: [debian]: FAILED! => {"changed": false, "connection": "close", "content_length": "278", "content_type": "application/json", "date": "Mon, 07 Oct 2024 21:02:26 GMT", "elapsed": 1, "failed_when_result": true, "json": {"name": "create_blobstores_from_list", "result": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "Nexus/3.72.0-04 (OSS)", "status": 400, "url": "http://localhost:8081/service/rest/v1/script/create_blobstores_from_list/run", "x_content_type_options": "nosniff"}
fatal: [rockylinux]: FAILED! => {"changed": false, "connection": "close", "content_length": "278", "content_type": "application/json", "date": "Mon, 07 Oct 2024 21:02:26 GMT", "elapsed": 1, "failed_when_result": true, "json": {"name": "create_blobstores_from_list", "result": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"}, "msg": "Status code was 400 and not [200]: HTTP Error 400: Bad Request", "redirected": false, "server": "Nexus/3.72.0-04 (OSS)", "status": 400, "url": "http://localhost:8081/service/rest/v1/script/create_blobstores_from_list/run", "x_content_type_options": "nosniff"}

TASK [ansible-ThoTeam.nexus3-oss : Debug script result for global fail] **********************************************************************************************************************
skipping: [debian]
skipping: [rockylinux]
skipping: [ubuntu]

TASK [ansible-ThoTeam.nexus3-oss : Global script failure at nexus level] *********************************************************************************************************************
skipping: [debian]
skipping: [ubuntu]
skipping: [rockylinux]

TASK [ansible-ThoTeam.nexus3-oss : Debug script result for failed script actions] ************************************************************************************************************
ok: [debian] => {
    "msg": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"
}
ok: [ubuntu] => {
    "msg": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"
}
ok: [rockylinux] => {
    "msg": "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl.getBlobStoreManager() is applicable for argument types: () values: []"
}

TASK [ansible-ThoTeam.nexus3-oss : Script action failure] ************************************************************************************************************************************
fatal: [debian]: FAILED! => {"changed": false, "msg": "The script create_blobstores_from_list returned at least one of its actions has failed. See the debug message above for details"}
fatal: [ubuntu]: FAILED! => {"changed": false, "msg": "The script create_blobstores_from_list returned at least one of its actions has failed. See the debug message above for details"}
fatal: [rockylinux]: FAILED! => {"changed": false, "msg": "The script create_blobstores_from_list returned at least one of its actions has failed. See the debug message above for details"}

PLAY RECAP ***********************************************************************************************************************************************************************************
debian                     : ok=56   changed=1    unreachable=0    failed=1    skipped=44   rescued=1    ignored=0   
rockylinux                 : ok=58   changed=1    unreachable=0    failed=1    skipped=42   rescued=1    ignored=0   
ubuntu                     : ok=55   changed=1    unreachable=0    failed=1    skipped=44   rescued=1    ignored=0 

@brianveltman
Copy link
Contributor

I will provide a fix for this tomorrow. Thanks for reporting! Bumping into the same issue tho.

@uwehdaub
Copy link
Author

See sonatype/nexus-public#485

@Koeppchen
Copy link

Koeppchen commented Oct 14, 2024

I could not find a good way to access the blobStoreManager and we do not use the actual Codebase.
What worked for us, but what is really hacky is the folowing:

`
import org.sonatype.nexus.blobstore.api.BlobStoreManager
import java.lang.reflect.Field

// Hack to access BlobStore Manager, access was removed in Nexus 3.72 because Groovy implemetation was replaced by Java and the field was made private
Field  privateField = blobStore.class.getDeclaredField("blobStoreManager")
privateField.setAccessible(true)
BlobStoreManager blobStoreManager = (BlobStoreManager)privateField.get(blobStore)
//... other Code
existingBlobStore = blobStoreManager.get("BlobStoreName")
```
`

@brianveltman
Copy link
Contributor

See #432 for a better fix, since Sonatype officially does not support Groovy scripts anymore.
Will add more automated molecules tests for this change later this week, but this should get you guys up & running with the latest version of Nexus Repository Manager.

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

Successfully merging a pull request may close this issue.

4 participants