Skip to content

Commit

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

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

* [JENKINS-72622] Address SpotBugs warning

(cherry picked from commit eb65336)
  • Loading branch information
Dohbedoh authored and krisstern committed May 24, 2024
1 parent b87adb7 commit 5078005
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 5078005

Please sign in to comment.