Fixed issue with incorrect init script

Change-Id: I452dde19b5bf896b97274e0854323f291b275712
Closes-Bug: #1259506
This commit is contained in:
TimurNurlygayanov 2013-12-10 15:08:28 +04:00
parent 7345513b48
commit 4f55e66186
5 changed files with 7 additions and 124 deletions

View File

@ -1,10 +0,0 @@
#!/bin/sh
AgentConfigBase64='%AGENT_CONFIG_BASE64%'
mkdir /etc/murano
echo $AgentConfigBase64 | base64 -d > /etc/murano/agent.config
/etc/init.d/murano-agent restart

View File

@ -1,68 +0,0 @@
#ps1
$WindowsAgentConfigBase64 = '%AGENT_CONFIG_BASE64%'
$WindowsAgentConfigFile = "C:\Murano\Agent\WindowsAgent.exe.config"
$WindowsAgentLogFile = "C:\Murano\Agent\log.txt"
$NewComputerName = '%INTERNAL_HOSTNAME%'
$MuranoFileShare = '\\%MURANO_SERVER_ADDRESS%\share'
$CaRootCertBase64 = "%CA_ROOT_CERT_BASE64%"
$CaRootCertFile = "C:\Murano\ca.cert"
$RestartRequired = $false
Import-Module CoreFunctions
Initialize-Logger 'CloudBase-Init' 'C:\Murano\PowerShell.log'
$ErrorActionPreference = 'Stop'
trap {
Write-LogError '<exception>'
Write-LogError $_ -EntireObject
Write-LogError '</exception>'
exit 1
}
Write-Log "Importing CA certificate ..."
if ($CaRootCertBase64 -eq '') {
Write-Log "Importing CA certificate ... skipped"
}
else {
ConvertFrom-Base64String -Base64String $CaRootCertBase64 -Path $CaRootCertFile
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 $CaRootCertFile
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("AuthRoot","LocalMachine")
$store.Open("MaxAllowed")
$store.Add($cert)
$store.Close()
Write-Log "Importing CA certificate ... done"
}
Write-Log "Updating Murano Windows Agent."
Stop-Service "Murano Agent"
Backup-File $WindowsAgentConfigFile
Remove-Item $WindowsAgentConfigFile -Force
Remove-Item $WindowsAgentLogFile -Force
ConvertFrom-Base64String -Base64String $WindowsAgentConfigBase64 -Path $WindowsAgentConfigFile
Exec sc.exe 'config','"Murano Agent"','start=','delayed-auto'
Write-Log "Service has been updated."
Write-Log "Adding environment variable 'MuranoFileShare' = '$MuranoFileShare' ..."
[Environment]::SetEnvironmentVariable('MuranoFileShare', $MuranoFileShare, [EnvironmentVariableTarget]::Machine)
Write-Log "Environment variable added."
Write-Log "Renaming computer to '$NewComputerName' ..."
$null = Rename-Computer -NewName $NewComputerName -Force
Write-Log "New name assigned, restart required."
$RestartRequired = $true
Write-Log 'All done!'
if ( $RestartRequired ) {
Write-Log "Restarting computer ..."
Restart-Computer -Force
}
else {
Start-Service 'Murano Agent'
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="${basedir}/log.txt"
layout="${date} ${level}: &lt;${logger:shortName=true}&gt; ${message} ${exception:format=tostring}"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
<appSettings>
<add key="rabbitmq.host" value="%RABBITMQ_HOST%"/>
<add key="rabbitmq.port" value="%RABBITMQ_PORT%"/>
<add key="rabbitmq.user" value="%RABBITMQ_USER%"/>
<add key="rabbitmq.password" value="%RABBITMQ_PASSWORD%"/>
<add key="rabbitmq.vhost" value="%RABBITMQ_VHOST%"/>
<add key="rabbitmq.inputQueue" value="%RABBITMQ_INPUT_QUEUE%"/>
<add key="rabbitmq.resultExchange" value=""/>
<add key="rabbitmq.resultRoutingKey" value="%RESULT_QUEUE%"/>
<add key="rabbitmq.durableMessages" value="true"/>
<add key="rabbitmq.ssl" value="%RABBITMQ_SSL%"/>
<add key="rabbitmq.allowInvalidCA" value="true"/>
<add key="rabbitmq.sslServerName" value=""/>
</appSettings>
</configuration>

View File

@ -1,8 +0,0 @@
RABBITMQ_HOST = "%RABBITMQ_HOST%"
RABBITMQ_PORT = "%RABBITMQ_PORT%"
RABBITMQ_USERNAME = "%RABBITMQ_USER%"
RABBITMQ_PASSWORD = "%RABBITMQ_PASSWORD%"
RABBITMQ_VHOST = "%RABBITMQ_VHOST%"
RABBITMQ_INPUT_QUEUE = "%RABBITMQ_INPUT_QUEUE%"
RESULT_QUEUE = "%RESULT_QUEUE%"
RABBITMQ_RESULT_ROUTING_KEY = "%RESULT_QUEUE%"

View File

@ -1,6 +1,11 @@
#!/bin/sh
AgentConfigBase64='%AGENT_CONFIG_BASE64%'
service murano-agent stop
echo $AgentConfigBase64 | base64 -d > /etc/murano-agent.conf
AgentConfigBase64='%AGENT_CONFIG_BASE64%'
mkdir /etc/murano
echo $AgentConfigBase64 | base64 -d > /etc/murano/agent.conf
chmod 664 /etc/murano/agent.conf
service murano-agent start