summaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/windows
diff options
context:
space:
mode:
authorDimitrios Apostolou <jimis@qt.io>2019-10-03 12:44:53 +0200
committerDimitrios Apostolou <jimis@qt.io>2019-10-08 08:26:34 +0200
commitdd9a3883aa93277c429b83dcaad20a2a9aeb7fab (patch)
treeceeb229459c8fb2be9224fcb73f0ab00c1df82d2 /coin/provisioning/common/windows
parent869a9b3ae7135158247113921c2dfc6cbe7ad6ce (diff)
Ensure provisioning works even without the secrets
Change-Id: I3869e881341a719da8a351095c3bf314c2fa2f34 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'coin/provisioning/common/windows')
-rw-r--r--coin/provisioning/common/windows/telegraf_password.ps113
1 files changed, 10 insertions, 3 deletions
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"