Permalink
Browse files

[PUBAPI-324] Check for suppressed credentials on GetMachine

  • Loading branch information...
1 parent 03e40c0 commit 2b246e3688646c5c4b53fd8a83a907b6bb69fdc8 @mcavage mcavage committed Sep 9, 2011
Showing with 16 additions and 2 deletions.
  1. +15 −1 bin/sdc-getmachine
  2. +1 −1 lib/cloudapi.js
View
@@ -43,7 +43,21 @@ common.parseArguments(Options, ShortOptions, function(parsed) {
common.usage(usageStr, 1, 'machine(id) required');
var client = common.newClient(parsed);
+
+ function callback(err, obj, headers) {
+ if (err) {
+ console.error(err.message);
+ process.exit(3);
+ }
+
+ if (obj)
+ console.log(JSON.stringify(obj, null, 2));
+
+ if (headers && headers['x-credentials-suppressed'])
+ console.error('credentials were suppressed from metadata');
+ }
+
parsed.argv.remain.forEach(function(machine) {
- client.getMachine(machine, parsed.credentials || false, common.callback);
+ client.getMachine(machine, parsed.credentials || false, callback);
});
}, usageStr);
View
@@ -1958,7 +1958,7 @@ CloudAPI.prototype._get = function(req, callback, noCache) {
self._cachePut(req.path, obj);
log.debug('CloudAPI._get(%s) -> err=%o, obj=%s', req.path, err, obj);
- return callback(err, obj);
+ return callback(err, obj, headers);
});
};

0 comments on commit 2b246e3

Please sign in to comment.