mirror of https://github.com/apache/cloudstack.git
server: Allow template names upto 255 chars (#6768)
* Allow template names upto 255 chars * Update error message * externalise name length in constant Fixes: #6766
This commit is contained in:
parent
432a03fb02
commit
89d9a70dce
|
|
@ -30,6 +30,8 @@ import com.cloud.utils.fsm.StateMachine2;
|
|||
import com.cloud.utils.fsm.StateObject;
|
||||
|
||||
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachineTemplate.State> {
|
||||
int MAXIMUM_TEMPLATE_NAME_LENGTH = 255;
|
||||
|
||||
enum State {
|
||||
Active,
|
||||
Inactive,
|
||||
|
|
|
|||
|
|
@ -1747,8 +1747,9 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
_accountMgr.checkAccess(caller, null, true, templateOwner);
|
||||
|
||||
String name = cmd.getTemplateName();
|
||||
if ((name == null) || (name.length() > 32)) {
|
||||
throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
|
||||
if ((org.apache.commons.lang3.StringUtils.isBlank(name)
|
||||
|| (name.length() > VirtualMachineTemplate.MAXIMUM_TEMPLATE_NAME_LENGTH))) {
|
||||
throw new InvalidParameterValueException(String.format("Template name cannot be null and cannot be more %s characters", VirtualMachineTemplate.MAXIMUM_TEMPLATE_NAME_LENGTH));
|
||||
}
|
||||
|
||||
if (cmd.getTemplateTag() != null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue