Any idea how to make this delete all existing key pairs to ensure only the 
ones defined in this script  are the ones in Jenkins?

On Wednesday, February 25, 2015 at 4:53:27 PM UTC-5, Victor Volle wrote:
>
> Final solution:
>
> instance = Jenkins.getInstance()
> globalNodeProperties = instance.getGlobalNodeProperties()
> envVarsNodePropertyList = globalNodeProperties.getAll(hudson.slaves.
> EnvironmentVariablesNodeProperty.class)
>
> newEnvVarsNodeProperty = null
> envVars = null
>
> if ( envVarsNodePropertyList == null || envVarsNodePropertyList.size() == 
> 0 ) {
>   newEnvVarsNodeProperty = new hudson.slaves.
> EnvironmentVariablesNodeProperty();
>   globalNodeProperties.add(newEnvVarsNodeProperty)
>   envVars = newEnvVarsNodeProperty.getEnvVars()
> } else {
>   envVars = envVarsNodePropertyList.get(0).getEnvVars()
> }
>
> envVars.put("FOO", "foo")
>
> instance.save()
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/777d76e0-6189-42d8-97e7-6ab38c122dad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to