VMware Cloud Community
mcfadyenj
Hot Shot
Hot Shot

Customize VM (default workflow)

I am trying to run a sysprep only after a mass deployment workflow.

the first action in the default workflow duplicates an array of gateways.

the inparam is simply an array of gateways as a string.

i.e.

gateway = 10.10.10.10,10.10.10.11

the first action creates a new array and duplicates.

gateways = new Array();
if (gateway != null && gateway.length > 0) {
gateways.push(gateway[0]);
gateways.push(gateway[0]);
}

I have no idea why it is doing this and just wondered if it is actually important?

0 Kudos
2 Replies
tschoergez
Leadership
Leadership

Hi!

If I remember right, the vSphere API needs (at least in some version) exactly TWO gateways inside the customization specification.

So this piece of code ensures that there are exactly two gateways, even if the input array only has one (or more than two) entry.

But of course it seems to be very dirty, because it just copies the first entry, so if a user give two different gateway addresses as input, the second one is dropped. (Maybe it's also a workaround for some older bugs in the API handling of this gateway settings, I remember some discussions about this topic even in the PowerCLI-forums...)

If you want to rewrite it in a clean way , make sure that you test everything (no gateway, one gateway, two gateways with the same ip, two different gateways,  three or more gateways). You should also check if there is a documentation from Microsoft what sysprep is expecting here.

Regards,

Joerg

mcfadyenj
Hot Shot
Hot Shot

yes it does seem a little dirty. i will do some reserch in the power-cli forums as mentioned.

it doesn't make alot of sense it seems to be working without the duplicate action, but in saying that I haven't tested it thoroughly yet. I am using the 3.5 api so it could be ok in 3.5

0 Kudos