Creating node with Rest API and ManuallyTrustedKeyVerificationStrategy

Issue

Creating node with Rest API and ManuallyTrustedKeyVerificationStrategy

Environment

Resolution

These scripts shows you how to create a node from the Rest API using the Host Verification Strategy with ManuallyTrustedKeyVerificationStrategy and using a JSON parameter:

curl -L -s -o /dev/null http://example.com -u "admin:e95dd98ec52b808f5177c7321a58a08a" -H "Content-Type:application/x-www-form-urlencoded" -H "Jenkins-Crumb:9dd8dd838e2cf94ebe0fa085f09d9559" -X POST -d 'json={ "name":"pruebaNodo","nodeDescription": "descripcion", "numExecutors": "2", "remoteFS": "0.0.0.0" , "labelString": "labels", "mode": "NORMAL", "": ["hudson.plugins.sshslaves.SSHLauncher"], "launcher": { "stapler-class": "hudson.plugins.sshslaves.SSHLauncher", "class": "hudson.plugins.sshslaves.SSHLauncher", "host": "sshhos" , "credentialsId": "idCredencial", "port":  "8090", "javaPath": "", "jvmOptions": "-Dorg.jenkinsci.plugins.gitclient.Git.timeOut=60", "prefixStartSlaveCmd": "", "suffixStartSlaveCmd": "", "launchTimeoutSeconds": "", "maxNumRetries": "", "retryWaitTime": "", "sshHostKeyVerificationStrategy": { "stapler-class": "hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy", "class": "hudson.plugins.sshslaves.verifiers.ManuallyTrustedKeyVerificationStrategy", "requireInitialManualTrust": false }}, "nodeProperties": { "stapler-class-bag": true, "com-cloudbees-jenkins-plugins-nodesplus-OwnerNodeProperty": { "owners": "correo@gmail.com", "onOnline": true, "onOffline": true, "onLaunchFailure": true, "onFirstLaunchFailure": true, "onTemporaryOfflineApplied": true, "onTemporaryOfflineRemoved": true } },"crumb": "Jenkins-Crumb:9dd8dd838e2cf94ebe0fa085f09d9559"}' "example.com/computer/doCreateItem?name=pruebaNodo&type=hudson.slaves.DumbSlave"

Note: You can also use a XML file instead of a JSON

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.