pmcf 6.65.3 → 6.65.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "6.65.3",
3
+ "version": "6.65.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -60,7 +60,7 @@
60
60
  "yaml": "^2.9.1"
61
61
  },
62
62
  "devDependencies": {
63
- "@types/node": "^26.6.2",
63
+ "@types/node": "^26.6.3",
64
64
  "ava": "^8.0.1",
65
65
  "c8": "^12.0.0",
66
66
  "documentation": "^14.0.3",
@@ -71,6 +71,8 @@ export class keepalive_cluster_member extends core {
71
71
  }
72
72
  }
73
73
 
74
+ const states = ["master", "backup", "fault"];
75
+
74
76
  export class keepalived extends CoreService {
75
77
  static priority = 1.5;
76
78
  static attributes = {
@@ -145,19 +147,19 @@ export class keepalived extends CoreService {
145
147
  cfg.push(" advert_int 5");
146
148
  cfg.push(" authentication {");
147
149
  cfg.push(" auth_type PASS");
148
- cfg.push(" auth_pass pass1234");
149
150
  cfg.push(
150
- ` # auth_pass file:\${_ENV CREDENTIALS_DIRECTORY}/keepalived.${cluster.name}.password`
151
+ ` auth_pass file:\${_ENV CREDENTIALS_DIRECTORY}/keepalived.${cluster.name}.password`
151
152
  );
153
+ cfg.push(" # auth_pass pass1234");
152
154
  cfg.push(" # auth_pass ${_ENV " + cred.localName + "}");
153
155
  cfg.push(" # auth_pass ${" + cred.localName + "}");
154
156
  cfg.push(" }");
155
157
 
156
- cfg.push(
157
- ` notify_master "/usr/bin/systemctl start ${clusterName}-master.target"`,
158
- ` notify_backup "/usr/bin/systemctl start ${clusterName}-backup.target"`,
159
- ` notify_fault "/usr/bin/systemctl start ${clusterName}-fault.target"`
160
- );
158
+ for (const state of states) {
159
+ cfg.push(
160
+ ` notify_${state} "/usr/bin/systemctl start ${clusterName}-${state}.target"`
161
+ );
162
+ }
161
163
 
162
164
  cfg.push("}", "");
163
165
 
@@ -209,37 +211,19 @@ export class keepalived extends CoreService {
209
211
  cfg.push("}", "");
210
212
  break; // only one for now
211
213
  }
212
- await writeLines(
213
- join(dir, "/usr/lib/systemd/system"),
214
- `${clusterName}-master.target`,
215
- [
216
- "[Unit]",
217
- `Description=master state of cluster ${clusterName}`,
218
- "PartOf=keepalived.service",
219
- `Conflicts=${clusterName}-backup.target ${clusterName}-fault.target`
220
- ]
221
- );
222
214
 
223
- await writeLines(
224
- join(dir, "/usr/lib/systemd/system"),
225
- `${clusterName}-backup.target`,
226
- [
227
- "[Unit]",
228
- `Description=backup state of cluster ${clusterName}`,
229
- "PartOf=keepalived.service",
230
- `Conflicts=${clusterName}-master.target ${clusterName}-fault.target`
231
- ]
232
- );
233
-
234
- await writeLines(
235
- join(dir, "/usr/lib/systemd/system"),
236
- `${clusterName}-fault.target`,
237
- [
238
- "[Unit]",
239
- `Description=fault state of cluster ${clusterName}`,
240
- `Conflicts=${clusterName}-master.target ${clusterName}-backup.target`
241
- ]
242
- );
215
+ for (const state of states) {
216
+ await writeLines(
217
+ join(dir, "/usr/lib/systemd/system"),
218
+ `${clusterName}-${state}.target`,
219
+ [
220
+ "[Unit]",
221
+ `Description=${state} state of cluster ${clusterName}`,
222
+ "PartOf=keepalived.service",
223
+ `Conflicts=${states.filter(s=>s!==state).map(other=>`${clusterName}-${other}.target`).join(' ')}`
224
+ ]
225
+ );
226
+ }
243
227
 
244
228
  await this.writeSystemdCredentialConfig(dir, "keepalived.service");
245
229