Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nodejitsu/jitsu
...
head fork: nodejitsu/jitsu
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 32 additions and 8 deletions.
  1. +4 −4 lib/jitsu/commands/apps.js
  2. +28 −4 lib/jitsu/commands/snapshots.js
View
8 lib/jitsu/commands/apps.js
@@ -273,7 +273,7 @@ apps.list = function (username, callback) {
return callback();
}
- var rows = [['name', 'state', 'subdomain', 'active snapshot']],
+ var rows = [['name', 'state', 'subdomain', 'running snapshot']],
colors = ['underline', 'underline', 'underline', 'underline'];
apps.forEach(function (app) {
@@ -284,11 +284,11 @@ apps.list = function (username, callback) {
}
//
- // Remark: Attempt to always show active snapshot
+ // Remark: Attempt to always show running snapshot
//
var snapshot = '---';
- if(app.active && app.active.filename) {
- snapshot = app.active.active;
+ if(app.running && app.running.filename) {
+ snapshot = app.running.filename;
}
rows.push([
View
32 lib/jitsu/commands/snapshots.js
@@ -56,14 +56,26 @@ snapshots.list = function (name, callback) {
return callback(err, true);
}
if (snapshots && snapshots.length > 0) {
- var rows = [['name', 'created', 'md5']],
- colors = ['underline', 'underline', 'underline'];
+ var rows = [['name', 'status', 'created', 'md5']],
+ colors = ['underline', 'underline', 'underline', 'underline'];
snapshots.forEach(function (snap) {
+
+ var status = "archived".grey;
+
+ if (snap.active) {
+ status = "active".red;
+ }
+
+ if (snap.running) {
+ status = "running".green;
+ }
+
var date = new Date(snap.ctime);
date = dateformat(date, "mm/dd HH:MM:ss Z");
rows.push([
snap.id,
+ status,
date,
snap.md5
]);
@@ -168,12 +180,24 @@ snapshots.activate = function (name, callback) {
if (!snapshot) {
return callback(new Error('Cannot find snapshot with name: ' + result['snapshot'].magenta), true);
}
+
+ jitsu.log.info('Activating snapshot ' + snapshot.id.magenta);
+
jitsu.snapshots.activate(name, snapshot.id, function(err, result){
if(err) {
return callback(err);
}
- jitsu.log.info('activated');
- callback(null);
+ jitsu.log.info('Snapshot ' + snapshot.id.magenta + ' is now active');
+ //
+ // Remark: After activating a snapshot, we immediately stop && start it,
+ // as to update the running version of the snapshot
+ //
+ jitsu.commands.stop(name, function() {
+ jitsu.commands.start(name, function() {
+ jitsu.log.info('Snapshot ' + snapshot.id.magenta + ' is now running.');
+ callback(null);
+ });
+ });
});
});
}

No commit comments for this range

Something went wrong with that request. Please try again.