Set the desired hostname to a instance using murano instead of Murano Pattern
Without this patch all the instances are deployed with the following hostname: Murano-RandomID-HOSTNAME-randomID With this Patch the new instances will be deployed just with the hostname. This is more benefit on Windows instances where the recommended length for the hostname is 15 characters. Change-Id: I8c9867481071b2ae09c3ea17cba4c535759aaf58 Closes-Bug: #1605786
This commit is contained in:
parent
bb2d0e5a84
commit
087db8cc5b
|
@ -53,7 +53,9 @@ Methods:
|
|||
generateCloudConfig:
|
||||
Body:
|
||||
- $resources: new(sys:Resources)
|
||||
- $muranoInitConf: $resources.yaml('murano-init.conf')
|
||||
- $muranoInitConf: $resources.yaml('murano-init.conf').bind(dict(
|
||||
instanceHostname => $.name
|
||||
))
|
||||
- Return: $muranoInitConf
|
||||
|
||||
generateUserData:
|
||||
|
@ -93,7 +95,7 @@ Methods:
|
|||
|
||||
- $userData: $muranoScript.replace($muranoReplacements) + $initScript.replace($scriptReplacements)
|
||||
- Return: $userData
|
||||
|
||||
|
||||
releaseResources:
|
||||
Body:
|
||||
- $region: $.getRegion()
|
||||
|
@ -104,4 +106,4 @@ Methods:
|
|||
- $template.resources: $template.resources.deleteAll($resourcesToDelete)
|
||||
- $region.stack.setTemplate($template)
|
||||
|
||||
- super($, $.releaseResources())
|
||||
- super($, $.releaseResources())
|
||||
|
|
|
@ -16,3 +16,5 @@
|
|||
- python-dev
|
||||
- python-setuptools
|
||||
- python-virtualenv
|
||||
|
||||
hostname: $instanceHostname
|
||||
|
|
|
@ -17,6 +17,7 @@ $WindowsAgentConfigBase64 = '%AGENT_CONFIG_BASE64%'
|
|||
$WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config"
|
||||
$WindowsAgentLogFile = "C:\Murano\Agent\log.txt"
|
||||
|
||||
$CurrentComputerName = HOSTNAME
|
||||
$NewComputerName = '%INTERNAL_HOSTNAME%'
|
||||
$MuranoFileShare = '\\%MURANO_SERVER_ADDRESS%\share'
|
||||
|
||||
|
@ -63,13 +64,14 @@ Write-Log "Service has been updated."
|
|||
Write-Log "Adding environment variable 'MuranoFileShare' = '$MuranoFileShare' ..."
|
||||
[Environment]::SetEnvironmentVariable('MuranoFileShare', $MuranoFileShare, [EnvironmentVariableTarget]::Machine)
|
||||
Write-Log "Environment variable added."
|
||||
# (jose-phillips) If the Master Image or CloudBase-Init is already set the hostname this procedure fail.
|
||||
if ($CurrentComputerName -ne $NewComputerName){
|
||||
Write-Log "Renaming computer to '$NewComputerName' ..."
|
||||
$null = Rename-Computer -NewName $NewComputerName -Force
|
||||
|
||||
Write-Log "Renaming computer to '$NewComputerName' ..."
|
||||
$null = Rename-Computer -NewName $NewComputerName -Force
|
||||
|
||||
Write-Log "New name assigned, restart required."
|
||||
$RestartRequired = $true
|
||||
|
||||
Write-Log "New name assigned, restart required."
|
||||
$RestartRequired = $true
|
||||
}
|
||||
|
||||
Write-Log 'All done!'
|
||||
if ( $RestartRequired ) {
|
||||
|
|
Loading…
Reference in New Issue