Source:
<code>public VmInit buildCloudInitParameters() { VmInit vmInit = new VmInit(); if (getHostnameEnabled()) { vmInit.setHostname(isWindowsOS ? getWindowsHostname().getEntity() : getHostname().getEntity()); } if (isWindowsOS) { vmInit.setInputLocale(getInputLocale().getEntity()); vmInit.setUiLanguage(getUiLanguage().getEntity()); vmInit.setSystemLocale(getSystemLocale().getEntity()); vmInit.setUserLocale(getUserLocale().getEntity()); vmInit.setCustomScript(getSysprepScript().getEntity()); vmInit.setActiveDirectoryOU(getActiveDirectoryOU().getEntity()); if (getSysprepPasswordEnabled()) { vmInit.setRootPassword(getSysprepAdminPassword().getEntity()); <START> vmInit.setRootPassword(getSysprepAdminPassword().getEntity()); <END> } vmInit.setPasswordAlreadyStored(getSysprepPasswordSet().getEntity()); vmInit.setOrgName(getSysprepOrgName().getEntity()); } else { vmInit.setCustomScript(getCustomScript().getEntity()); if (getRootPasswordEnabled()) { vmInit.setRootPassword(getCloudInitRootPassword().getEntity()); } vmInit.setPasswordAlreadyStored(getCloudInitPasswordSet().getEntity()); } vmInit.setUserName(getUserName().getEntity()); vmInit.setAuthorizedKeys(getAuthorizedKeys().getEntity()); if (getRegenerateKeysEnabled().getEntity()) { vmInit.setRegenerateKeys(Boolean.TRUE); } if (getNetworkEnabled().getEntity()) { saveNetworkFields(); if (!networkMap.isEmpty()) { for (Map.Entry<String, VmInitNetwork> entry : networkMap.entrySet()) { VmInitNetwork params = entry.getValue(); if (params.getBootProtocol() != NetworkBootProtocol.STATIC_IP) { params.setIp(null); params.setNetmask(null); params.setGateway(null); } params.setStartOnBoot(networkStartOnBoot.contains(entry.getKey())); params.setName(entry.getKey()); } vmInit.setNetworks(new ArrayList<VmInitNetwork>(networkMap.values())); } } vmInit.setDnsServers(getDnsServers().getEntity()); vmInit.setDnsSearch(getDnsSearchDomains().getEntity()); return vmInit; }</code><technical_language>Is this duplicate setting of root password intended</technical_language>

Target:
public VmInit buildCloudInitParameters() { VmInit vmInit = new VmInit(); if (getHostnameEnabled()) { vmInit.setHostname(isWindowsOS ? getWindowsHostname().getEntity() : getHostname().getEntity()); } if (isWindowsOS) { vmInit.setInputLocale(getInputLocale().getEntity()); vmInit.setUiLanguage(getUiLanguage().getEntity()); vmInit.setSystemLocale(getSystemLocale().getEntity()); vmInit.setUserLocale(getUserLocale().getEntity()); vmInit.setCustomScript(getSysprepScript().getEntity()); vmInit.setActiveDirectoryOU(getActiveDirectoryOU().getEntity()); if (getSysprepPasswordEnabled()) { vmInit.setRootPassword(getSysprepAdminPassword().getEntity()); } vmInit.setPasswordAlreadyStored(getSysprepPasswordSet().getEntity()); vmInit.setOrgName(getSysprepOrgName().getEntity()); } else { vmInit.setCustomScript(getCustomScript().getEntity()); if (getRootPasswordEnabled()) { vmInit.setRootPassword(getCloudInitRootPassword().getEntity()); } vmInit.setPasswordAlreadyStored(getCloudInitPasswordSet().getEntity()); } vmInit.setUserName(getUserName().getEntity()); vmInit.setAuthorizedKeys(getAuthorizedKeys().getEntity()); if (getRegenerateKeysEnabled().getEntity()) { vmInit.setRegenerateKeys(Boolean.TRUE); } if (getNetworkEnabled().getEntity()) { saveNetworkFields(); if (!networkMap.isEmpty()) { for (Map.Entry<String, VmInitNetwork> entry : networkMap.entrySet()) { VmInitNetwork params = entry.getValue(); if (params.getBootProtocol() != NetworkBootProtocol.STATIC_IP) { params.setIp(null); params.setNetmask(null); params.setGateway(null); } params.setStartOnBoot(networkStartOnBoot.contains(entry.getKey())); params.setName(entry.getKey()); } vmInit.setNetworks(new ArrayList<VmInitNetwork>(networkMap.values())); } } vmInit.setDnsServers(getDnsServers().getEntity()); vmInit.setDnsSearch(getDnsSearchDomains().getEntity()); return vmInit; }