Create VM agent template and use usageMode. Set it to EXCLUSIVE or "EXCLUSIVE"
Initial configruation is loaded but the UI still shows localized message for NORMAL mode.
when trying to change the usageMode option from UI and save template Jenkins error occurs.
The exception is
java.lang.IllegalArgumentException: No enum constant hudson.model.Node.Mode.Wykorzystuj ten węzeł tak bardzo, jak to tylko możliwe
at java.lang.Enum.valueOf(Enum.java:238)
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:745)
at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:490)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:799)
Caused: java.lang.IllegalArgumentException: Failed to convert the usageMode parameter of the constructor public com.microsoft.azure.vmagent.AzureVMAgentTemplate(java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.microsoft.azure.vmagent.AzureVMAgentTemplate$AvailabilityTypeClass,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,hudson.model.Node$Mode,java.lang.String,java.lang.String,com.microsoft.azure.vmagent.AzureVMAgentTemplate$ImageReferenceTypeClass,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,hudson.slaves.RetentionStrategy,boolean,boolean)
at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:801)
at org.kohsuke.stapler.RequestImpl.access$200(RequestImpl.java:85)
at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:690)
So as we can see when trying to set this option from UI it takes the localized description and tries to convert it to Enum and it fails.
Results
Expected result:
I can usccessfuly change the usageMode option from UI and also when loading yml file the correct option is selected from the dropdown.
Version report
Jenkins and plugins versions report:
Jenkins: 2.317 OS: Linux - 5.4.0-1061-azure
ace-editor:1.1 apache-httpcomponents-client-4-api:4.5.13-1.0 azure-credentials:198.vf9c2fdfde55c azure-keyvault:129.vb7a46bc7b588 azure-sdk:61.v6a8af1f5f5b6 azure-vm-agents:795.vd5903dae1139 bootstrap4-api:4.6.0-3 bootstrap5-api:5.1.1-1 bouncycastle-api:2.20 branch-api:2.7.0 build-user-vars-plugin:1.8 caffeine-api:2.9.2-29.v717aac953ff3 checks-api:1.7.2 cloud-stats:0.27 cloudbees-folder:6.16 command-launcher:1.2 configuration-as-code:1.54 credentials:2.6.1 credentials-binding:1.27 display-url-api:2.3.5 durable-task:1.39 echarts-api:5.2.1-2 extended-read-permission:3.2 font-awesome-api:5.15.4-1 git:4.9.0 git-client:3.10.0 git-server:1.10 handlebars:3.0.8 jackson2-api:2.13.0-230.v59243c64b0a5 jdk-tool:1.0 jquery3-api:3.6.0-2 jsch:0.1.55.2 junit:1.53 ldap:2.7 lockable-resources:2.12 mailer:1.34 matrix-auth:2.6.8 matrix-project:1.19 momentjs:1.1.1 pipeline-build-step:2.15 pipeline-graph-analysis:1.11 pipeline-input-step:2.12 pipeline-milestone-step:1.3.2 pipeline-model-api:1.9.2 pipeline-model-definition:1.9.2 pipeline-model-extensions:1.9.2 pipeline-rest-api:2.19 pipeline-stage-step:2.5 pipeline-stage-tags-metadata:1.9.2 pipeline-stage-view:2.19 plain-credentials:1.7 plugin-util-api:2.5.0 popper-api:1.16.1-2 popper2-api:2.10.2-1 resource-disposer:0.16 role-strategy:3.2.0 scm-api:2.6.5 script-security:1.78 snakeyaml-api:1.29.1 ssh-credentials:1.19 sshd:3.1.0 structs:1.23 throttle-concurrents:2.4 timestamper:1.13 trilead-api:1.0.13 workflow-aggregator:2.6 workflow-api:2.47 workflow-basic-steps:2.24 workflow-cps:2.94 workflow-cps-global-lib:2.21 workflow-durable-task-step:2.40 workflow-job:2.42 workflow-multibranch:2.26 workflow-scm-step:2.13 workflow-step-api:2.24 workflow-support:3.8 ws-cleanup:0.39
Reproduction steps
usageMode
. Set it to EXCLUSIVE or "EXCLUSIVE"usageMode
option from UI and save template Jenkins error occurs.So as we can see when trying to set this option from UI it takes the localized description and tries to convert it to Enum and it fails.
Results
Expected result:
I can usccessfuly change the
usageMode
option from UI and also when loading yml file the correct option is selected from the dropdown.Actual result:
Exception is thrown and configuration fails.