rhtyd closed pull request #3042: Allow password enabled for iso (#2745)
URL: https://github.com/apache/cloudstack/pull/3042
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
index 745b87dd941..f3e884cf23b 100644
---
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
+++
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
@@ -113,6 +113,11 @@
description = "true if ISO should bypass Secondary Storage and be
downloaded to Primary Storage on deployment")
private Boolean directDownload;
+ @Parameter(name = ApiConstants.PASSWORD_ENABLED,
+ type = CommandType.BOOLEAN,
+ description = "true if password reset feature is supported;
default is false")
+ private Boolean passwordEnabled;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -177,6 +182,10 @@ public boolean isDirectDownload() {
return directDownload == null ? false : directDownload;
}
+ public boolean isPasswordEnabled() {
+ return passwordEnabled == null ? false : passwordEnabled;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
index ccf5b8abe51..0d3c962b124 100644
---
a/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
+++
b/api/src/main/java/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
@@ -43,11 +43,6 @@ public Boolean getRequiresHvm() {
return null;
}
- @Override
- public Boolean getPasswordEnabled() {
- return null;
- }
-
@Override
public String getFormat() {
return null;
diff --git
a/server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
b/server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
index e4e0c442bf4..155fd14b531 100644
--- a/server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
+++ b/server/src/main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
@@ -327,6 +327,7 @@ public TemplateResponse newIsoResponse(TemplateJoinVO iso) {
isoResponse.setOsTypeId(iso.getGuestOSUuid());
isoResponse.setOsTypeName(iso.getGuestOSName());
isoResponse.setBits(iso.getBits());
+ isoResponse.setPasswordEnabled(iso.isEnablePassword());
// populate owner.
ApiResponseHelper.populateOwner(isoResponse, iso);
diff --git a/server/src/main/java/com/cloud/template/TemplateAdapterBase.java
b/server/src/main/java/com/cloud/template/TemplateAdapterBase.java
index ebb73daa590..dc4074c957f 100644
--- a/server/src/main/java/com/cloud/template/TemplateAdapterBase.java
+++ b/server/src/main/java/com/cloud/template/TemplateAdapterBase.java
@@ -331,7 +331,7 @@ public TemplateProfile prepare(RegisterIsoCmd cmd) throws
ResourceAllocationExce
zoneList.add(zoneId);
}
- return prepare(true, CallContext.current().getCallingUserId(),
cmd.getIsoName(), cmd.getDisplayText(), 64, false, true, cmd.getUrl(),
cmd.isPublic(),
+ return prepare(true, CallContext.current().getCallingUserId(),
cmd.getIsoName(), cmd.getDisplayText(), 64, cmd.isPasswordEnabled(), true,
cmd.getUrl(), cmd.isPublic(),
cmd.isFeatured(), cmd.isExtractable(), ImageFormat.ISO.toString(),
cmd.getOsTypeId(), zoneList, HypervisorType.None, cmd.getChecksum(),
cmd.isBootable(), null,
owner, null, false, cmd.getImageStoreUuid(),
cmd.isDynamicallyScalable(), TemplateType.USER, cmd.isDirectDownload());
}
diff --git a/test/integration/smoke/test_iso.py
b/test/integration/smoke/test_iso.py
index afd540a4624..53e42cb1cb3 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -304,6 +304,7 @@ def test_02_edit_iso(self):
self.apiclient,
id=self.iso_1.id
)
+
self.assertEqual(
isinstance(list_iso_response, list),
True,
@@ -332,6 +333,13 @@ def test_02_edit_iso(self):
self.services["ostypeid"],
"Check OSTypeID of updated ISO"
)
+
+ self.assertEqual(
+ iso_response.passwordenabled,
+ bool(self.services["passwordenabled"]),
+ "Check passwordenabled of updated ISO"
+ )
+
return
@attr(
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services