Skip to content

Commit 09f7358

Browse files
authored
Merge pull request #154 from cloud-gov/update-platform-pre-start
update elasticsearch-platform pre-start script
2 parents baaddb7 + 29c8737 commit 09f7358

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

jobs/elasticsearch-platform/spec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,7 @@ properties:
152152
default: ''
153153
elasticsearch.migrate_data:
154154
description: migrate data from /var/vcap/store/elasticsearch to /var/vcap/store/elasticsearch-platform
155+
default: false
156+
elasticsearch.delete_migrated_data:
157+
description: delete /var/vcap/store/elasticsearch
155158
default: false

jobs/elasticsearch-platform/templates/bin/pre-start

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ fi
3636

3737
<% if p("elasticsearch.migrate_data") %>
3838
if [[ -d /var/vcap/store/elasticsearch ]]; then
39-
cp -pRu /var/vcap/store/elasticsearch/nodes /var/vcap/store/elasticsearch-platform
39+
mkdir /var/vcap/store/elasticsearch-platform || true
40+
rsync -au --delete /var/vcap/store/elasticsearch/nodes /var/vcap/store/elasticsearch-platform/nodes
41+
fi
42+
<% end %>
43+
44+
<% if p("elasticsearch.delete_migrated_data") %>
45+
if [[ -d /var/vcap/store/elasticsearch && -d /var/vcap/store/elasticsearch-platform ]]; then
46+
if cat /var/vcap/jobs/elasticsearch-platform/config/elasticsearch.yml | grep -q 'data: "/var/vcap/store/elasticsearch-platform"'; then
47+
rm -rf /var/vcap/store/elasticsearch
48+
fi
4049
fi
4150
<% end %>

0 commit comments

Comments
 (0)