File tree Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ globals:
2
2
customConfigFile : /etc/mysql/conf.d/my_custom.cnf
3
3
4
4
actions :
5
+
6
+ isEnvRunning :
7
+ script : |
8
+ import com.hivext.api.server.system.service.utils.EnvironmentStatus;
9
+ var resp = jelastic.env.control.GetEnvInfo('${env.envName}', session);
10
+ if (resp.result != 0) return resp;
11
+ var status = resp.env.status;
12
+ var isEnvRunning = status == EnvironmentStatus['ENV_STATUS_TYPE_RUNNING'].getValue() ? true : false;
13
+ return {result: 0, isEnvRunning: isEnvRunning}
14
+
5
15
getReplicaUser :
6
16
- env.control.GetContainerEnvVarsByGroup[sqldb]
7
17
- setGlobals :
Original file line number Diff line number Diff line change @@ -38,7 +38,21 @@ onAfterScaleOut[sqldb]:
38
38
- cmd[${@i.id}]: jem service restart
39
39
40
40
onAfterScaleIn[sqldb]: setupSeeds
41
-
41
+
42
+ onBeforeMigrate:
43
+ - isEnvRunning
44
+ - if (!${response.isEnvRunning}):
45
+ - stopEvent:
46
+ type: warning
47
+ message: "Please run the environment before migration, otherwise the database cluster will be broken."
48
+
49
+ onBeforeClone:
50
+ - isEnvRunning
51
+ - if (!${response.isEnvRunning}):
52
+ - stopEvent:
53
+ type: warning
54
+ message: "Please run the environment before cloning, otherwise the database cluster will be broken."
55
+
42
56
onAfterMigrate:
43
57
- script: delete MANIFEST.id; return {result:0, jps:MANIFEST};
44
58
- install: ${response.jps}
Original file line number Diff line number Diff line change @@ -19,6 +19,20 @@ globals:
19
19
DB_USER: ${settings.db_user:user-[fn.random]}
20
20
DB_PASS: ${settings.db_pass:[fn.password(20)]}
21
21
22
+ onBeforeMigrate:
23
+ - isEnvRunning
24
+ - if (!${response.isEnvRunning}):
25
+ - stopEvent:
26
+ type: warning
27
+ message: "Please run the environment before migration, otherwise the database cluster will be broken."
28
+
29
+ onBeforeClone:
30
+ - isEnvRunning
31
+ - if (!${response.isEnvRunning}):
32
+ - stopEvent:
33
+ type: warning
34
+ message: "Please run the environment before cloning, otherwise the database cluster will be broken."
35
+
22
36
onAfterScaleOut[sqldb]:
23
37
- forEach(event.response.nodes):
24
38
- syncCustomConfig:
Original file line number Diff line number Diff line change @@ -19,6 +19,20 @@ globals:
19
19
DB_USER: ${settings.db_user:user-[fn.random]}
20
20
DB_PASS: ${settings.db_pass:[fn.password(20)]}
21
21
22
+ onBeforeMigrate:
23
+ - isEnvRunning
24
+ - if (!${response.isEnvRunning}):
25
+ - stopEvent:
26
+ type: warning
27
+ message: "Please run the environment before migration, otherwise the database cluster will be broken."
28
+
29
+ onBeforeClone:
30
+ - isEnvRunning
31
+ - if (!${response.isEnvRunning}):
32
+ - stopEvent:
33
+ type: warning
34
+ message: "Please run the environment before cloning, otherwise the database cluster will be broken."
35
+
22
36
onAfterScaleOut[sqldb]:
23
37
- forEach(event.response.nodes):
24
38
- syncCustomConfig:
You can’t perform that action at this time.
0 commit comments