shell: no need to promise scoping
This commit is contained in:
+6
-6
@@ -49,7 +49,7 @@ async function pruneInfraImages() {
|
||||
|
||||
// cannot blindly remove all unused images since redis image may not be used
|
||||
const imageNames = Object.keys(infra.images).map(addon => infra.images[addon]);
|
||||
const [error, output] = await safe(shell.promises.exec('pruneInfraImages', 'docker images --digests --format "{{.ID}} {{.Repository}} {{.Tag}} {{.Digest}}"', {}));
|
||||
const [error, output] = await safe(shell.exec('pruneInfraImages', 'docker images --digests --format "{{.ID}} {{.Repository}} {{.Tag}} {{.Digest}}"', {}));
|
||||
if (error) {
|
||||
debug(`Failed to list images ${error.message}`);
|
||||
throw error;
|
||||
@@ -69,7 +69,7 @@ async function pruneInfraImages() {
|
||||
const imageIdToPrune = tag === '<none>' ? `${repo}@${digest}` : `${repo}:${tag}`; // untagged, use digest
|
||||
console.log(`pruneInfraImages: removing unused image of ${imageName}: ${imageIdToPrune}`);
|
||||
|
||||
const [error] = await safe(shell.promises.exec('pruneInfraImages', `docker rmi '${imageIdToPrune}'`, {}));
|
||||
const [error] = await safe(shell.exec('pruneInfraImages', `docker rmi '${imageIdToPrune}'`, {}));
|
||||
if (error) console.log(`Error removing image ${imageIdToPrune}: ${error.mesage}`);
|
||||
}
|
||||
}
|
||||
@@ -78,16 +78,16 @@ async function pruneInfraImages() {
|
||||
async function createDockerNetwork() {
|
||||
debug('createDockerNetwork: recreating docker network');
|
||||
|
||||
await safe(shell.promises.exec('createDockerNetwork', 'docker network rm cloudron', {})); // ignore error
|
||||
await safe(shell.exec('createDockerNetwork', 'docker network rm cloudron', {})); // ignore error
|
||||
// the --ipv6 option will work even in ipv6 is disabled. fd00 is IPv6 ULA
|
||||
await shell.promises.exec('createDockerNetwork', `docker network create --subnet=${constants.DOCKER_IPv4_SUBNET} --ip-range=${constants.DOCKER_IPv4_RANGE} --gateway ${constants.DOCKER_IPv4_GATEWAY} --ipv6 --subnet=fd00:c107:d509::/64 cloudron`, {});
|
||||
await shell.exec('createDockerNetwork', `docker network create --subnet=${constants.DOCKER_IPv4_SUBNET} --ip-range=${constants.DOCKER_IPv4_RANGE} --gateway ${constants.DOCKER_IPv4_GATEWAY} --ipv6 --subnet=fd00:c107:d509::/64 cloudron`, {});
|
||||
}
|
||||
|
||||
async function removeAllContainers() {
|
||||
debug('removeAllContainers: removing all containers for infra upgrade');
|
||||
|
||||
await shell.promises.exec('removeAllContainers', 'docker ps -qa --filter \'label=isCloudronManaged\' | xargs --no-run-if-empty docker stop', { shell: '/bin/bash' });
|
||||
await shell.promises.exec('removeAllContainers', 'docker ps -qa --filter \'label=isCloudronManaged\' | xargs --no-run-if-empty docker rm -f', { shell: '/bin/bash' });
|
||||
await shell.exec('removeAllContainers', 'docker ps -qa --filter \'label=isCloudronManaged\' | xargs --no-run-if-empty docker stop', { shell: '/bin/bash' });
|
||||
await shell.exec('removeAllContainers', 'docker ps -qa --filter \'label=isCloudronManaged\' | xargs --no-run-if-empty docker rm -f', { shell: '/bin/bash' });
|
||||
}
|
||||
|
||||
async function markApps(existingInfra, restoreOptions) {
|
||||
|
||||
Reference in New Issue
Block a user