Ensure provisioning works even without the secrets

Change-Id: I3869e881341a719da8a351095c3bf314c2fa2f34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Dimitrios Apostolou
2019-10-03 12:44:53 +02:00
parent 869a9b3ae7
commit dd9a3883aa

View File

@@ -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"