Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed crash with jitsu list #307

Merged
merged 2 commits into from

2 participants

@ghost

Hi there,

I just added some little check for undefined usernames, so that jitsu list will not crash for unauthorized users (see #299).

@travisbot

This pull request passes (merged e1d614b into dc45bd4).

@jfhbrook

Looks good, I'll merge this in the morning.

@ghost

There was still another issue when doing jitsu deploy as unauthorized user leading to an infinite loop, when trying to cancel the process, needed to kill the process by hand.

Now also resolved, but see #305, because now aborting with ctrl+c also leads to this nondescript message (from the read module I think).

@jfhbrook jfhbrook merged commit f7a006c into nodejitsu:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 3, 2012
  1. Fixed crash with jitsu list

    wibuni authored
  2. Fixed infinite loop at jitsu deploy

    wibuni authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 4 deletions.
  1. +15 −4 lib/jitsu/commands/apps.js
View
19 lib/jitsu/commands/apps.js
@@ -44,7 +44,10 @@ apps.deploy = function (callback) {
function promptLogin () {
jitsu.log.warn("No user is logged in");
jitsu.log.warn("Please authenticate");
- jitsu.commands.users.login(function(){
+ jitsu.commands.users.login(function (err) {
+ if (err) {
+ return callback(err);
+ }
jitsu.commands.apps.deploy(callback);
});
}
@@ -273,11 +276,13 @@ apps.create = function (target, callback) {
//
apps.list = function (username, callback) {
+ authuser = jitsu.config.get('username') || '';
+
if (typeof callback === 'undefined') {
callback = username;
- username = jitsu.config.get('username');
+ username = authuser;
} else {
- username = username || jitsu.config.get('username');
+ username = username || authuser;
}
jitsu.log.info('Listing all apps for ' + username.magenta);
@@ -285,7 +290,13 @@ apps.list = function (username, callback) {
jitsu.apps.list(username, function (err, apps) {
if (err) {
if (err.statusCode === 403) {
- jitsu.log.error(jitsu.config.get('username').magenta + ' is not authorized to list applications for user: ' + username.magenta);
+ if (authuser === '') {
+ jitsu.log.error('You are not authorized to list application for user: ' + username.magenta);
+ jitsu.log.error('You need to login to do that!');
+ }
+ else {
+ jitsu.log.error(jitsu.config.get('username').magenta + ' is not authorized to list applications for user: ' + username.magenta);
+ }
}
return callback(err);
}
Something went wrong with that request. Please try again.