Skip to content

Commit

Permalink
Allow selecting additional license types (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Dec 18, 2024
1 parent 45194a3 commit 4742455
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1576,9 +1576,20 @@ public ListBoxModel doFillOsTypeItems() throws IOException, ServletException {
@POST
public ListBoxModel doFillLicenseTypeItems() {
ListBoxModel model = new ListBoxModel();
model.add(Constants.LICENSE_TYPE_CLASSIC);
model.add(Constants.LICENSE_TYPE_NONE);
model.add(Constants.LICENSE_TYPE_WINDOWS_CLIENT);
model.add(Constants.LICENSE_TYPE_WINDOWS_SERVER);
model.add("RHEL_BASE");
model.add("RHEL_BYOS");
model.add("RHEL_EUS");
model.add("RHEL_SAPAPPS");
model.add("RHEL_SAPHA");
model.add("RHEL_BASESAPAPPS");
model.add("RHEL_BASESAPHA");
model.add("SLES");
model.add("SLES_BYOS");
model.add("SLES_SAP");
model.add("SLES_HPC");

Check warning on line 1592 in src/main/java/com/microsoft/azure/vmagent/AzureVMAgentTemplate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 1579-1592 are not covered by tests
return model;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ public AzureVMDeploymentInfo createDeployment(
putParameter(parameters, "authenticationType", "key");
}

if (!Constants.LICENSE_TYPE_CLASSIC.equals(template.getLicenseType())) {
if (!Constants.LICENSE_TYPE_NONE.equals(template.getLicenseType())) {

Check warning on line 735 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 735 is not covered by tests
addLicenseType(tmp, template.getLicenseType());
}

Expand Down Expand Up @@ -867,15 +867,13 @@ private void addAcceleratedNetworking(JsonNode template) {
}

private void addLicenseType(JsonNode template, String licenseType) {
if (Constants.LICENSE_TYPE_WINDOWS_CLIENT.equals(licenseType) || Constants.LICENSE_TYPE_WINDOWS_SERVER.equals(licenseType)) {
ArrayNode resources = (ArrayNode) template.get("resources");
for (JsonNode resource : resources) {
String type = resource.get("type").asText();
if (type.contains("virtualMachine")) {
ObjectNode properties = (ObjectNode) resource.get("properties");
properties.put("licenseType", licenseType);
return;
}
ArrayNode resources = (ArrayNode) template.get("resources");
for (JsonNode resource : resources) {
String type = resource.get("type").asText();
if (type.contains("virtualMachine")) {
ObjectNode properties = (ObjectNode) resource.get("properties");
properties.put("licenseType", licenseType);
return;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public final class Constants {
/**
* Windows License Types.
*/
public static final String LICENSE_TYPE_CLASSIC = "Classic";
public static final String LICENSE_TYPE_NONE = "None";

public static final String LICENSE_TYPE_WINDOWS_CLIENT = "Windows_Client";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<div>
For Windows agents, if you want to use <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/windows/hybrid-use-benefit-licensing">Azure Hybrid Benefit</a>, then you can specify one of the following values:
<p>For Windows agents, if you want to use <a target="_blank"
href="https://learn.microsoft.com/en-us/azure/virtual-machines/windows/hybrid-use-benefit-licensing">Azure
Hybrid Benefit</a>, then you can specify one of the following values:
</p>
<ul>
<li>Windows_Client</li>
<li>Windows_Server</li>
</ul>
Otherwise, leaving the value as <code>Classic</code> will not specify any license type.
<p>For Linux agents see <a target="_blank"
href="https://learn.microsoft.com/en-us/azure/virtual-machines/linux/azure-hybrid-benefit-linux">Azure
Hybrid Benefit for Red Hat Enterprise Linux (RHEL) and SUSE Linux Enterprise Server (SLES) Virtual Machines</a>.
</p>

<p>Otherwise, leaving the value as <code>None</code> will not specify any license type.</p>
</div>

0 comments on commit 4742455

Please sign in to comment.