From b69832c227c75454d99842698903164bdb5d9cd8 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Tue, 11 Apr 2017 15:09:25 -0700 Subject: [PATCH] joyent/node-triton#193 `triton ssh ...` can crash if the instance image has no tags Reviewed by: Josh Wilsdon Approved by: Josh Wilsdon --- CHANGES.md | 3 +++ lib/do_instance/do_ssh.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b0da44c..13266c4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,9 @@ Known issues: ## not yet released +- [joyent/node-triton#193] Fix possible CLI crash with `triton ssh ...` if the + instance's image doesn't have any tags. + ## 5.2.0 - [joyent/node-triton#197] Create triton image export command diff --git a/lib/do_instance/do_ssh.js b/lib/do_instance/do_ssh.js index 8b45571..3b9467b 100644 --- a/lib/do_instance/do_ssh.js +++ b/lib/do_instance/do_ssh.js @@ -5,7 +5,7 @@ */ /* - * Copyright 2016 Joyent, Inc. + * Copyright 2017 Joyent, Inc. * * `triton instance ssh ...` */ @@ -76,7 +76,7 @@ function do_ssh(subcmd, opts, args, callback) { * This is a convention as seen on Joyent's * "ubuntu-certified" KVM images. */ - if (image.tags.default_user) { + if (image.tags && image.tags.default_user) { user = image.tags.default_user; } else { user = 'root';