Skip to content

Commit

Permalink
[JENKINS-72622] Rename CloudSet query parameter to avoid conflict (#9198
Browse files Browse the repository at this point in the history
)

* [JENKINS-72622] Rename CloudSet query parameter to avoid conflict

* [JENKINS-72622] Address SpotBugs warning
  • Loading branch information
Dohbedoh authored May 19, 2024
1 parent 87c5fb9 commit eb65336
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions core/src/main/java/jenkins/agents/CloudSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,13 @@ private void handleNewCloudPage(Descriptor<Cloud> descriptor, String name, Stapl
*/
@POST
public synchronized void doDoCreate(StaplerRequest req, StaplerResponse rsp,
@QueryParameter String type) throws IOException, ServletException, Descriptor.FormException {
@QueryParameter String cloudDescriptorName) throws IOException, ServletException, Descriptor.FormException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
Cloud cloud = Cloud.all().find(type).newInstance(req, req.getSubmittedForm());
Descriptor<Cloud> cloudDescriptor = Cloud.all().findByName(cloudDescriptorName);
if (cloudDescriptor == null) {
throw new Failure(String.format("No cloud type ‘%s’ is known", cloudDescriptorName));
}
Cloud cloud = cloudDescriptor.newInstance(req, req.getSubmittedForm());
if (!Jenkins.get().clouds.add(cloud)) {
LOGGER.log(Level.WARNING, () -> "Creating duplicate cloud name " + cloud.name + ". Plugin " + Jenkins.get().getPluginManager().whichPlugin(cloud.getClass()) + " should be updated to support user provided name.");
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/jenkins/agents/CloudSet/_new.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ THE SOFTWARE.
<st:include it="${requestScope.instance}" class="${requestScope.descriptor.clazz}" page="config.jelly" optional="true" />

<f:bottomButtonBar>
<input type="hidden" name="type" value="${request.getParameter('mode')}"/>
<input type="hidden" name="cloudDescriptorName" value="${request.getParameter('mode')}"/>

<f:submit value="${%Save}"/>
</f:bottomButtonBar>
Expand Down

0 comments on commit eb65336

Please sign in to comment.