docs: 3 стенда (test/dev/prod), приоритет curated-примеров, инцидент генератора nav
This commit is contained in:
@@ -51,15 +51,15 @@ function sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }
|
||||
async function main() {
|
||||
console.log('Инстанс:', UID, '| операция:', ACTION);
|
||||
|
||||
// 1) Состояние инстанса: доступные операции + текущие params.
|
||||
const st = await api('GET', `/instances/${UID}`);
|
||||
if (st.status !== 200) {
|
||||
console.error('Ошибка GET /instances:', st.status, st.text.slice(0, 300));
|
||||
process.exit(1);
|
||||
}
|
||||
const inst = (st.json && st.json.instance) || {};
|
||||
console.log('Статус:', inst.explainedStatus, '| inProgress:', inst.operationIsInProgress, '| pending:', inst.operationIsPending);
|
||||
const instanceParams = (inst.state && inst.state.params) || {};
|
||||
// 1) Состояние инстанса: доступные операции + текущие params.
|
||||
const st = await api('GET', `/instances/${UID}`);
|
||||
if (st.status !== 200) {
|
||||
console.error('Ошибка GET /instances:', st.status, st.text.slice(0, 300));
|
||||
process.exit(1);
|
||||
}
|
||||
const inst = (st.json && st.json.instance) || {};
|
||||
console.log('Статус:', inst.explainedStatus, '| inProgress:', inst.operationIsInProgress, '| pending:', inst.operationIsPending);
|
||||
const instanceParams = (inst.state && inst.state.params) || {};
|
||||
|
||||
const ops = inst.availableOperations || [];
|
||||
const op = ops.find((o) => String(o.operation).toLowerCase() === ACTION.toLowerCase());
|
||||
@@ -81,28 +81,28 @@ async function main() {
|
||||
}
|
||||
if (!opUid) opUid = uidFromLocation(created.location);
|
||||
if (!opUid) opUid = created.text.replace(/^"|"$/g, '').trim();
|
||||
console.log('Создана операция:', created.status, '| opUid:', opUid);
|
||||
if (!opUid || opUid.length < 8) {
|
||||
console.error('Не удалось получить opUid. Ответ:', created.text.slice(0, 300));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 2б) Установить требуемые CFS-параметры (например startupConfiguration) из live-состояния.
|
||||
const cfs = await api('GET', `/instanceOperations/${opUid}?fields=cfsParams`);
|
||||
const cfsParams = (cfs.json && cfs.json.instanceOperation && cfs.json.instanceOperation.cfsParams) || [];
|
||||
for (const p of cfsParams) {
|
||||
const val = instanceParams[p.svcOperationCfsParam];
|
||||
if (val === undefined) {
|
||||
console.log(' параметр', p.svcOperationCfsParam, '(id=' + p.svcOperationCfsParamId + ') — в состоянии нет, пропуск');
|
||||
continue;
|
||||
console.log('Создана операция:', created.status, '| opUid:', opUid);
|
||||
if (!opUid || opUid.length < 8) {
|
||||
console.error('Не удалось получить opUid. Ответ:', created.text.slice(0, 300));
|
||||
process.exit(1);
|
||||
}
|
||||
const paramValue = typeof val === 'string' ? val : JSON.stringify(val);
|
||||
const pr = await api('POST', '/instanceOperationCfsParams', {
|
||||
instanceOperationUid: opUid,
|
||||
svcOperationCfsParamId: p.svcOperationCfsParamId,
|
||||
paramValue: paramValue,
|
||||
});
|
||||
console.log(' параметр', p.svcOperationCfsParam, '=', paramValue, '->', pr.status);
|
||||
|
||||
// 2б) Установить требуемые CFS-параметры (например startupConfiguration) из live-состояния.
|
||||
const cfs = await api('GET', `/instanceOperations/${opUid}?fields=cfsParams`);
|
||||
const cfsParams = (cfs.json && cfs.json.instanceOperation && cfs.json.instanceOperation.cfsParams) || [];
|
||||
for (const p of cfsParams) {
|
||||
const val = instanceParams[p.svcOperationCfsParam];
|
||||
if (val === undefined) {
|
||||
console.log(' параметр', p.svcOperationCfsParam, '(id=' + p.svcOperationCfsParamId + ') — в состоянии нет, пропуск');
|
||||
continue;
|
||||
}
|
||||
const paramValue = typeof val === 'string' ? val : JSON.stringify(val);
|
||||
const pr = await api('POST', '/instanceOperationCfsParams', {
|
||||
instanceOperationUid: opUid,
|
||||
svcOperationCfsParamId: p.svcOperationCfsParamId,
|
||||
paramValue: paramValue,
|
||||
});
|
||||
console.log(' параметр', p.svcOperationCfsParam, '=', paramValue, '->', pr.status);
|
||||
}
|
||||
|
||||
// 3) Запустить операцию.
|
||||
|
||||
Reference in New Issue
Block a user