Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions lib/compute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,13 @@ function Compute(options) {
return new Compute(options);
}

var authConfig = {
this.makeAuthenticatedRequest_ = util.makeAuthenticatedRequestFactory({
credentials: options.credentials,
keyFile: options.keyFilename,
scopes: SCOPES,
email: options.email
};

// We store the authConfig for use with gceImages in Zone.
this.authConfig = authConfig;
});

this.makeAuthenticatedRequest_ =
util.makeAuthenticatedRequestFactory(authConfig);
this.projectId = options.projectId;
}

Expand Down
4 changes: 3 additions & 1 deletion lib/compute/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function Zone(compute, name) {
this.name = name;
this.metadata = {};

this.gceImages = gceImages(compute.authConfig);
this.gceImages = gceImages({
authClient: compute.makeAuthenticatedRequest_.authClient
});
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"dns-zonefile": "0.1.10",
"duplexify": "^3.2.0",
"extend": "^3.0.0",
"gce-images": "^0.1.0",
"gce-images": "^0.2.0",
"gcs-resumable-upload": "^0.2.1",
"google-auto-auth": "^0.2.0",
"hash-stream-validation": "^0.1.0",
Expand Down
11 changes: 0 additions & 11 deletions test/compute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,6 @@ describe('Compute', function() {
fakeUtil.normalizeArguments = normalizeArguments;
});

it('should localize authConfig', function() {
var compute = new Compute(options);

assert.deepEqual(compute.authConfig, {
credentials: options.credentials,
keyFile: options.keyFilename,
email: options.email,
scopes: ['https://www.googleapis.com/auth/compute']
});
});

it('should create a makeAuthenticatedRequest method', function(done) {
fakeUtil.makeAuthenticatedRequestFactory = function(options_) {
assert.deepEqual(options_, {
Expand Down
10 changes: 8 additions & 2 deletions test/compute/zone.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ describe('Zone', function() {
var zone;

var COMPUTE = {
authConfig: { a: 'b', c: 'd' }
makeAuthenticatedRequest_: {
authClient: {
a: 'b',
c: 'd'
}
}
};
var ZONE_NAME = 'us-central1-a';

Expand Down Expand Up @@ -111,7 +116,8 @@ describe('Zone', function() {
var gceVal = 'ok';

gceImagesOverride = function(authConfig) {
assert.strictEqual(authConfig, COMPUTE.authConfig);
var expectedAuthClient = COMPUTE.makeAuthenticatedRequest_.authClient;
assert.strictEqual(authConfig.authClient, expectedAuthClient);
return gceVal;
};

Expand Down