From dd9a3883aa93277c429b83dcaad20a2a9aeb7fab Mon Sep 17 00:00:00 2001 From: Dimitrios Apostolou Date: Thu, 3 Oct 2019 12:44:53 +0200 Subject: Ensure provisioning works even without the secrets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3869e881341a719da8a351095c3bf314c2fa2f34 Reviewed-by: MÃ¥rten Nordheim --- coin/provisioning/common/windows/telegraf_password.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'coin') diff --git a/coin/provisioning/common/windows/telegraf_password.ps1 b/coin/provisioning/common/windows/telegraf_password.ps1 index 11d04dbc..773ec866 100644 --- a/coin/provisioning/common/windows/telegraf_password.ps1 +++ b/coin/provisioning/common/windows/telegraf_password.ps1 @@ -31,9 +31,16 @@ ## ############################################################################# +$auth_file = "C:\Users\qt\work\influxdb\coin_vms_writer.auth" + +# Provisioning should run even without the secrets repository +if (Test-Path $auth_file) { + $auth_content = Get-Content $auth_file + $influxdb_password = $auth_content.Substring($auth_content.LastIndexOf(':') + 1) + Remove-Item $auth_file +} else { + $influxdb_password = "no_password_provided" +} -$colon_file = Get-Content "C:\Users\qt\work\influxdb\coin_vms_writer.auth" -$influxdb_password = $colon_file.Substring($colon_file.LastIndexOf(':') + 1) $telegraf_conf = "C:\telegraf-coin.conf" (Get-Content $telegraf_conf) | ForEach-Object { $_.Replace("COIN_VMS_WRITER_PASS", $influxdb_password) } | Out-File -Encoding UTF8 $telegraf_conf -Remove-Item "C:\Users\qt\work\influxdb\coin_vms_writer.auth" -- cgit v1.2.3