Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(matchLabels): call BaseObject constructor with correct arguments #91

Merged
merged 1 commit into from
Mar 9, 2017
Merged
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
21 changes: 16 additions & 5 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@ class BaseObject extends CallableObject {
*
* @param {object} options - Options object
* @param {string} options.api - Kubernetes API URL
* @param {string} options.name - kubernetes resource name
* @param {string} options.parentPath - Kubernetes resource paprent path
* @param {string} options.fn - Optional function to invoke when object is
* called.
* @param {string} options.path - Kubernetes resource path
* called
* @param {string} options.qs - Optional query string object
*/
constructor(options) {
const api = options.api;
Expand All @@ -62,10 +64,13 @@ class BaseObject extends CallableObject {
}

super(fn);
this.parentPath = options.parentPath;
this.api = api;
this.path = path;
this._name = options.name;
this.parentPath = options.parentPath;
this.fn = options.fn;
this.qs = options.qs || {};

this.path = path;
}

/**
Expand Down Expand Up @@ -151,7 +156,13 @@ class BaseObject extends CallableObject {
const qs = Object.assign({}, this.qs, {
labelSelector: matchExpression.stringify(expressions)
});
return new this.constructor(Object.assign({}, this, { qs }));
return new this.constructor({
api: this.api,
name: this._name,
parentPath: this.parentPath,
fn: this.fn,
qs
});
}

/**
Expand Down