diff --git a/lib/package.js b/lib/package.js index bd38f674e..8724542ac 100644 --- a/lib/package.js +++ b/lib/package.js @@ -335,25 +335,25 @@ package.get_latest = function(branch, current_version, dest, cb) { if (err || !version) return cb(err || new Error('Already running latest version.')); - package.check_upgrade(version, dest, function(err) { + package.get_version(version, dest, function(err) { cb(err, version); }); }); }; // called from lib/conf/install when a specific version is passed, e.g. 'config upgrade 1.2.3' -package.check_upgrade = function(version, dest, cb) { +package.get_version = function(version, dest, cb) { var keys = require('./agent/plugins/control-panel/api/keys'), shared = require('./conf/shared'); - if (process.argv.indexOf('test') != -1) return package.get_version(version, dest, cb) + if (process.argv.indexOf('test') != -1) return package.download_install(version, dest, cb) shared.keys.verify_current(function(err) { if (err) return cb(new Error("Missing user credencials, update cancelled for now")); update_attempts(version, function(err, update) { if (err) return cb(err); if (update) { - package.get_version(version, dest, function(err) { + package.download_install(version, dest, function(err) { cb(err, version); }); } else { @@ -363,7 +363,7 @@ package.check_upgrade = function(version, dest, cb) { }); } -package.get_version = function(version, dest, cb) { +package.download_install = function(version, dest, cb) { var final_path = path.join(dest, version); if (fs.existsSync(final_path)) @@ -374,9 +374,7 @@ package.get_version = function(version, dest, cb) { if (err) return cb(err); package.install(file, dest, function(err, installed_version) { - fs.unlink(file, function() { - cb(err, installed_version); - }) + cb(err, installed_version); }); }); }