Merge pull request #15510 from aveshagarwal/master-selflink-objref

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-10-27 00:37:21 -07:00
7 changed files with 6 additions and 25 deletions

View File

@@ -32,10 +32,6 @@ var (
ErrNoSelfLink = errors.New("selfLink was empty, can't make reference")
)
// ForTesting_ReferencesAllowBlankSelfLinks can be set to true in tests to avoid
// "ErrNoSelfLink" errors.
var ForTesting_ReferencesAllowBlankSelfLinks = false
// GetReference returns an ObjectReference which refers to the given
// object, or an error if the object doesn't follow the conventions
// that would allow this.
@@ -68,11 +64,7 @@ func GetReference(obj runtime.Object) (*ObjectReference, error) {
if version == "" {
selfLink := meta.SelfLink()
if selfLink == "" {
if ForTesting_ReferencesAllowBlankSelfLinks {
version = "testing"
} else {
return nil, ErrNoSelfLink
}
return nil, ErrNoSelfLink
} else {
selfLinkUrl, err := url.Parse(selfLink)
if err != nil {