This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 6a4a4da  api: Allow password enabled for iso (#2745) (#3042)
6a4a4da is described below

commit 6a4a4daa46c95d8fdf304a7b0b025702fda51821
Author: Anurag Awasthi <[email protected]>
AuthorDate: Wed Nov 28 00:09:20 2018 +0530

    api: Allow password enabled for iso (#2745) (#3042)
    
    Both register and update iso commands can allow for allowing password
    enabled.
    Fixes: #2745
    
    Fixe: #2745
---
 .../apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java   | 9 +++++++++
 .../org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java | 5 -----
 .../main/java/com/cloud/api/query/dao/TemplateJoinDaoImpl.java   | 1 +
 server/src/main/java/com/cloud/template/TemplateAdapterBase.java | 2 +-
 test/integration/smoke/test_iso.py                               | 8 ++++++++
 5 files changed, 19 insertions(+), 6 deletions(-)

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 745b87d..f3e884c 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 @@ public class RegisterIsoCmd extends BaseCmd {
             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 class RegisterIsoCmd extends BaseCmd {
         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 ccf5b8a..0d3c962 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
@@ -44,11 +44,6 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd 
{
     }
 
     @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 e4e0c44..155fd14 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 class TemplateJoinDaoImpl extends 
GenericDaoBaseWithTagInformation<Templa
         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 ebb73da..dc4074c 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 abstract class TemplateAdapterBase extends 
AdapterBase implements Templat
             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 afd540a..53e42cb 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -304,6 +304,7 @@ class TestISO(cloudstackTestCase):
             self.apiclient,
             id=self.iso_1.id
         )
+
         self.assertEqual(
             isinstance(list_iso_response, list),
             True,
@@ -332,6 +333,13 @@ class TestISO(cloudstackTestCase):
             self.services["ostypeid"],
             "Check OSTypeID of updated ISO"
         )
+
+        self.assertEqual(
+            iso_response.passwordenabled,
+            bool(self.services["passwordenabled"]),
+            "Check passwordenabled of updated ISO"
+        )
+
         return
 
     @attr(

Reply via email to