Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions files/install_puppet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ try {
Reset-PuppetresDLL $temp_puppetres
}
"$_" | Out-File -FilePath (Join-Path -Path $state_dir -ChildPath 'puppet_agent_upgrade_failure.log')
# Put relevant errors in puppet_agent_upgrade_failure.log
Get-Content -Path $Logfile | Select-String -Pattern "^Error.*$|-- Error" | Select-String -Pattern "^.*PUPPET_AGENT_ACCOUNT_PASSWORD.*$" -NotMatch | Add-Content -Path (Join-Path -Path $state_dir -ChildPath 'puppet_agent_upgrade_failure.log')
Get-Content -Path $Logfile -Tail 10 | Select-String -Pattern "^.*PUPPET_AGENT_ACCOUNT_PASSWORD.*$" -NotMatch | Add-Content -Path (Join-Path -Path $state_dir -ChildPath 'puppet_agent_upgrade_failure.log')
} finally {
Reset-PuppetServices $services_before
Unlock-Installation $install_pid_lock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read_content_and_delete_file(filename)
# In this scenario we need to open the file in binmode and read each line
# individually, then encode the result back to UTF-8 so we can sub out both
# the UTF-16 header \uFEFF and the \r\n line carriages.
File.open(logfile, 'rb:UTF-16LE') { |file| file.readlines }[0].encode!('UTF-8').delete("\uFEFF").delete("\r")
File.open(logfile, 'rb:UTF-16LE') { |file| file.read.encode!('UTF-8').delete("\uFEFF").delete("\r") }
else
File.read(logfile)
end
Expand Down
Loading