Use UpdateResourceMeta to apply Komodo deployment tags
This commit is contained in:
@@ -243,7 +243,7 @@ async function applyDeploymentTags(deployment: string, gameTagName: string, mapT
|
||||
|
||||
const res = await komodoUpdateTagsOnResource('Deployment', deployment, tagIds);
|
||||
if (!res.ok) {
|
||||
console.warn(`[createServer] UpdateTagsOnResource for ${deployment}: ${res.message}`);
|
||||
console.warn(`[createServer] UpdateResourceMeta (tags) for ${deployment}: ${res.message}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(`[createServer] tag application for ${deployment} threw:`, err);
|
||||
|
||||
@@ -617,7 +617,7 @@ async function findTagByName(name: string): Promise<KomodoTagResult | null> {
|
||||
|
||||
/**
|
||||
* Resolve a tag by name, creating it if it doesn't exist. Returns the tag's
|
||||
* Komodo id (Mongo ObjectId string) for use in UpdateTagsOnResource.
|
||||
* Komodo id (Mongo ObjectId string) for use in UpdateResourceMeta.
|
||||
*
|
||||
* Best-effort: callers should treat failure as "skip tagging", not "roll back
|
||||
* the whole operation". Tags are cosmetic organization inside Komodo.
|
||||
@@ -685,7 +685,9 @@ export async function komodoUpdateTagsOnResource(
|
||||
if (!komodoConfigured()) {
|
||||
return { ok: false, kind: 'unconfigured', message: 'komodo not configured' };
|
||||
}
|
||||
return postAndClassify('write/UpdateTagsOnResource', {
|
||||
// UpdateResourceMeta owns tags; omit the other optional metadata fields
|
||||
// so the deployment's description and template flag remain unchanged.
|
||||
return postAndClassify('write/UpdateResourceMeta', {
|
||||
target: { type: targetType, id: targetName },
|
||||
tags: tagIds
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('Komodo tags', () => {
|
||||
expect(fetchMock.mock.calls.map(([url]) => url)).toEqual([
|
||||
'http://komodo.test/read/ListTags',
|
||||
'http://komodo.test/read/ListTags',
|
||||
'http://komodo.test/write/UpdateTagsOnResource'
|
||||
'http://komodo.test/write/UpdateResourceMeta'
|
||||
]);
|
||||
expect(JSON.parse(fetchMock.mock.calls[2][1]!.body as string)).toEqual({
|
||||
target: { type: 'Deployment', id: 't5-sumpf-1' }, tags: [gameId, mapId]
|
||||
|
||||
Reference in New Issue
Block a user