summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKiran Kamineni <kiran.k.kamineni@intel.com>2018-04-25 12:16:15 -0700
committerGirish Havaldar <hg0071052@techmahindra.com>2018-04-26 05:16:34 +0000
commit30dae56d353d324e97e13a47891c30f384a66be9 (patch)
tree2a7f05644395e7d4b6a495592914d6dd680f81fa
parent74d37f1a153d121256a643bba00659b8f53074f0 (diff)
Quorum client creates its data folder before write
Data folder is not guaranteed to exist and therefore needs to be created before writes can be done on it. Issue-ID: AAF-261 Change-Id: I4671f0dac34a04c80639386719639b8c9472a9d3 Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
-rw-r--r--sms-service/src/quorumclient/quorumclient.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/sms-service/src/quorumclient/quorumclient.go b/sms-service/src/quorumclient/quorumclient.go
index dfa1a26..51dfc9c 100644
--- a/sms-service/src/quorumclient/quorumclient.go
+++ b/sms-service/src/quorumclient/quorumclient.go
@@ -64,11 +64,14 @@ func loadPGPKeys(prKeyPath string, pbKeyPath string) (string, string, error) {
//calls necessary initialization endpoints on the
//SMS webservice
func main() {
- podName := os.Getenv("HOSTNAME")
- idFilePath := filepath.Join("auth", podName, "id")
- pbKeyPath := filepath.Join("auth", podName, "pbkey")
- prKeyPath := filepath.Join("auth", podName, "prkey")
- shardPath := filepath.Join("auth", podName, "shard")
+ folderName := os.Getenv("HOSTNAME")
+ //Make sure to create the folder. It is not guaranteed to exist
+ os.MkdirAll(folderName, 0700)
+
+ idFilePath := filepath.Join("auth", folderName, "id")
+ pbKeyPath := filepath.Join("auth", folderName, "pbkey")
+ prKeyPath := filepath.Join("auth", folderName, "prkey")
+ shardPath := filepath.Join("auth", folderName, "shard")
smslogger.Init("quorum.log")
smslogger.WriteInfo("Starting Log for Quorum Client")