pmcf 4.5.4 → 4.5.5
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 +1 -1
- package/src/hooks.mjs +8 -8
- package/src/host.mjs +7 -7
- package/src/location.mjs +6 -5
- package/src/services/openldap.mjs +3 -4
- package/types/hooks.d.mts +2 -2
- package/types/host.d.mts +0 -1
- package/types/location.d.mts +0 -1
- package/types/services/openldap.d.mts +0 -1
package/package.json
CHANGED
package/src/hooks.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { createReadStream } from "node:fs";
|
|
2
2
|
import { extractFunctions } from "npm-pkgbuild";
|
|
3
3
|
|
|
4
|
-
export async function loadHooks(
|
|
4
|
+
export async function loadHooks(packageData, file) {
|
|
5
5
|
for await (const f of extractFunctions(createReadStream(file, "utf8"))) {
|
|
6
|
-
addHook(
|
|
6
|
+
addHook(packageData, f.name, f.body);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
return hooks;
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
export function addHook(
|
|
13
|
-
|
|
10
|
+
export function addHook(packageData, name, content) {
|
|
11
|
+
packageData.properties.hooks ||= {};
|
|
12
|
+
|
|
13
|
+
const hook = packageData.properties.hooks[name];
|
|
14
14
|
if (hook) {
|
|
15
15
|
content = hook + "\n" + content;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
hooks[name] = content;
|
|
18
|
+
packageData.properties.hooks[name] = content;
|
|
19
19
|
|
|
20
|
-
return hooks;
|
|
20
|
+
return packageData.properties.hooks;
|
|
21
21
|
}
|
package/src/host.mjs
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
domainFromDominName,
|
|
18
18
|
domainName,
|
|
19
19
|
writeLines,
|
|
20
|
-
sectionLines,
|
|
21
20
|
asArray
|
|
22
21
|
} from "./utils.mjs";
|
|
23
22
|
import { loadHooks } from "./hooks.mjs";
|
|
@@ -451,14 +450,15 @@ export class Host extends ServiceOwner {
|
|
|
451
450
|
provides: [...this.provides],
|
|
452
451
|
replaces: [...this.replaces],
|
|
453
452
|
requires: [],
|
|
454
|
-
backup: "root/.ssh/known_hosts"
|
|
455
|
-
hooks: await loadHooks(
|
|
456
|
-
{},
|
|
457
|
-
new URL("host.install", import.meta.url).pathname
|
|
458
|
-
)
|
|
453
|
+
backup: "root/.ssh/known_hosts"
|
|
459
454
|
}
|
|
460
455
|
};
|
|
461
456
|
|
|
457
|
+
await loadHooks(
|
|
458
|
+
packageData,
|
|
459
|
+
new URL("host.install", import.meta.url).pathname
|
|
460
|
+
);
|
|
461
|
+
|
|
462
462
|
for (const ni of this.networkInterfaces.values()) {
|
|
463
463
|
await ni.systemdDefinitions(packageData);
|
|
464
464
|
}
|
|
@@ -478,7 +478,7 @@ export class Host extends ServiceOwner {
|
|
|
478
478
|
await writeLines(dir, configFileName, content);
|
|
479
479
|
|
|
480
480
|
addHook(
|
|
481
|
-
packageData
|
|
481
|
+
packageData,
|
|
482
482
|
"post_install",
|
|
483
483
|
`systemctl enable ${serviceName}`
|
|
484
484
|
);
|
package/src/location.mjs
CHANGED
|
@@ -55,14 +55,15 @@ export class Location extends Owner {
|
|
|
55
55
|
access: "private",
|
|
56
56
|
dependencies: { jq: ">=1.8" },
|
|
57
57
|
provides: ["location", "mf-location"],
|
|
58
|
-
replaces: [`mf-location-${this.name}`]
|
|
59
|
-
hooks: await loadHooks(
|
|
60
|
-
{},
|
|
61
|
-
new URL("location.install", import.meta.url).pathname
|
|
62
|
-
)
|
|
58
|
+
replaces: [`mf-location-${this.name}`]
|
|
63
59
|
}
|
|
64
60
|
};
|
|
65
61
|
|
|
62
|
+
await loadHooks(
|
|
63
|
+
packageData,
|
|
64
|
+
new URL("location.install", import.meta.url).pathname
|
|
65
|
+
);
|
|
66
|
+
|
|
66
67
|
yield packageData;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -145,19 +145,18 @@ export class OpenLDAPService extends Service {
|
|
|
145
145
|
name: `${this.typeName}-${this.location.name}-${name}`,
|
|
146
146
|
description: `${this.typeName} definitions for ${this.fullName}@${name}`,
|
|
147
147
|
access: "private",
|
|
148
|
-
dependencies: ["openldap>=2.6.10"]
|
|
149
|
-
hooks: {}
|
|
148
|
+
dependencies: ["openldap>=2.6.10"]
|
|
150
149
|
}
|
|
151
150
|
};
|
|
152
151
|
|
|
153
152
|
addHook(
|
|
154
|
-
packageData
|
|
153
|
+
packageData,
|
|
155
154
|
"post_upgrade",
|
|
156
155
|
`setfacl -m u:${owner}:r /etc/letsencrypt/archive/*/privkey*.pem`
|
|
157
156
|
);
|
|
158
157
|
|
|
159
158
|
addHook(
|
|
160
|
-
packageData
|
|
159
|
+
packageData,
|
|
161
160
|
"post_install",
|
|
162
161
|
`setfacl -m u:${owner}:r /etc/letsencrypt/archive/*/privkey*.pem`
|
|
163
162
|
);
|
package/types/hooks.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function loadHooks(
|
|
2
|
-
export function addHook(
|
|
1
|
+
export function loadHooks(packageData: any, file: any): Promise<void>;
|
|
2
|
+
export function addHook(packageData: any, name: any, content: any): any;
|
package/types/host.d.mts
CHANGED
package/types/location.d.mts
CHANGED