Rename networks to <appUuid>_<networkName>

This is required as we are phasing out app ids and we need to be able to
get app uuid from the current state of the network. The app-id now
exists as a container in new networks

This commit will restart containers as it needs to recreate the network.
This commit is contained in:
Felipe Lalanne
2021-08-25 23:25:47 +00:00
parent 0835b29874
commit 5c5483dd3d
13 changed files with 419 additions and 160 deletions

View File

@ -4,7 +4,6 @@ import rewire = require('rewire');
import { unlinkAll } from '../../src/lib/fs-utils';
import * as applicationManager from '../../src/compose/application-manager';
import * as networkManager from '../../src/compose/network-manager';
import * as serviceManager from '../../src/compose/service-manager';
import * as volumeManager from '../../src/compose/volume-manager';
import * as commitStore from '../../src/compose/commit';
@ -185,7 +184,6 @@ function buildRoutes(): Router {
}
// TO-DO: Create a cleaner way to restore previous values.
const originalNetGetAll = networkManager.getAllByAppId;
const originalVolGetAll = volumeManager.getAllByAppId;
const originalSvcGetAppId = serviceManager.getAllByAppId;
const originalSvcGetStatus = serviceManager.getState;
@ -194,8 +192,6 @@ const originalReadyForUpdates = apiBinder.__get__('readyForUpdates');
function setupStubs() {
apiBinder.__set__('readyForUpdates', true);
// @ts-expect-error Assigning to a RO property
networkManager.getAllByAppId = async () => STUBBED_VALUES.networks;
// @ts-expect-error Assigning to a RO property
volumeManager.getAllByAppId = async () => STUBBED_VALUES.volumes;
// @ts-expect-error Assigning to a RO property
serviceManager.getState = async () => STUBBED_VALUES.services;
@ -207,8 +203,6 @@ function setupStubs() {
function restoreStubs() {
apiBinder.__set__('readyForUpdates', originalReadyForUpdates);
// @ts-expect-error Assigning to a RO property
networkManager.getAllByAppId = originalNetGetAll;
// @ts-expect-error Assigning to a RO property
volumeManager.getAllByAppId = originalVolGetAll;
// @ts-expect-error Assigning to a RO property
serviceManager.getState = originalSvcGetStatus;