Merge "Set the desired hostname to a instance using murano instead of Murano Pattern"

This commit is contained in:
Jenkins
2016-09-05 10:11:07 +00:00
committed by Gerrit Code Review
3 changed files with 15 additions and 9 deletions

View File

@@ -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())

View File

@@ -16,3 +16,5 @@
- python-dev
- python-setuptools
- python-virtualenv
hostname: $instanceHostname

View File

@@ -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 ) {