pmcf 1.57.0 → 1.57.2

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": "1.57.0",
3
+ "version": "1.57.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -8,15 +8,14 @@ const ClusterTypeDefinition = {
8
8
  extends: Owner.typeDefinition,
9
9
  properties: {
10
10
  masters: { type: "host", collection: true, writeable: true },
11
- backups: { type: "host", collection: true, writeable: true },
11
+ backups: { type: "host", collection: true, writeable: true }
12
12
  }
13
13
  };
14
14
 
15
15
  export class Cluster extends Owner {
16
-
17
16
  masters = new Set();
18
17
  backups = new Set();
19
-
18
+
20
19
  static {
21
20
  addType(this);
22
21
  }
@@ -29,4 +28,35 @@ export class Cluster extends Owner {
29
28
  super(owner, data);
30
29
  this.read(data, ClusterTypeDefinition);
31
30
  }
31
+
32
+ get packageName() {
33
+ return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
34
+ }
35
+
36
+ async preparePackage(stagingDir) {
37
+ const result = await super.preparePackage(stagingDir);
38
+
39
+ const cfg = [
40
+ "vrrp_instance VI_1 {",
41
+ " state MASTER",
42
+ " interface end0",
43
+ " virtual_router_id 101",
44
+ " priority 255",
45
+ " advert_int 1",
46
+ " authentication {",
47
+ " auth_type PASS",
48
+ " auth_pass pass1234",
49
+ " }",
50
+ " virtual_ipaddress {",
51
+ " 192.168.1.250",
52
+ " }",
53
+ "}"
54
+ ];
55
+
56
+ await writeLines(join(targetDir, "etc/keepalived"), "keepalived.conf", cfg);
57
+
58
+ result.properties.dependencies = ["keepalived"];
59
+
60
+ return result;
61
+ }
32
62
  }
@@ -0,0 +1,20 @@
1
+
2
+ config_resolv()
3
+ {
4
+ ls -l /etc/resolv.conf | grep -q /run/systemd/resolve/resolv.conf
5
+ if [ $? = 1 ]
6
+ then
7
+ mv /etc/resolv.conf /etc/resolv.conf.pre
8
+ ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
9
+ fi
10
+ }
11
+
12
+ post_install()
13
+ {
14
+ config_resolv
15
+ }
16
+
17
+ post_upgrade()
18
+ {
19
+ config_resolv
20
+ }
package/src/host.mjs CHANGED
@@ -329,6 +329,10 @@ export class Host extends Base {
329
329
  return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
330
330
  }
331
331
 
332
+ get packageName() {
333
+ return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
334
+ }
335
+
332
336
  async preparePackage(stagingDir) {
333
337
  const result = await super.preparePackage(stagingDir);
334
338
  await generateNetworkDefs(this, stagingDir);