Make an ovf property mandatory to specify during ovf deployment

1.1k Views Asked by At

I'm looking to make setting a root password mandatory while deploying an ova to create a vm. I set the property in the ovf but I can't seem to make it mandatory. VSphere client shows the property while deploying, but the user can skip setting a value and move to the next step.

<ProductSection ovf:class="hx" ovf:instance="Some_Appliance" ovf:required="false">
  <Info>Application Properties</Info>
  <Category>Networking Properties</Category>
  <Property ovf:key="DNS" ovf:type="string" ovf:userConfigurable="true">
    <Label>DNS</Label>
  </Property>
  <Property ovf:key="domain" ovf:type="string" ovf:userConfigurable="true">
    <Label>Search domains</Label>
  </Property>
  <Property ovf:key="NTP" ovf:type="string" ovf:userConfigurable="true">
    <Label>NTP</Label>
  </Property>
  <Property ovf:key="root_password" ovf:password="true" ovf:required="true" ovf:qualifiers="MinLen(0),MaxLen(65535)" ovf:type="string" ovf:userConfigurable="true">
     <Label>Root Password</Label>
     <Description>To set the root password</Description>
  </Property>

I've tried setting ovf:required="true" in the product section (although ideally it should be false, because the other pre-existing settings should not be mandatory). Also I've tried setting the last property to ovf:required="true" but that didn't work either.

I'm not sure if the ovf:required flag is the right property to do this. The ovf specification guide isn't very clear about this but it says this.

On custom elements, a Boolean ovf:required attribute specifies whether the information in the element is required for correct behavior or optional. If not specified, the ovf:required attribute defaults to TRUE. A consumer of an OVF package that detects an extension that is required and that it does not understand shall fail.

How do I make setting the root password mandatory?

1

There are 1 best solutions below

0
On

I kind of fixed this issue by setting min length to 8. It's still not the ideal solution but I think this solves my problem.

ovf:qualifiers="MinLen(8),MaxLen(20)"

Because minlength used to be 0, it let the user skip past the password set text. Now it warns the user during deploy saying that the vm can't be powered on without setting the right values.

The user can still skip setting the password, but I can't power on the vm. You try powering it on, it'll ask you to set the "root password" property.

This makes the attribute mandatory, but a cleaner way (if available) would be to not let the user continue the deploy without setting the password.