Skip to content

Commit 41e14aa

Browse files
authored
Merge pull request #218 from mook-as/hyperkit-ip
Hyperkit: simplify getting the IP address
2 parents 970ce81 + 9132f08 commit 41e14aa

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/k8s-engine/hyperkit.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,11 @@ export default class HyperkitBackend extends events.EventEmitter implements K8s.
257257
protected get ipAddress(): Promise<string> {
258258
return (async() => {
259259
const { driver, defaultArgs } = this.hyperkitArgs;
260-
const args = defaultArgs.concat([
261-
'ssh', '--', 'ip', '-4', '-o', 'addr', 'show', 'dev', 'eth0'
262-
]);
260+
const args = defaultArgs.concat(['ip']);
263261
const result = await util.promisify(childProcess.execFile)(driver, args);
264-
const match = /\binet\s+([0-9.]+)\//.exec(result.stdout);
265262

266-
if (match) {
267-
return match[1];
263+
if (/^[0-9.]+$/.test(result.stdout.trim())) {
264+
return result.stdout.trim();
268265
}
269266

270267
throw new Error(`Could not find address of VM: ${ result.stderr }`);

0 commit comments

Comments
 (0)