Georgy Okrokvertskhov 30b9bed2fc Added base64 encryption of the script files. Now script files are stored
separately from templates in the ./scripts/ directory.

test_windows_agent.py updated.

Formatting in windows_agent.py fixed.

Tracing and error capturing added to Set-LocalUserPassword.

Function Set-LocalUserPassword removed as it is implemented by workflow
means.

Scripts now stored in one common folder.
Scripts updated from murano-deployment.
Templates updated to reflect new script names.

Workflow template can reference multiple script files. These script
files will be concatinated and encrypted with base64.

Change-Id: Icb3532d2fb724bbb711c06086cb906bde22a380f

Fixed flake8 reported issues.

Change-Id: Icb3532d2fb724bbb711c06086cb906bde22a380f

Fixed test failure after reformatting.

Change-Id: Icb3532d2fb724bbb711c06086cb906bde22a380f

Fixed issues with test. Revert back path selection for scripts folder.
It is reasonable to have an ability to use own folder for custom
workflows so script path is relative to template location.

Change-Id: Icb3532d2fb724bbb711c06086cb906bde22a380f
2013-08-12 11:37:41 -07:00

66 lines
1.4 KiB
PowerShell

trap {
&$TrapHandler
}
Function Join-Domain {
<#
.SYNOPSIS
Executes "Join domain" action.
Requires 'CoreFunctions' module.
#>
param (
[String] $DomainName = '',
[String] $UserName = '',
[String] $Password = '',
[String] $OUPath = '',
[Switch] $AllowRestart
)
begin {
Show-InvocationInfo $MyInvocation
}
end {
Show-InvocationInfo $MyInvocation -End
}
process {
trap {
&$TrapHandler
}
if ($UserName -eq '') {
$UserName = 'Administrator'
}
$Credential = New-Credential -UserName "$DomainName\$UserName" -Password $Password
if (Test-ComputerName -DomainName $DomainName -ErrorAction 'SilentlyContinue') {
Write-LogWarning "Computer already joined to domain '$DomainName'"
}
else {
Write-Log "Joining computer to domain '$DomainName' ..."
if ($OUPath -eq '') {
Add-Computer -DomainName $DomainName -Credential $Credential -Force
}
else {
Add-Computer -DomainName $DomainName -Credential $Credential -OUPath $OUPath -Force
}
Write-Log "Waiting 30 seconds to restart ..."
Start-Sleep -Seconds 30
<#
if ($AllowRestart) {
Write-Log "Restarting computer ..."
Restart-Computer -Force
}
else {
Write-Log "Please restart the computer now."
}
#>
}
}
}