api: Allow password enabled for iso (#2745) (#3042)

Both register and update iso commands can allow for allowing password
enabled.
Fixes: #2745

Fixe: #2745
This commit is contained in:
Anurag Awasthi 2018-11-28 00:09:20 +05:30 committed by Rohit Yadav
parent 2334145602
commit 6a4a4daa46
5 changed files with 19 additions and 6 deletions

View File

@ -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///////////////////
/////////////////////////////////////////////////////

View File

@ -43,11 +43,6 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
return null;
}
@Override
public Boolean getPasswordEnabled() {
return null;
}
@Override
public String getFormat() {
return null;

View File

@ -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);

View File

@ -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());
}

View File

@ -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(