@cloud-cli/dx 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containers.js +7 -3
- package/package.json +1 -1
package/dist/containers.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { exec } from '@cloud-cli/exec';
|
|
2
|
-
import { getConfig } from '@cloud-cli/cli';
|
|
2
|
+
import { getConfig, logInfo, logError } from '@cloud-cli/cli';
|
|
3
3
|
import { findContainer, listContainers } from './store.js';
|
|
4
4
|
import { addExecFlag, getEnvVars, getListFromString, readTargetName } from './utils.js';
|
|
5
5
|
import getPort from 'get-port';
|
|
@@ -106,9 +106,12 @@ export async function startContainer(options, { run }) {
|
|
|
106
106
|
];
|
|
107
107
|
const output = await exec('docker', execArgs.filter(Boolean), { env });
|
|
108
108
|
if (!output.ok) {
|
|
109
|
+
const e = 'Failed to start container ' + name;
|
|
109
110
|
console.log([output.stdout, output.stderr].join('\n\n'));
|
|
110
|
-
|
|
111
|
+
logError(e);
|
|
112
|
+
throw new Error(e);
|
|
111
113
|
}
|
|
114
|
+
logInfo('Started container ' + name);
|
|
112
115
|
return true;
|
|
113
116
|
}
|
|
114
117
|
export async function stopContainer(options, { run }) {
|
|
@@ -119,9 +122,10 @@ export async function stopContainer(options, { run }) {
|
|
|
119
122
|
}
|
|
120
123
|
await exec('docker', ['stop', '-t', '5', name]);
|
|
121
124
|
await exec('docker', ['rm', name]);
|
|
122
|
-
const containers = [findContainer(name)].filter(
|
|
125
|
+
const containers = [findContainer(name)].filter(c => c && c.domain);
|
|
123
126
|
for (const container of containers) {
|
|
124
127
|
await run('dns.remove', { domain: container.domain });
|
|
125
128
|
}
|
|
129
|
+
logInfo('Stopped container ' + name);
|
|
126
130
|
return true;
|
|
127
131
|
}
|