feat: implement smoketest and extend host provisioning with template linking
- Add runSmoketest mutation to automate end-to-end verification. - Add SmoketestExecutor and HostDeleter to support automated testing and cleanup. - Extend createHost and importHosts to allow linking templates by name or ID. - Update docs/howtos/cookbook.md with new recipe steps and AI/MCP guidance. - Update .junie/guidelines.md with new verification and deployment standards. - Add src/test/template_link.test.ts and update existing tests to cover new functionality. - Regenerate GraphQL types to match schema updates.
This commit is contained in:
parent
b56255ffaa
commit
67357d0bc3
20 changed files with 690 additions and 50 deletions
|
|
@ -69,6 +69,11 @@ export class ZabbixQueryHostgroupsRequest extends ZabbixRequestWithPermissions<Z
|
|||
|
||||
}
|
||||
|
||||
export class ZabbixDeleteHostGroupsRequest extends ZabbixRequestWithPermissions<{ groupids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("hostgroup.delete", authToken, cookie, hostGroupReadWritePermissions);
|
||||
}
|
||||
}
|
||||
|
||||
export class GroupHelper {
|
||||
public static groupFullName(groupName: string) {
|
||||
|
|
|
|||
|
|
@ -228,3 +228,9 @@ export class ZabbixCreateHostRequest extends ZabbixRequest<CreateHostResponse> {
|
|||
return args?.zabbix_params || {};
|
||||
}
|
||||
}
|
||||
|
||||
export class ZabbixDeleteHostsRequest extends ZabbixRequest<{ hostids: string[] }> {
|
||||
constructor(authToken?: string | null, cookie?: string | null) {
|
||||
super("host.delete", authToken, cookie);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import {ZabbixRequest} from "./zabbix-request.js";
|
||||
import {ZabbixRequest, ParsedArgs, isZabbixErrorResult} from "./zabbix-request.js";
|
||||
import {ZabbixAPI} from "./zabbix-api.js";
|
||||
import {logger} from "../logging/logger.js";
|
||||
|
||||
|
||||
export interface ZabbixQueryTemplateResponse {
|
||||
|
|
@ -65,3 +67,22 @@ export class ZabbixDeleteTemplateGroupsRequest extends ZabbixRequest<{ groupids:
|
|||
}
|
||||
|
||||
|
||||
export class TemplateHelper {
|
||||
public static async findTemplateIdsByName(templateNames: string[], zabbixApi: ZabbixAPI, zabbixAuthToken?: string, cookie?: string) {
|
||||
let result: number[] = []
|
||||
for (let templateName of templateNames) {
|
||||
let templates = await new ZabbixQueryTemplatesRequest(zabbixAuthToken, cookie).executeRequestReturnError(zabbixApi, new ParsedArgs({
|
||||
filter_name: templateName
|
||||
}))
|
||||
|
||||
if (isZabbixErrorResult(templates) || !templates?.length) {
|
||||
logger.error(`Unable to find templateName=${templateName}`)
|
||||
return null
|
||||
}
|
||||
result.push(...templates.map((t) => Number(t.templateid)))
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue