mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case (as per go guidelines). Just accumulated nits.
This commit is contained in:
		@@ -248,16 +248,16 @@ func podExists(c *client.Client, podNamespace string, podID string) wait.Conditi
 | 
				
			|||||||
func runReplicationControllerTest(c *client.Client) {
 | 
					func runReplicationControllerTest(c *client.Client) {
 | 
				
			||||||
	data, err := ioutil.ReadFile("api/examples/controller.json")
 | 
						data, err := ioutil.ReadFile("api/examples/controller.json")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Fatalf("Unexpected error: %#v", err)
 | 
							glog.Fatalf("Unexpected error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	var controller api.ReplicationController
 | 
						var controller api.ReplicationController
 | 
				
			||||||
	if err := api.Scheme.DecodeInto(data, &controller); err != nil {
 | 
						if err := api.Scheme.DecodeInto(data, &controller); err != nil {
 | 
				
			||||||
		glog.Fatalf("Unexpected error: %#v", err)
 | 
							glog.Fatalf("Unexpected error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	glog.Infof("Creating replication controllers")
 | 
						glog.Infof("Creating replication controllers")
 | 
				
			||||||
	if _, err := c.ReplicationControllers(api.NamespaceDefault).Create(&controller); err != nil {
 | 
						if _, err := c.ReplicationControllers(api.NamespaceDefault).Create(&controller); err != nil {
 | 
				
			||||||
		glog.Fatalf("Unexpected error: %#v", err)
 | 
							glog.Fatalf("Unexpected error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	glog.Infof("Done creating replication controllers")
 | 
						glog.Infof("Done creating replication controllers")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,7 +146,7 @@ func enscope(parent string, spec EnscopeSpec, in interface{}) (out interface{},
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func ReadConfigData(location string) ([]byte, error) {
 | 
					func ReadConfigData(location string) ([]byte, error) {
 | 
				
			||||||
	if len(location) == 0 {
 | 
						if len(location) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("Location given but empty")
 | 
							return nil, fmt.Errorf("location given but empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if location == "-" {
 | 
						if location == "-" {
 | 
				
			||||||
@@ -172,21 +172,21 @@ func readConfigDataFromLocation(location string) ([]byte, error) {
 | 
				
			|||||||
	if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
						if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
				
			||||||
		resp, err := http.Get(location)
 | 
							resp, err := http.Get(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to access URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to access URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		defer resp.Body.Close()
 | 
							defer resp.Body.Close()
 | 
				
			||||||
		if resp.StatusCode != 200 {
 | 
							if resp.StatusCode != 200 {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
								return nil, fmt.Errorf("unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		data, err := ioutil.ReadAll(resp.Body)
 | 
							data, err := ioutil.ReadAll(resp.Body)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		data, err := ioutil.ReadFile(location)
 | 
							data, err := ioutil.ReadFile(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -175,7 +175,7 @@ func portsFromString(spec string) (servicePort int, containerPort int, err error
 | 
				
			|||||||
	pieces := strings.Split(spec, ":")
 | 
						pieces := strings.Split(spec, ":")
 | 
				
			||||||
	if len(pieces) != 2 {
 | 
						if len(pieces) != 2 {
 | 
				
			||||||
		glog.Infof("Bad port spec: %s", spec)
 | 
							glog.Infof("Bad port spec: %s", spec)
 | 
				
			||||||
		return 0, 0, fmt.Errorf("Bad port spec: %s", spec)
 | 
							return 0, 0, fmt.Errorf("bad port spec: %s", spec)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	servicePort, err = strconv.Atoi(pieces[0])
 | 
						servicePort, err = strconv.Atoi(pieces[0])
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -207,7 +207,7 @@ func portsFromString(spec string) (servicePort int, containerPort int, err error
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func ReadConfigData(location string) ([]byte, error) {
 | 
					func ReadConfigData(location string) ([]byte, error) {
 | 
				
			||||||
	if len(location) == 0 {
 | 
						if len(location) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("Location given but empty")
 | 
							return nil, fmt.Errorf("location given but empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if location == "-" {
 | 
						if location == "-" {
 | 
				
			||||||
@@ -233,21 +233,21 @@ func readConfigDataFromLocation(location string) ([]byte, error) {
 | 
				
			|||||||
	if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
						if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
				
			||||||
		resp, err := http.Get(location)
 | 
							resp, err := http.Get(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to access URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to access URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		defer resp.Body.Close()
 | 
							defer resp.Body.Close()
 | 
				
			||||||
		if resp.StatusCode != 200 {
 | 
							if resp.StatusCode != 200 {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
								return nil, fmt.Errorf("unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		data, err := ioutil.ReadAll(resp.Body)
 | 
							data, err := ioutil.ReadAll(resp.Body)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		data, err := ioutil.ReadFile(location)
 | 
							data, err := ioutil.ReadFile(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -234,7 +234,7 @@ func portsFromString(spec string) (servicePort int, containerPort int, err error
 | 
				
			|||||||
	pieces := strings.Split(spec, ":")
 | 
						pieces := strings.Split(spec, ":")
 | 
				
			||||||
	if len(pieces) != 2 {
 | 
						if len(pieces) != 2 {
 | 
				
			||||||
		glog.Infof("Bad port spec: %s", spec)
 | 
							glog.Infof("Bad port spec: %s", spec)
 | 
				
			||||||
		return 0, 0, fmt.Errorf("Bad port spec: %s", spec)
 | 
							return 0, 0, fmt.Errorf("bad port spec: %s", spec)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	servicePort, err = strconv.Atoi(pieces[0])
 | 
						servicePort, err = strconv.Atoi(pieces[0])
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -266,7 +266,7 @@ func portsFromString(spec string) (servicePort int, containerPort int, err error
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func ReadConfigData(location string) ([]byte, error) {
 | 
					func ReadConfigData(location string) ([]byte, error) {
 | 
				
			||||||
	if len(location) == 0 {
 | 
						if len(location) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("Location given but empty")
 | 
							return nil, fmt.Errorf("location given but empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if location == "-" {
 | 
						if location == "-" {
 | 
				
			||||||
@@ -292,21 +292,21 @@ func readConfigDataFromLocation(location string) ([]byte, error) {
 | 
				
			|||||||
	if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
						if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
				
			||||||
		resp, err := http.Get(location)
 | 
							resp, err := http.Get(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to access URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to access URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		defer resp.Body.Close()
 | 
							defer resp.Body.Close()
 | 
				
			||||||
		if resp.StatusCode != 200 {
 | 
							if resp.StatusCode != 200 {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
								return nil, fmt.Errorf("unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		data, err := ioutil.ReadAll(resp.Body)
 | 
							data, err := ioutil.ReadAll(resp.Body)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		data, err := ioutil.ReadFile(location)
 | 
							data, err := ioutil.ReadFile(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,7 @@ func NewConflict(kind, name string, err error) error {
 | 
				
			|||||||
			Kind: kind,
 | 
								Kind: kind,
 | 
				
			||||||
			ID:   name,
 | 
								ID:   name,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Message: fmt.Sprintf("%s %q cannot be updated: %s", kind, name, err),
 | 
							Message: fmt.Sprintf("%s %q cannot be updated: %v", kind, name, err),
 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -124,7 +124,7 @@ func NewInvalid(kind, name string, errs ValidationErrorList) error {
 | 
				
			|||||||
			ID:     name,
 | 
								ID:     name,
 | 
				
			||||||
			Causes: causes,
 | 
								Causes: causes,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		Message: fmt.Sprintf("%s %q is invalid: %s", kind, name, errs.ToError()),
 | 
							Message: fmt.Sprintf("%s %q is invalid: %v", kind, name, errs.ToError()),
 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,7 +294,7 @@ func (a genericAccessor) SetSelfLink(selfLink string) {
 | 
				
			|||||||
func fieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
 | 
					func fieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
 | 
				
			||||||
	field := v.FieldByName(fieldName)
 | 
						field := v.FieldByName(fieldName)
 | 
				
			||||||
	if !field.IsValid() {
 | 
						if !field.IsValid() {
 | 
				
			||||||
		return fmt.Errorf("Couldn't find %v field in %#v", fieldName, v.Interface())
 | 
							return fmt.Errorf("couldn't find %v field in %#v", fieldName, v.Interface())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	v, err := conversion.EnforcePtr(dest)
 | 
						v, err := conversion.EnforcePtr(dest)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -309,7 +309,7 @@ func fieldPtr(v reflect.Value, fieldName string, dest interface{}) error {
 | 
				
			|||||||
		v.Set(field.Convert(v.Type()))
 | 
							v.Set(field.Convert(v.Type()))
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return fmt.Errorf("Couldn't assign/convert %v to %v", field.Type(), v.Type())
 | 
						return fmt.Errorf("couldn't assign/convert %v to %v", field.Type(), v.Type())
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// extractFromTypeMeta extracts pointers to version and kind fields from an object
 | 
					// extractFromTypeMeta extracts pointers to version and kind fields from an object
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -434,7 +434,7 @@ func ValidateService(service *api.Service, lister ServiceLister, ctx api.Context
 | 
				
			|||||||
				if services.Items[i].Name != service.Name &&
 | 
									if services.Items[i].Name != service.Name &&
 | 
				
			||||||
					services.Items[i].Spec.CreateExternalLoadBalancer &&
 | 
										services.Items[i].Spec.CreateExternalLoadBalancer &&
 | 
				
			||||||
					services.Items[i].Spec.Port == service.Spec.Port {
 | 
										services.Items[i].Spec.Port == service.Spec.Port {
 | 
				
			||||||
					allErrs = append(allErrs, errs.NewConflict("service", service.Name, fmt.Errorf("Port: %d is already in use", service.Spec.Port)))
 | 
										allErrs = append(allErrs, errs.NewConflict("service", service.Name, fmt.Errorf("port: %d is already in use", service.Spec.Port)))
 | 
				
			||||||
					break
 | 
										break
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -548,7 +548,7 @@ func ValidateMinionUpdate(oldMinion *api.Minion, minion *api.Minion) errs.Valida
 | 
				
			|||||||
	oldMinion.Labels = minion.Labels
 | 
						oldMinion.Labels = minion.Labels
 | 
				
			||||||
	oldMinion.ObjectMeta.Labels = minion.ObjectMeta.Labels
 | 
						oldMinion.ObjectMeta.Labels = minion.ObjectMeta.Labels
 | 
				
			||||||
	if !reflect.DeepEqual(oldMinion, minion) {
 | 
						if !reflect.DeepEqual(oldMinion, minion) {
 | 
				
			||||||
		allErrs = append(allErrs, fmt.Errorf("Update contains more than labels changes"))
 | 
							allErrs = append(allErrs, fmt.Errorf("update contains more than labels changes"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return allErrs
 | 
						return allErrs
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -805,7 +805,7 @@ func TestValidateService(t *testing.T) {
 | 
				
			|||||||
		registry.List = tc.existing
 | 
							registry.List = tc.existing
 | 
				
			||||||
		errs := ValidateService(&tc.svc, registry, api.NewDefaultContext())
 | 
							errs := ValidateService(&tc.svc, registry, api.NewDefaultContext())
 | 
				
			||||||
		if len(errs) != tc.numErrs {
 | 
							if len(errs) != tc.numErrs {
 | 
				
			||||||
			t.Errorf("Unexpected error list for case %q: %+v", tc.name, errs)
 | 
								t.Errorf("Unexpected error list for case %q: %v", tc.name, errs.ToError())
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -315,7 +315,7 @@ func parseTimeout(str string) time.Duration {
 | 
				
			|||||||
		if err == nil {
 | 
							if err == nil {
 | 
				
			||||||
			return timeout
 | 
								return timeout
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		glog.Errorf("Failed to parse: %#v '%s'", err, str)
 | 
							glog.Errorf("Failed to parse %q: %v", str, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 30 * time.Second
 | 
						return 30 * time.Second
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,7 +86,7 @@ func (c *Client) ServerVersion() (*version.Info, error) {
 | 
				
			|||||||
	var info version.Info
 | 
						var info version.Info
 | 
				
			||||||
	err = json.Unmarshal(body, &info)
 | 
						err = json.Unmarshal(body, &info)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Got '%s': %v", string(body), err)
 | 
							return nil, fmt.Errorf("got '%s': %v", string(body), err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return &info, nil
 | 
						return &info, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -100,7 +100,7 @@ func (c *Client) ServerAPIVersions() (*api.APIVersions, error) {
 | 
				
			|||||||
	var v api.APIVersions
 | 
						var v api.APIVersions
 | 
				
			||||||
	err = json.Unmarshal(body, &v)
 | 
						err = json.Unmarshal(body, &v)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Got '%s': %v", string(body), err)
 | 
							return nil, fmt.Errorf("got '%s': %v", string(body), err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return &v, nil
 | 
						return &v, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -241,7 +241,7 @@ func (r *Request) Body(obj interface{}) *Request {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		r.body = bytes.NewBuffer(data)
 | 
							r.body = bytes.NewBuffer(data)
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		r.err = fmt.Errorf("Unknown type used for body: %#v", obj)
 | 
							r.err = fmt.Errorf("unknown type used for body: %#v", obj)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return r
 | 
						return r
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -305,7 +305,7 @@ func (r *Request) Watch() (watch.Interface, error) {
 | 
				
			|||||||
		if resp.Body != nil {
 | 
							if resp.Body != nil {
 | 
				
			||||||
			body, _ = ioutil.ReadAll(resp.Body)
 | 
								body, _ = ioutil.ReadAll(resp.Body)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return nil, fmt.Errorf("For request '%v', got status: %v\nbody: %v", req.URL, resp.StatusCode, string(body))
 | 
							return nil, fmt.Errorf("for request '%v', got status: %v\nbody: %v", req.URL, resp.StatusCode, string(body))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil
 | 
						return watch.NewStreamWatcher(watchjson.NewDecoder(resp.Body, r.codec)), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,7 @@ func getAuth() (auth aws.Auth, err error) {
 | 
				
			|||||||
// readAWSCloudConfig reads an instance of AWSCloudConfig from config reader.
 | 
					// readAWSCloudConfig reads an instance of AWSCloudConfig from config reader.
 | 
				
			||||||
func readAWSCloudConfig(config io.Reader) (*AWSCloudConfig, error) {
 | 
					func readAWSCloudConfig(config io.Reader) (*AWSCloudConfig, error) {
 | 
				
			||||||
	if config == nil {
 | 
						if config == nil {
 | 
				
			||||||
		return nil, fmt.Errorf("No AWS cloud provider config file given")
 | 
							return nil, fmt.Errorf("no AWS cloud provider config file given")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var cfg AWSCloudConfig
 | 
						var cfg AWSCloudConfig
 | 
				
			||||||
@@ -71,7 +71,7 @@ func readAWSCloudConfig(config io.Reader) (*AWSCloudConfig, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if cfg.Global.Region == "" {
 | 
						if cfg.Global.Region == "" {
 | 
				
			||||||
		return nil, fmt.Errorf("No region specified in configuration file")
 | 
							return nil, fmt.Errorf("no region specified in configuration file")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return &cfg, nil
 | 
						return &cfg, nil
 | 
				
			||||||
@@ -81,7 +81,7 @@ func readAWSCloudConfig(config io.Reader) (*AWSCloudConfig, error) {
 | 
				
			|||||||
func newAWSCloud(config io.Reader, authFunc AuthFunc) (*AWSCloud, error) {
 | 
					func newAWSCloud(config io.Reader, authFunc AuthFunc) (*AWSCloud, error) {
 | 
				
			||||||
	cfg, err := readAWSCloudConfig(config)
 | 
						cfg, err := readAWSCloudConfig(config)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Unable to read AWS cloud provider config file: %s", err)
 | 
							return nil, fmt.Errorf("unable to read AWS cloud provider config file: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auth, err := authFunc()
 | 
						auth, err := authFunc()
 | 
				
			||||||
@@ -91,7 +91,7 @@ func newAWSCloud(config io.Reader, authFunc AuthFunc) (*AWSCloud, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	region, ok := aws.Regions[cfg.Global.Region]
 | 
						region, ok := aws.Regions[cfg.Global.Region]
 | 
				
			||||||
	if !ok {
 | 
						if !ok {
 | 
				
			||||||
		return nil, fmt.Errorf("Not a valid AWS region: %s", cfg.Global.Region)
 | 
							return nil, fmt.Errorf("not a valid AWS region: %s", cfg.Global.Region)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ec2 := ec2.New(auth, region)
 | 
						ec2 := ec2.New(auth, region)
 | 
				
			||||||
@@ -130,22 +130,22 @@ func (aws *AWSCloud) IPAddress(name string) (net.IP, error) {
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(resp.Reservations) == 0 {
 | 
						if len(resp.Reservations) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("No reservations found for host: %s", name)
 | 
							return nil, fmt.Errorf("no reservations found for host: %s", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(resp.Reservations) > 1 {
 | 
						if len(resp.Reservations) > 1 {
 | 
				
			||||||
		return nil, fmt.Errorf("Multiple reservations found for host: %s", name)
 | 
							return nil, fmt.Errorf("multiple reservations found for host: %s", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(resp.Reservations[0].Instances) == 0 {
 | 
						if len(resp.Reservations[0].Instances) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("No instances found for host: %s", name)
 | 
							return nil, fmt.Errorf("no instances found for host: %s", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(resp.Reservations[0].Instances) > 1 {
 | 
						if len(resp.Reservations[0].Instances) > 1 {
 | 
				
			||||||
		return nil, fmt.Errorf("Multiple instances found for host: %s", name)
 | 
							return nil, fmt.Errorf("multiple instances found for host: %s", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ipAddress := resp.Reservations[0].Instances[0].PrivateIpAddress
 | 
						ipAddress := resp.Reservations[0].Instances[0].PrivateIpAddress
 | 
				
			||||||
	ip := net.ParseIP(ipAddress)
 | 
						ip := net.ParseIP(ipAddress)
 | 
				
			||||||
	if ip == nil {
 | 
						if ip == nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Invalid network IP: %s", ipAddress)
 | 
							return nil, fmt.Errorf("invalid network IP: %s", ipAddress)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return ip, nil
 | 
						return ip, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -157,7 +157,7 @@ func (aws *AWSCloud) getInstancesByRegex(regex string) ([]string, error) {
 | 
				
			|||||||
		return []string{}, err
 | 
							return []string{}, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if resp == nil {
 | 
						if resp == nil {
 | 
				
			||||||
		return []string{}, fmt.Errorf("No InstanceResp returned")
 | 
							return []string{}, fmt.Errorf("no InstanceResp returned")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	re, err := regexp.Compile(regex)
 | 
						re, err := regexp.Compile(regex)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,7 +78,7 @@ func getProjectAndZone() (string, string, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	parts := strings.Split(result, "/")
 | 
						parts := strings.Split(result, "/")
 | 
				
			||||||
	if len(parts) != 4 {
 | 
						if len(parts) != 4 {
 | 
				
			||||||
		return "", "", fmt.Errorf("Unexpected response: %s", result)
 | 
							return "", "", fmt.Errorf("unexpected response: %s", result)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return parts[1], parts[3], nil
 | 
						return parts[1], parts[3], nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -91,7 +91,7 @@ func getInstanceID() (string, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	parts := strings.Split(result, ".")
 | 
						parts := strings.Split(result, ".")
 | 
				
			||||||
	if len(parts) == 0 {
 | 
						if len(parts) == 0 {
 | 
				
			||||||
		return "", fmt.Errorf("Unexpected response: %s", result)
 | 
							return "", fmt.Errorf("unexpected response: %s", result)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return parts[0], nil
 | 
						return parts[0], nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -266,7 +266,7 @@ func (gce *GCECloud) IPAddress(instance string) (net.IP, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	ip := net.ParseIP(res.NetworkInterfaces[0].AccessConfigs[0].NatIP)
 | 
						ip := net.ParseIP(res.NetworkInterfaces[0].AccessConfigs[0].NatIP)
 | 
				
			||||||
	if ip == nil {
 | 
						if ip == nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Invalid network IP: %s", res.NetworkInterfaces[0].AccessConfigs[0].NatIP)
 | 
							return nil, fmt.Errorf("invalid network IP: %s", res.NetworkInterfaces[0].AccessConfigs[0].NatIP)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return ip, nil
 | 
						return ip, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,7 +79,7 @@ func (cfg Config) toAuthOptions() gophercloud.AuthOptions {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func readConfig(config io.Reader) (Config, error) {
 | 
					func readConfig(config io.Reader) (Config, error) {
 | 
				
			||||||
	if config == nil {
 | 
						if config == nil {
 | 
				
			||||||
		err := fmt.Errorf("No OpenStack cloud provider config file given")
 | 
							err := fmt.Errorf("no OpenStack cloud provider config file given")
 | 
				
			||||||
		return Config{}, err
 | 
							return Config{}, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,7 +85,7 @@ func InitCloudProvider(name string, configFilePath string) Interface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	cloud, err := GetCloudProvider(name, config)
 | 
						cloud, err := GetCloudProvider(name, config)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Fatalf("Couldn't init cloud provider %q: %#v", name, err)
 | 
							glog.Fatalf("Couldn't init cloud provider %q: %v", name, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if cloud == nil {
 | 
						if cloud == nil {
 | 
				
			||||||
		glog.Fatalf("Unknown cloud provider: %s", name)
 | 
							glog.Fatalf("Unknown cloud provider: %s", name)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -116,7 +116,7 @@ func (v *VagrantCloud) IPAddress(instance string) (net.IP, error) {
 | 
				
			|||||||
			return net.ParseIP(minion.IP), nil
 | 
								return net.ParseIP(minion.IP), nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil, fmt.Errorf("Unable to find IP address for instance: %s", instance)
 | 
						return nil, fmt.Errorf("unable to find IP address for instance: %s", instance)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// saltMinionsByRole filters a list of minions that have a matching role.
 | 
					// saltMinionsByRole filters a list of minions that have a matching role.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -204,7 +204,7 @@ func (rm *ReplicationManager) synchronize() {
 | 
				
			|||||||
			glog.V(4).Infof("periodic sync of %v", controllers[ix].Name)
 | 
								glog.V(4).Infof("periodic sync of %v", controllers[ix].Name)
 | 
				
			||||||
			err := rm.syncHandler(controllers[ix])
 | 
								err := rm.syncHandler(controllers[ix])
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Error synchronizing: %#v", err)
 | 
									glog.Errorf("Error synchronizing: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}(ix)
 | 
							}(ix)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,7 +218,7 @@ func (c *Converter) Convert(src, dest interface{}, flags FieldMatchingFlags, met
 | 
				
			|||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !dv.CanAddr() {
 | 
						if !dv.CanAddr() {
 | 
				
			||||||
		return fmt.Errorf("Can't write to dest")
 | 
							return fmt.Errorf("can't write to dest")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sv, err := EnforcePtr(src)
 | 
						sv, err := EnforcePtr(src)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -252,7 +252,7 @@ func (c *Converter) convert(sv, dv reflect.Value, scope *scope) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if !scope.flags.IsSet(AllowDifferentFieldTypeNames) && c.NameFunc(dt) != c.NameFunc(st) {
 | 
						if !scope.flags.IsSet(AllowDifferentFieldTypeNames) && c.NameFunc(dt) != c.NameFunc(st) {
 | 
				
			||||||
		return fmt.Errorf("Can't convert %v to %v because type names don't match (%v, %v).", st, dt, c.NameFunc(st), c.NameFunc(dt))
 | 
							return fmt.Errorf("can't convert %v to %v because type names don't match (%v, %v).", st, dt, c.NameFunc(st), c.NameFunc(dt))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// This should handle all simple types.
 | 
						// This should handle all simple types.
 | 
				
			||||||
@@ -346,7 +346,7 @@ func (c *Converter) convert(sv, dv reflect.Value, scope *scope) error {
 | 
				
			|||||||
			dv.SetMapIndex(dk, dkv)
 | 
								dv.SetMapIndex(dk, dkv)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return fmt.Errorf("Couldn't copy '%v' into '%v'", st, dt)
 | 
							return fmt.Errorf("couldn't copy '%v' into '%v'", st, dt)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,7 +115,7 @@ func (s *Scheme) DecodeInto(data []byte, obj interface{}) error {
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		external, err := s.NewObject(dataVersion, dataKind)
 | 
							external, err := s.NewObject(dataVersion, dataKind)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return fmt.Errorf("Unable to create new object of type ('%s', '%s')", dataVersion, dataKind)
 | 
								return fmt.Errorf("unable to create new object of type ('%s', '%s')", dataVersion, dataKind)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// yaml is a superset of json, so we use it to decode here. That way,
 | 
							// yaml is a superset of json, so we use it to decode here. That way,
 | 
				
			||||||
		// we understand both.
 | 
							// we understand both.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,9 +148,9 @@ func (s *Scheme) NewObject(versionName, typeName string) (interface{}, error) {
 | 
				
			|||||||
		if t, ok := types[typeName]; ok {
 | 
							if t, ok := types[typeName]; ok {
 | 
				
			||||||
			return reflect.New(t).Interface(), nil
 | 
								return reflect.New(t).Interface(), nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return nil, fmt.Errorf("No type '%v' for version '%v'", typeName, versionName)
 | 
							return nil, fmt.Errorf("no type '%v' for version '%v'", typeName, versionName)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil, fmt.Errorf("No version '%v'", versionName)
 | 
						return nil, fmt.Errorf("no version '%v'", versionName)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AddConversionFuncs adds functions to the list of conversion functions. The given
 | 
					// AddConversionFuncs adds functions to the list of conversion functions. The given
 | 
				
			||||||
@@ -276,7 +276,7 @@ func (s *Scheme) ObjectVersionAndKind(obj interface{}) (apiVersion, kind string,
 | 
				
			|||||||
	version, vOK := s.typeToVersion[t]
 | 
						version, vOK := s.typeToVersion[t]
 | 
				
			||||||
	kinds, kOK := s.typeToKind[t]
 | 
						kinds, kOK := s.typeToKind[t]
 | 
				
			||||||
	if !vOK || !kOK {
 | 
						if !vOK || !kOK {
 | 
				
			||||||
		return "", "", fmt.Errorf("Unregistered type: %v", t)
 | 
							return "", "", fmt.Errorf("unregistered type: %v", t)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	apiVersion = version
 | 
						apiVersion = version
 | 
				
			||||||
	kind = kinds[0]
 | 
						kind = kinds[0]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -184,7 +184,7 @@ func TestContainerRegistryBasics(t *testing.T) {
 | 
				
			|||||||
			w.Header().Set("Content-Type", "application/json")
 | 
								w.Header().Set("Content-Type", "application/json")
 | 
				
			||||||
			bytes, err := json.Marshal(token)
 | 
								bytes, err := json.Marshal(token)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				t.Fatalf("unexpected error: %+v", err)
 | 
									t.Fatalf("unexpected error: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			fmt.Fprintln(w, string(bytes))
 | 
								fmt.Fprintln(w, string(bytes))
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ func NewExecHealthChecker(runner CommandRunner) HealthChecker {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (e *ExecHealthChecker) HealthCheck(podFullName, podUUID string, currentState api.PodState, container api.Container) (Status, error) {
 | 
					func (e *ExecHealthChecker) HealthCheck(podFullName, podUUID string, currentState api.PodState, container api.Container) (Status, error) {
 | 
				
			||||||
	if container.LivenessProbe.Exec == nil {
 | 
						if container.LivenessProbe.Exec == nil {
 | 
				
			||||||
		return Unknown, fmt.Errorf("Missing exec parameters")
 | 
							return Unknown, fmt.Errorf("missing exec parameters")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data, err := e.runner.RunInContainer(podFullName, podUUID, container.Name, container.LivenessProbe.Exec.Command)
 | 
						data, err := e.runner.RunInContainer(podFullName, podUUID, container.Name, container.LivenessProbe.Exec.Command)
 | 
				
			||||||
	glog.V(1).Infof("container %s failed health check: %s", podFullName, string(data))
 | 
						glog.V(1).Infof("container %s failed health check: %s", podFullName, string(data))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ import (
 | 
				
			|||||||
func GetServerVersion(client *client.Client) (*version.Info, error) {
 | 
					func GetServerVersion(client *client.Client) (*version.Info, error) {
 | 
				
			||||||
	info, err := client.ServerVersion()
 | 
						info, err := client.ServerVersion()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Got error: %v", err)
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return info, nil
 | 
						return info, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -100,7 +100,7 @@ func LoadNamespaceInfo(path string) (*NamespaceInfo, error) {
 | 
				
			|||||||
// SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.
 | 
					// SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.
 | 
				
			||||||
func SaveNamespaceInfo(path string, ns *NamespaceInfo) error {
 | 
					func SaveNamespaceInfo(path string, ns *NamespaceInfo) error {
 | 
				
			||||||
	if !util.IsDNSLabel(ns.Namespace) {
 | 
						if !util.IsDNSLabel(ns.Namespace) {
 | 
				
			||||||
		return fmt.Errorf("Namespace %s is not a valid DNS Label", ns.Namespace)
 | 
							return fmt.Errorf("namespace %s is not a valid DNS Label", ns.Namespace)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data, err := json.Marshal(ns)
 | 
						data, err := json.Marshal(ns)
 | 
				
			||||||
	err = ioutil.WriteFile(path, data, 0600)
 | 
						err = ioutil.WriteFile(path, data, 0600)
 | 
				
			||||||
@@ -193,7 +193,7 @@ func portsFromString(spec string) ([]api.Port, error) {
 | 
				
			|||||||
		pieces := strings.Split(part, ":")
 | 
							pieces := strings.Split(part, ":")
 | 
				
			||||||
		if len(pieces) < 1 || len(pieces) > 2 {
 | 
							if len(pieces) < 1 || len(pieces) > 2 {
 | 
				
			||||||
			glog.Infof("Bad port spec: %s", part)
 | 
								glog.Infof("Bad port spec: %s", part)
 | 
				
			||||||
			return nil, fmt.Errorf("Bad port spec: %s", part)
 | 
								return nil, fmt.Errorf("bad port spec: %s", part)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		host := 0
 | 
							host := 0
 | 
				
			||||||
		container := 0
 | 
							container := 0
 | 
				
			||||||
@@ -230,7 +230,7 @@ func portsFromString(spec string) ([]api.Port, error) {
 | 
				
			|||||||
func RunController(ctx api.Context, image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error {
 | 
					func RunController(ctx api.Context, image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error {
 | 
				
			||||||
	// TODO replace ctx with a namespace string
 | 
						// TODO replace ctx with a namespace string
 | 
				
			||||||
	if servicePort > 0 && !util.IsDNSLabel(name) {
 | 
						if servicePort > 0 && !util.IsDNSLabel(name) {
 | 
				
			||||||
		return fmt.Errorf("Service creation requested, but an invalid name for a service was provided (%s). Service names must be valid DNS labels.", name)
 | 
							return fmt.Errorf("service creation requested, but an invalid name for a service was provided (%s). Service names must be valid DNS labels.", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	ports, err := portsFromString(portSpec)
 | 
						ports, err := portsFromString(portSpec)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,16 +123,16 @@ func (h *HumanReadablePrinter) Handler(columns []string, printFunc interface{})
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (h *HumanReadablePrinter) validatePrintHandlerFunc(printFunc reflect.Value) error {
 | 
					func (h *HumanReadablePrinter) validatePrintHandlerFunc(printFunc reflect.Value) error {
 | 
				
			||||||
	if printFunc.Kind() != reflect.Func {
 | 
						if printFunc.Kind() != reflect.Func {
 | 
				
			||||||
		return fmt.Errorf("Invalid print handler. %#v is not a function.", printFunc)
 | 
							return fmt.Errorf("invalid print handler. %#v is not a function.", printFunc)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	funcType := printFunc.Type()
 | 
						funcType := printFunc.Type()
 | 
				
			||||||
	if funcType.NumIn() != 2 || funcType.NumOut() != 1 {
 | 
						if funcType.NumIn() != 2 || funcType.NumOut() != 1 {
 | 
				
			||||||
		return fmt.Errorf("Invalid print handler." +
 | 
							return fmt.Errorf("invalid print handler." +
 | 
				
			||||||
			"Must accept 2 parameters and return 1 value.")
 | 
								"Must accept 2 parameters and return 1 value.")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if funcType.In(1) != reflect.TypeOf((*io.Writer)(nil)).Elem() ||
 | 
						if funcType.In(1) != reflect.TypeOf((*io.Writer)(nil)).Elem() ||
 | 
				
			||||||
		funcType.Out(0) != reflect.TypeOf((*error)(nil)).Elem() {
 | 
							funcType.Out(0) != reflect.TypeOf((*error)(nil)).Elem() {
 | 
				
			||||||
		return fmt.Errorf("Invalid print handler. The expected signature is: "+
 | 
							return fmt.Errorf("invalid print handler. The expected signature is: "+
 | 
				
			||||||
			"func handler(obj %v, w io.Writer) error", funcType.In(0))
 | 
								"func handler(obj %v, w io.Writer) error", funcType.In(0))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
@@ -321,7 +321,7 @@ func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) er
 | 
				
			|||||||
			return resultValue.Interface().(error)
 | 
								return resultValue.Interface().(error)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		return fmt.Errorf("Error: unknown type %#v", obj)
 | 
							return fmt.Errorf("unknown type %#v", obj)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,7 +52,7 @@ func NewFactory() *Factory {
 | 
				
			|||||||
		Describer: func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Describer, error) {
 | 
							Describer: func(cmd *cobra.Command, mapping *meta.RESTMapping) (kubectl.Describer, error) {
 | 
				
			||||||
			describer, ok := kubectl.DescriberFor(mapping.Kind, getKubeClient(cmd))
 | 
								describer, ok := kubectl.DescriberFor(mapping.Kind, getKubeClient(cmd))
 | 
				
			||||||
			if !ok {
 | 
								if !ok {
 | 
				
			||||||
				return nil, fmt.Errorf("No description has been implemented for %q", mapping.Kind)
 | 
									return nil, fmt.Errorf("no description has been implemented for %q", mapping.Kind)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return describer, nil
 | 
								return describer, nil
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,7 +79,7 @@ Examples:
 | 
				
			|||||||
			// print the current object
 | 
								// print the current object
 | 
				
			||||||
			if !isWatchOnly {
 | 
								if !isWatchOnly {
 | 
				
			||||||
				if err := printer.PrintObj(obj, out); err != nil {
 | 
									if err := printer.PrintObj(obj, out); err != nil {
 | 
				
			||||||
					checkErr(fmt.Errorf("Unable to output the provided object: %v", err))
 | 
										checkErr(fmt.Errorf("unable to output the provided object: %v", err))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,7 +112,7 @@ func GetFilesFromDir(directory string, fileType string) []string {
 | 
				
			|||||||
// location or from stdin if location == "-".
 | 
					// location or from stdin if location == "-".
 | 
				
			||||||
func ReadConfigData(location string) ([]byte, error) {
 | 
					func ReadConfigData(location string) ([]byte, error) {
 | 
				
			||||||
	if len(location) == 0 {
 | 
						if len(location) == 0 {
 | 
				
			||||||
		return nil, fmt.Errorf("Location given but empty")
 | 
							return nil, fmt.Errorf("location given but empty")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if location == "-" {
 | 
						if location == "-" {
 | 
				
			||||||
@@ -138,21 +138,21 @@ func ReadConfigDataFromLocation(location string) ([]byte, error) {
 | 
				
			|||||||
	if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
						if strings.Index(location, "http://") == 0 || strings.Index(location, "https://") == 0 {
 | 
				
			||||||
		resp, err := http.Get(location)
 | 
							resp, err := http.Get(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to access URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to access URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		defer resp.Body.Close()
 | 
							defer resp.Body.Close()
 | 
				
			||||||
		if resp.StatusCode != 200 {
 | 
							if resp.StatusCode != 200 {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
								return nil, fmt.Errorf("unable to read URL, server reported %d %s", resp.StatusCode, resp.Status)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		data, err := ioutil.ReadAll(resp.Body)
 | 
							data, err := ioutil.ReadAll(resp.Body)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read URL %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read URL %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		data, err := ioutil.ReadFile(location)
 | 
							data, err := ioutil.ReadFile(location)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return nil, fmt.Errorf("Unable to read %s: %v\n", location, err)
 | 
								return nil, fmt.Errorf("unable to read %s: %v\n", location, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return data, nil
 | 
							return data, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,7 +60,7 @@ func ResourceFromArgsOrFile(cmd *cobra.Command, args []string, filename string,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	mapping, namespace, name, _ = ResourceFromFile(filename, typer, mapper)
 | 
						mapping, namespace, name, _ = ResourceFromFile(filename, typer, mapper)
 | 
				
			||||||
	if len(name) == 0 {
 | 
						if len(name) == 0 {
 | 
				
			||||||
		checkErr(fmt.Errorf("The resource in the provided file has no name (or ID) defined"))
 | 
							checkErr(fmt.Errorf("the resource in the provided file has no name (or ID) defined"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
@@ -132,7 +132,7 @@ func ResourceFromFile(filename string, typer runtime.ObjectTyper, mapper meta.RE
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// TODO: allow unversioned objects?
 | 
						// TODO: allow unversioned objects?
 | 
				
			||||||
	if len(version) == 0 {
 | 
						if len(version) == 0 {
 | 
				
			||||||
		checkErr(fmt.Errorf("The resource in the provided file has no apiVersion defined"))
 | 
							checkErr(fmt.Errorf("the resource in the provided file has no apiVersion defined"))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mapping, err = mapper.RESTMapping(version, kind)
 | 
						mapping, err = mapper.RESTMapping(version, kind)
 | 
				
			||||||
@@ -156,7 +156,7 @@ func ResourceFromFile(filename string, typer runtime.ObjectTyper, mapper meta.RE
 | 
				
			|||||||
func CompareNamespaceFromFile(cmd *cobra.Command, namespace string) error {
 | 
					func CompareNamespaceFromFile(cmd *cobra.Command, namespace string) error {
 | 
				
			||||||
	defaultNamespace := getKubeNamespace(cmd)
 | 
						defaultNamespace := getKubeNamespace(cmd)
 | 
				
			||||||
	if defaultNamespace != namespace {
 | 
						if defaultNamespace != namespace {
 | 
				
			||||||
		return fmt.Errorf("The namespace from the provided file %q does not match the namespace %q. You must pass '--namespace=%s' to perform this operation.", namespace, defaultNamespace, namespace)
 | 
							return fmt.Errorf("the namespace from the provided file %q does not match the namespace %q. You must pass '--namespace=%s' to perform this operation.", namespace, defaultNamespace, namespace)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,7 +52,7 @@ func NewSourceURL(url string, period time.Duration, updates chan<- interface{})
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (s *SourceURL) run() {
 | 
					func (s *SourceURL) run() {
 | 
				
			||||||
	if err := s.extractFromURL(); err != nil {
 | 
						if err := s.extractFromURL(); err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to read URL: %s", err)
 | 
							glog.Errorf("Failed to read URL: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -99,7 +99,7 @@ var dockerVersionWithExec = []uint{1, 1, 3}
 | 
				
			|||||||
func (d *dockerContainerCommandRunner) getDockerServerVersion() ([]uint, error) {
 | 
					func (d *dockerContainerCommandRunner) getDockerServerVersion() ([]uint, error) {
 | 
				
			||||||
	env, err := d.client.Version()
 | 
						env, err := d.client.Version()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("failed to get docker server version - %s", err)
 | 
							return nil, fmt.Errorf("failed to get docker server version - %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	version := []uint{}
 | 
						version := []uint{}
 | 
				
			||||||
	for _, entry := range *env {
 | 
						for _, entry := range *env {
 | 
				
			||||||
@@ -108,7 +108,7 @@ func (d *dockerContainerCommandRunner) getDockerServerVersion() ([]uint, error)
 | 
				
			|||||||
			for _, elem := range elems {
 | 
								for _, elem := range elems {
 | 
				
			||||||
				val, err := strconv.ParseUint(elem, 10, 32)
 | 
									val, err := strconv.ParseUint(elem, 10, 32)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					return nil, fmt.Errorf("failed to parse docker server version (%s) - %s", entry, err)
 | 
										return nil, fmt.Errorf("failed to parse docker server version %q: %v", entry, err)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				version = append(version, uint(val))
 | 
									version = append(version, uint(val))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -169,7 +169,7 @@ func (d *dockerContainerCommandRunner) RunInContainer(containerID string, cmd []
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	execObj, err := d.client.CreateExec(createOpts)
 | 
						execObj, err := d.client.CreateExec(createOpts)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("failed to run in container - Exec setup failed - %s", err)
 | 
							return nil, fmt.Errorf("failed to run in container - Exec setup failed - %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	var buf bytes.Buffer
 | 
						var buf bytes.Buffer
 | 
				
			||||||
	wrBuf := bufio.NewWriter(&buf)
 | 
						wrBuf := bufio.NewWriter(&buf)
 | 
				
			||||||
@@ -403,7 +403,7 @@ func inspectContainer(client DockerInterface, dockerID, containerName, tPath str
 | 
				
			|||||||
			if found {
 | 
								if found {
 | 
				
			||||||
				data, err := ioutil.ReadFile(path)
 | 
									data, err := ioutil.ReadFile(path)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					glog.Errorf("Error on reading termination-log %s(%v)", path, err)
 | 
										glog.Errorf("Error on reading termination-log %s: %v", path, err)
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					containerStatus.State.Termination.Message = string(data)
 | 
										containerStatus.State.Termination.Message = string(data)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -479,12 +479,12 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
 | 
				
			|||||||
	if len(container.TerminationMessagePath) != 0 {
 | 
						if len(container.TerminationMessagePath) != 0 {
 | 
				
			||||||
		p := path.Join(kl.rootDirectory, pod.Name, container.Name)
 | 
							p := path.Join(kl.rootDirectory, pod.Name, container.Name)
 | 
				
			||||||
		if err := os.MkdirAll(p, 0750); err != nil {
 | 
							if err := os.MkdirAll(p, 0750); err != nil {
 | 
				
			||||||
			glog.Errorf("Error on creating %s(%v)", p, err)
 | 
								glog.Errorf("Error on creating %s: %v", p, err)
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			containerLogPath := path.Join(p, dockerContainer.ID)
 | 
								containerLogPath := path.Join(p, dockerContainer.ID)
 | 
				
			||||||
			fs, err := os.Create(containerLogPath)
 | 
								fs, err := os.Create(containerLogPath)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Error on creating termination-log file: %s(%v)", containerLogPath, err)
 | 
									glog.Errorf("Error on creating termination-log file %s: %v", containerLogPath, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			defer fs.Close()
 | 
								defer fs.Close()
 | 
				
			||||||
			b := fmt.Sprintf("%s:%s", containerLogPath, container.TerminationMessagePath)
 | 
								b := fmt.Sprintf("%s:%s", containerLogPath, container.TerminationMessagePath)
 | 
				
			||||||
@@ -495,7 +495,7 @@ func (kl *Kubelet) runContainer(pod *api.BoundPod, container *api.Container, pod
 | 
				
			|||||||
	if capabilities.Get().AllowPrivileged {
 | 
						if capabilities.Get().AllowPrivileged {
 | 
				
			||||||
		privileged = container.Privileged
 | 
							privileged = container.Privileged
 | 
				
			||||||
	} else if container.Privileged {
 | 
						} else if container.Privileged {
 | 
				
			||||||
		return "", fmt.Errorf("Container requested privileged mode, but it is disallowed globally.")
 | 
							return "", fmt.Errorf("container requested privileged mode, but it is disallowed globally.")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = kl.dockerClient.StartContainer(dockerContainer.ID, &docker.HostConfig{
 | 
						err = kl.dockerClient.StartContainer(dockerContainer.ID, &docker.HostConfig{
 | 
				
			||||||
		PortBindings: portBindings,
 | 
							PortBindings: portBindings,
 | 
				
			||||||
@@ -606,7 +606,7 @@ func (kl *Kubelet) killContainersInPod(pod *api.BoundPod, dockerContainers docke
 | 
				
			|||||||
			go func() {
 | 
								go func() {
 | 
				
			||||||
				err := kl.killContainer(dockerContainer)
 | 
									err := kl.killContainer(dockerContainer)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					glog.Errorf("Failed to delete container. (%v)  Skipping pod %s", err, podFullName)
 | 
										glog.Errorf("Failed to delete container: %v; Skipping pod %s", err, podFullName)
 | 
				
			||||||
					errs <- err
 | 
										errs <- err
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				wg.Done()
 | 
									wg.Done()
 | 
				
			||||||
@@ -645,7 +645,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		netID, err = kl.createNetworkContainer(pod)
 | 
							netID, err = kl.createNetworkContainer(pod)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Failed to introspect network container. (%v)  Skipping pod %s", err, podFullName)
 | 
								glog.Errorf("Failed to introspect network container: %v; Skipping pod %s", err, podFullName)
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if count > 0 {
 | 
							if count > 0 {
 | 
				
			||||||
@@ -661,7 +661,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	podVolumes, err := kl.mountExternalVolumes(pod)
 | 
						podVolumes, err := kl.mountExternalVolumes(pod)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Unable to mount volumes for pod %s: (%v), skipping pod", podFullName, err)
 | 
							glog.Errorf("Unable to mount volumes for pod %s: %v; skipping pod", podFullName, err)
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -748,7 +748,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
 | 
				
			|||||||
				if ref != nil {
 | 
									if ref != nil {
 | 
				
			||||||
					record.Eventf(ref, "failed", "failed", "Failed to inspect image %s", container.Image)
 | 
										record.Eventf(ref, "failed", "failed", "Failed to inspect image %s", container.Image)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				glog.Errorf("Failed to inspect image: %s: %#v skipping pod %s container %s", container.Image, err, podFullName, container.Name)
 | 
									glog.Errorf("Failed to inspect image %s: %v; skipping pod %s container %s", container.Image, err, podFullName, container.Name)
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if api.IsPullAlways(container.ImagePullPolicy) ||
 | 
								if api.IsPullAlways(container.ImagePullPolicy) ||
 | 
				
			||||||
@@ -758,7 +758,7 @@ func (kl *Kubelet) syncPod(pod *api.BoundPod, dockerContainers dockertools.Docke
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
						record.Eventf(ref, "failed", "failed", "Failed to pull image %s", container.Image)
 | 
											record.Eventf(ref, "failed", "failed", "Failed to pull image %s", container.Image)
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					glog.Errorf("Failed to pull image %s: %v skipping pod %s container %s.", container.Image, err, podFullName, container.Name)
 | 
										glog.Errorf("Failed to pull image %s: %v; skipping pod %s container %s.", container.Image, err, podFullName, container.Name)
 | 
				
			||||||
					continue
 | 
										continue
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if ref != nil {
 | 
									if ref != nil {
 | 
				
			||||||
@@ -828,7 +828,7 @@ func (kl *Kubelet) reconcileVolumes(pods []api.BoundPod) error {
 | 
				
			|||||||
			//TODO (jonesdl) This should not block other kubelet synchronization procedures
 | 
								//TODO (jonesdl) This should not block other kubelet synchronization procedures
 | 
				
			||||||
			err := vol.TearDown()
 | 
								err := vol.TearDown()
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Could not tear down volume %s (%s)", name, err)
 | 
									glog.Errorf("Could not tear down volume %s: %v", name, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -865,7 +865,7 @@ func (kl *Kubelet) SyncPods(pods []api.BoundPod) error {
 | 
				
			|||||||
		kl.podWorkers.Run(podFullName, func() {
 | 
							kl.podWorkers.Run(podFullName, func() {
 | 
				
			||||||
			err := kl.syncPod(pod, dockerContainers)
 | 
								err := kl.syncPod(pod, dockerContainers)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Error syncing pod, skipping: %s", err)
 | 
									glog.Errorf("Error syncing pod, skipping: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -883,7 +883,7 @@ func (kl *Kubelet) SyncPods(pods []api.BoundPod) error {
 | 
				
			|||||||
			glog.V(1).Infof("Killing unwanted container %+v", pc)
 | 
								glog.V(1).Infof("Killing unwanted container %+v", pc)
 | 
				
			||||||
			err = kl.killContainer(container)
 | 
								err = kl.killContainer(container)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Error killing container %+v: %s", pc, err)
 | 
									glog.Errorf("Error killing container %+v: %v", pc, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -924,7 +924,7 @@ func filterHostPortConflicts(pods []api.BoundPod) []api.BoundPod {
 | 
				
			|||||||
	for i := range pods {
 | 
						for i := range pods {
 | 
				
			||||||
		pod := &pods[i]
 | 
							pod := &pods[i]
 | 
				
			||||||
		if errs := validation.AccumulateUniquePorts(pod.Spec.Containers, ports, extract); len(errs) != 0 {
 | 
							if errs := validation.AccumulateUniquePorts(pod.Spec.Containers, ports, extract); len(errs) != 0 {
 | 
				
			||||||
			glog.Warningf("Pod %s: HostPort is already allocated, ignoring: %s", GetPodFullName(pod), errs)
 | 
								glog.Warningf("Pod %s: HostPort is already allocated, ignoring: %v", GetPodFullName(pod), errs)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		filtered = append(filtered, *pod)
 | 
							filtered = append(filtered, *pod)
 | 
				
			||||||
@@ -964,7 +964,7 @@ func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		err := handler.SyncPods(kl.pods)
 | 
							err := handler.SyncPods(kl.pods)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Couldn't sync containers: %s", err)
 | 
								glog.Errorf("Couldn't sync containers: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -974,7 +974,7 @@ func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
 | 
				
			|||||||
func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error {
 | 
					func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail string, follow bool, stdout, stderr io.Writer) error {
 | 
				
			||||||
	_, err := kl.GetPodInfo(podFullName, "")
 | 
						_, err := kl.GetPodInfo(podFullName, "")
 | 
				
			||||||
	if err == dockertools.ErrNoContainersInPod {
 | 
						if err == dockertools.ErrNoContainersInPod {
 | 
				
			||||||
		return fmt.Errorf("Pod not found (%s)\n", podFullName)
 | 
							return fmt.Errorf("pod not found (%s)\n", podFullName)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	dockerContainers, err := dockertools.GetKubeletDockerContainers(kl.dockerClient, true)
 | 
						dockerContainers, err := dockertools.GetKubeletDockerContainers(kl.dockerClient, true)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -982,7 +982,7 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail stri
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	dockerContainer, found, _ := dockerContainers.FindPodContainer(podFullName, "", containerName)
 | 
						dockerContainer, found, _ := dockerContainers.FindPodContainer(podFullName, "", containerName)
 | 
				
			||||||
	if !found {
 | 
						if !found {
 | 
				
			||||||
		return fmt.Errorf("Container not found (%s)\n", containerName)
 | 
							return fmt.Errorf("container not found (%s)\n", containerName)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return dockertools.GetKubeletDockerContainerLogs(kl.dockerClient, dockerContainer.ID, tail, follow, stdout, stderr)
 | 
						return dockertools.GetKubeletDockerContainerLogs(kl.dockerClient, dockerContainer.ID, tail, follow, stdout, stderr)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,7 +218,7 @@ func (s *Server) handleContainerLogs(w http.ResponseWriter, req *http.Request) {
 | 
				
			|||||||
	if flusher, ok := fw.writer.(http.Flusher); ok {
 | 
						if flusher, ok := fw.writer.(http.Flusher); ok {
 | 
				
			||||||
		fw.flusher = flusher
 | 
							fw.flusher = flusher
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		s.error(w, fmt.Errorf("Unable to convert %v into http.Flusher", fw))
 | 
							s.error(w, fmt.Errorf("unable to convert %v into http.Flusher", fw))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	w.Header().Set("Transfer-Encoding", "chunked")
 | 
						w.Header().Set("Transfer-Encoding", "chunked")
 | 
				
			||||||
	w.WriteHeader(http.StatusOK)
 | 
						w.WriteHeader(http.StatusOK)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,7 @@ func (m *Master) createMasterServiceIfNeeded(serviceName string, port int) error
 | 
				
			|||||||
		// If all worked, we get back an *api.Service object.
 | 
							// If all worked, we get back an *api.Service object.
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return fmt.Errorf("Unexpected response: %#v", resp)
 | 
						return fmt.Errorf("unexpected response: %#v", resp)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ensureEndpointsContain sets the endpoints for the given service. Also removes
 | 
					// ensureEndpointsContain sets the endpoints for the given service. Also removes
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -135,7 +135,7 @@ func (s ConfigSourceEtcd) decodeServices(node *etcd.Node, retServices []api.Serv
 | 
				
			|||||||
	var svc api.Service
 | 
						var svc api.Service
 | 
				
			||||||
	err := latest.Codec.DecodeInto([]byte(node.Value), &svc)
 | 
						err := latest.Codec.DecodeInto([]byte(node.Value), &svc)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to load Service: %s (%#v)", node.Value, err)
 | 
							glog.Errorf("Failed to load Service: %s (%v)", node.Value, err)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// so we got a service we can handle, and now get endpoints
 | 
							// so we got a service we can handle, and now get endpoints
 | 
				
			||||||
		retServices = append(retServices, svc)
 | 
							retServices = append(retServices, svc)
 | 
				
			||||||
@@ -182,7 +182,7 @@ func (s ConfigSourceEtcd) GetEndpoints(namespace, service string) (api.Endpoints
 | 
				
			|||||||
	key := path.Join(registryRoot, "endpoints", namespace, service)
 | 
						key := path.Join(registryRoot, "endpoints", namespace, service)
 | 
				
			||||||
	response, err := s.client.Get(key, true, false)
 | 
						response, err := s.client.Get(key, true, false)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to get the key: %s %v", key, err)
 | 
							glog.Errorf("Failed to get the key %q: %v", key, err)
 | 
				
			||||||
		return api.Endpoints{}, err
 | 
							return api.Endpoints{}, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Parse all the endpoint specifications in this value.
 | 
						// Parse all the endpoint specifications in this value.
 | 
				
			||||||
@@ -256,7 +256,7 @@ func (s ConfigSourceEtcd) ProcessEndpointResponse(response *etcd.Response) {
 | 
				
			|||||||
	var endpoints api.Endpoints
 | 
						var endpoints api.Endpoints
 | 
				
			||||||
	err := latest.Codec.DecodeInto([]byte(response.Node.Value), &endpoints)
 | 
						err := latest.Codec.DecodeInto([]byte(response.Node.Value), &endpoints)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to parse service out of etcd key: %v : %+v", response.Node.Value, err)
 | 
							glog.Errorf("Failed to parse service out of etcd key: %v : %v", response.Node.Value, err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	endpointsUpdate := EndpointsUpdate{Op: ADD, Endpoints: []api.Endpoints{endpoints}}
 | 
						endpointsUpdate := EndpointsUpdate{Op: ADD, Endpoints: []api.Endpoints{endpoints}}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,7 +82,7 @@ func tryConnect(service string, srcAddr net.Addr, protocol string, proxier *Prox
 | 
				
			|||||||
	for _, retryTimeout := range endpointDialTimeout {
 | 
						for _, retryTimeout := range endpointDialTimeout {
 | 
				
			||||||
		endpoint, err := proxier.loadBalancer.NextEndpoint(service, srcAddr)
 | 
							endpoint, err := proxier.loadBalancer.NextEndpoint(service, srcAddr)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Couldn't find an endpoint for %s %v", service, err)
 | 
								glog.Errorf("Couldn't find an endpoint for %s: %v", service, err)
 | 
				
			||||||
			return nil, err
 | 
								return nil, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		glog.V(3).Infof("Mapped service %q to endpoint %s", service, endpoint)
 | 
							glog.V(3).Infof("Mapped service %q to endpoint %s", service, endpoint)
 | 
				
			||||||
@@ -296,7 +296,7 @@ func newProxySocket(protocol api.Protocol, ip net.IP, port int) (proxySocket, er
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		return &udpProxySocket{conn}, nil
 | 
							return &udpProxySocket{conn}, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil, fmt.Errorf("Unknown protocol %q", protocol)
 | 
						return nil, fmt.Errorf("unknown protocol %q", protocol)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Proxier is a simple proxy for TCP connections between a localhost:lport
 | 
					// Proxier is a simple proxy for TCP connections between a localhost:lport
 | 
				
			||||||
@@ -316,13 +316,13 @@ func NewProxier(loadBalancer LoadBalancer, listenAddress net.IP, iptables iptabl
 | 
				
			|||||||
	glog.Infof("Initializing iptables")
 | 
						glog.Infof("Initializing iptables")
 | 
				
			||||||
	// Set up the iptables foundations we need.
 | 
						// Set up the iptables foundations we need.
 | 
				
			||||||
	if err := iptablesInit(iptables); err != nil {
 | 
						if err := iptablesInit(iptables); err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to initialize iptables: %s", err)
 | 
							glog.Errorf("Failed to initialize iptables: %v", err)
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Flush old iptables rules (since the bound ports will be invalid after a restart).
 | 
						// Flush old iptables rules (since the bound ports will be invalid after a restart).
 | 
				
			||||||
	// When OnUpdate() is first called, the rules will be recreated.
 | 
						// When OnUpdate() is first called, the rules will be recreated.
 | 
				
			||||||
	if err := iptablesFlush(iptables); err != nil {
 | 
						if err := iptablesFlush(iptables); err != nil {
 | 
				
			||||||
		glog.Errorf("Failed to flush iptables: %s", err)
 | 
							glog.Errorf("Failed to flush iptables: %v", err)
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return &Proxier{
 | 
						return &Proxier{
 | 
				
			||||||
@@ -343,7 +343,7 @@ func (proxier *Proxier) SyncLoop() {
 | 
				
			|||||||
		case <-time.After(syncInterval):
 | 
							case <-time.After(syncInterval):
 | 
				
			||||||
			glog.V(2).Infof("Periodic sync")
 | 
								glog.V(2).Infof("Periodic sync")
 | 
				
			||||||
			if err := iptablesInit(proxier.iptables); err != nil {
 | 
								if err := iptablesInit(proxier.iptables); err != nil {
 | 
				
			||||||
				glog.Errorf("Failed to ensure iptables: %s", err)
 | 
									glog.Errorf("Failed to ensure iptables: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			proxier.ensurePortals()
 | 
								proxier.ensurePortals()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -358,7 +358,7 @@ func (proxier *Proxier) ensurePortals() {
 | 
				
			|||||||
	for name, info := range proxier.serviceMap {
 | 
						for name, info := range proxier.serviceMap {
 | 
				
			||||||
		err := proxier.openPortal(name, info)
 | 
							err := proxier.openPortal(name, info)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Failed to ensure portal for %q: %s", name, err)
 | 
								glog.Errorf("Failed to ensure portal for %q: %v", name, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -449,17 +449,17 @@ func (proxier *Proxier) OnUpdate(services []api.Service) {
 | 
				
			|||||||
			glog.V(4).Infof("Something changed for service %q: stopping it", service.Name)
 | 
								glog.V(4).Infof("Something changed for service %q: stopping it", service.Name)
 | 
				
			||||||
			err := proxier.closePortal(service.Name, info)
 | 
								err := proxier.closePortal(service.Name, info)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Failed to close portal for %q: %s", service.Name, err)
 | 
									glog.Errorf("Failed to close portal for %q: %v", service.Name, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			err = proxier.stopProxy(service.Name, info)
 | 
								err = proxier.stopProxy(service.Name, info)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Failed to stop service %q: %s", service.Name, err)
 | 
									glog.Errorf("Failed to stop service %q: %v", service.Name, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		glog.V(1).Infof("Adding new service %q at %s:%d/%s (local :%d)", service.Name, serviceIP, service.Spec.Port, service.Spec.Protocol, service.Spec.ProxyPort)
 | 
							glog.V(1).Infof("Adding new service %q at %s:%d/%s (local :%d)", service.Name, serviceIP, service.Spec.Port, service.Spec.Protocol, service.Spec.ProxyPort)
 | 
				
			||||||
		info, err := proxier.addServiceOnPort(service.Name, service.Spec.Protocol, service.Spec.ProxyPort, udpIdleTimeout)
 | 
							info, err := proxier.addServiceOnPort(service.Name, service.Spec.Protocol, service.Spec.ProxyPort, udpIdleTimeout)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Failed to start proxy for %q: %+v", service.Name, err)
 | 
								glog.Errorf("Failed to start proxy for %q: %v", service.Name, err)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		info.portalIP = serviceIP
 | 
							info.portalIP = serviceIP
 | 
				
			||||||
@@ -469,7 +469,7 @@ func (proxier *Proxier) OnUpdate(services []api.Service) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		err = proxier.openPortal(service.Name, info)
 | 
							err = proxier.openPortal(service.Name, info)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Failed to open portal for %q: %s", service.Name, err)
 | 
								glog.Errorf("Failed to open portal for %q: %v", service.Name, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	proxier.mu.Lock()
 | 
						proxier.mu.Lock()
 | 
				
			||||||
@@ -479,11 +479,11 @@ func (proxier *Proxier) OnUpdate(services []api.Service) {
 | 
				
			|||||||
			glog.V(1).Infof("Stopping service %q", name)
 | 
								glog.V(1).Infof("Stopping service %q", name)
 | 
				
			||||||
			err := proxier.closePortal(name, info)
 | 
								err := proxier.closePortal(name, info)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Failed to close portal for %q: %s", name, err)
 | 
									glog.Errorf("Failed to close portal for %q: %v", name, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			err = proxier.stopProxyInternal(name, info)
 | 
								err = proxier.stopProxyInternal(name, info)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Failed to stop service %q: %s", name, err)
 | 
									glog.Errorf("Failed to stop service %q: %v", name, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ func (r *udpEchoServer) Loop() {
 | 
				
			|||||||
	for {
 | 
						for {
 | 
				
			||||||
		n, cliAddr, err := r.ReadFrom(buffer[0:])
 | 
							n, cliAddr, err := r.ReadFrom(buffer[0:])
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			fmt.Printf("ReadFrom failed: %#v\n", err)
 | 
								fmt.Printf("ReadFrom failed: %v\n", err)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		r.WriteTo(buffer[0:n], cliAddr)
 | 
							r.WriteTo(buffer[0:n], cliAddr)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -76,5 +76,5 @@ func (b *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RES
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Update returns an error-- this object may not be updated.
 | 
					// Update returns an error-- this object may not be updated.
 | 
				
			||||||
func (b *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) {
 | 
					func (b *REST) Update(ctx api.Context, obj runtime.Object) (<-chan apiserver.RESTResult, error) {
 | 
				
			||||||
	return nil, fmt.Errorf("Bindings may not be changed.")
 | 
						return nil, fmt.Errorf("bindings may not be changed.")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,10 +77,10 @@ func MakeEtcdItemKey(ctx api.Context, prefix string, id string) (string, error)
 | 
				
			|||||||
	key := MakeEtcdListKey(ctx, prefix)
 | 
						key := MakeEtcdListKey(ctx, prefix)
 | 
				
			||||||
	ns, ok := api.NamespaceFrom(ctx)
 | 
						ns, ok := api.NamespaceFrom(ctx)
 | 
				
			||||||
	if !ok || len(ns) == 0 {
 | 
						if !ok || len(ns) == 0 {
 | 
				
			||||||
		return "", fmt.Errorf("Invalid request.  Namespace parameter required.")
 | 
							return "", fmt.Errorf("invalid request.  Namespace parameter required.")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(id) == 0 {
 | 
						if len(id) == 0 {
 | 
				
			||||||
		return "", fmt.Errorf("Invalid request.  Id parameter required.")
 | 
							return "", fmt.Errorf("invalid request.  Id parameter required.")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	key = key + "/" + id
 | 
						key = key + "/" + id
 | 
				
			||||||
	return key, nil
 | 
						return key, nil
 | 
				
			||||||
@@ -212,7 +212,7 @@ func (r *Registry) assignPod(ctx api.Context, podID string, machine string) erro
 | 
				
			|||||||
		boundPodList := in.(*api.BoundPods)
 | 
							boundPodList := in.(*api.BoundPods)
 | 
				
			||||||
		boundPodList.Items = append(boundPodList.Items, *boundPod)
 | 
							boundPodList.Items = append(boundPodList.Items, *boundPod)
 | 
				
			||||||
		if !constraint.Allowed(boundPodList.Items) {
 | 
							if !constraint.Allowed(boundPodList.Items) {
 | 
				
			||||||
			return nil, fmt.Errorf("The assignment would cause a constraint violation")
 | 
								return nil, fmt.Errorf("the assignment would cause a constraint violation")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return boundPodList, nil
 | 
							return boundPodList, nil
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
@@ -268,7 +268,7 @@ func (r *Registry) UpdatePod(ctx api.Context, pod *api.Pod) error {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		// This really shouldn't happen
 | 
							// This really shouldn't happen
 | 
				
			||||||
		glog.Warningf("Couldn't find: %s in %#v", pod.Name, boundPods)
 | 
							glog.Warningf("Couldn't find: %s in %#v", pod.Name, boundPods)
 | 
				
			||||||
		return boundPods, fmt.Errorf("Failed to update pod, couldn't find %s in %#v", pod.Name, boundPods)
 | 
							return boundPods, fmt.Errorf("failed to update pod, couldn't find %s in %#v", pod.Name, boundPods)
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -75,7 +75,7 @@ func (r *HealthyRegistry) ListMinions(ctx api.Context) (currentMinions *api.Mini
 | 
				
			|||||||
	for _, minion := range list.Items {
 | 
						for _, minion := range list.Items {
 | 
				
			||||||
		status, err := r.client.HealthCheck(minion.Name)
 | 
							status, err := r.client.HealthCheck(minion.Name)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.V(1).Infof("%#v failed health check with error: %s", minion, err)
 | 
								glog.V(1).Infof("%#v failed health check with error: %v", minion, err)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if status == health.Healthy {
 | 
							if status == health.Healthy {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -207,14 +207,14 @@ func (rs *REST) fillPodInfo(pod *api.Pod) {
 | 
				
			|||||||
		info, err := rs.podCache.GetPodInfo(pod.Status.Host, pod.Namespace, pod.Name)
 | 
							info, err := rs.podCache.GetPodInfo(pod.Status.Host, pod.Namespace, pod.Name)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			if err != client.ErrPodInfoNotAvailable {
 | 
								if err != client.ErrPodInfoNotAvailable {
 | 
				
			||||||
				glog.Errorf("Error getting container info from cache: %#v", err)
 | 
									glog.Errorf("Error getting container info from cache: %v", err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if rs.podInfoGetter != nil {
 | 
								if rs.podInfoGetter != nil {
 | 
				
			||||||
				info, err = rs.podInfoGetter.GetPodInfo(pod.Status.Host, pod.Namespace, pod.Name)
 | 
									info, err = rs.podInfoGetter.GetPodInfo(pod.Status.Host, pod.Namespace, pod.Name)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				if err != client.ErrPodInfoNotAvailable {
 | 
									if err != client.ErrPodInfoNotAvailable {
 | 
				
			||||||
					glog.Errorf("Error getting fresh container info: %#v", err)
 | 
										glog.Errorf("Error getting fresh container info: %v", err)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -258,7 +258,7 @@ func getInstanceIPFromCloud(cloud cloudprovider.Interface, host string) string {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	addr, err := instances.IPAddress(host)
 | 
						addr, err := instances.IPAddress(host)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Error getting instance IP for %q: %#v", host, err)
 | 
							glog.Errorf("Error getting instance IP for %q: %v", host, err)
 | 
				
			||||||
		return ""
 | 
							return ""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return addr.String()
 | 
						return addr.String()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -65,7 +65,7 @@ func reloadIPsFromStorage(ipa *ipAllocator, registry Registry) {
 | 
				
			|||||||
	services, err := registry.ListServices(api.NewContext())
 | 
						services, err := registry.ListServices(api.NewContext())
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		// This is really bad.
 | 
							// This is really bad.
 | 
				
			||||||
		glog.Errorf("can't list services to init service REST: %s", err)
 | 
							glog.Errorf("can't list services to init service REST: %v", err)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for i := range services.Items {
 | 
						for i := range services.Items {
 | 
				
			||||||
@@ -76,7 +76,7 @@ func reloadIPsFromStorage(ipa *ipAllocator, registry Registry) {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		if err := ipa.Allocate(net.ParseIP(service.Spec.PortalIP)); err != nil {
 | 
							if err := ipa.Allocate(net.ParseIP(service.Spec.PortalIP)); err != nil {
 | 
				
			||||||
			// This is really bad.
 | 
								// This is really bad.
 | 
				
			||||||
			glog.Errorf("service %q PortalIP %s could not be allocated: %s", service.Name, service.Spec.PortalIP, err)
 | 
								glog.Errorf("service %q PortalIP %s could not be allocated: %v", service.Name, service.Spec.PortalIP, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -119,11 +119,11 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			balancer, ok := rs.cloud.TCPLoadBalancer()
 | 
								balancer, ok := rs.cloud.TCPLoadBalancer()
 | 
				
			||||||
			if !ok {
 | 
								if !ok {
 | 
				
			||||||
				return nil, fmt.Errorf("The cloud provider does not support external TCP load balancers.")
 | 
									return nil, fmt.Errorf("the cloud provider does not support external TCP load balancers.")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			zones, ok := rs.cloud.Zones()
 | 
								zones, ok := rs.cloud.Zones()
 | 
				
			||||||
			if !ok {
 | 
								if !ok {
 | 
				
			||||||
				return nil, fmt.Errorf("The cloud provider does not support zone enumeration.")
 | 
									return nil, fmt.Errorf("the cloud provider does not support zone enumeration.")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			hosts, err := rs.machines.ListMinions(ctx)
 | 
								hosts, err := rs.machines.ListMinions(ctx)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -711,7 +711,7 @@ func TestCreateServiceWithConflictingNamespace(t *testing.T) {
 | 
				
			|||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
		t.Errorf("Expected an error, but we didn't get one")
 | 
							t.Errorf("Expected an error, but we didn't get one")
 | 
				
			||||||
	} else if strings.Index(err.Error(), "Service.Namespace does not match the provided context") == -1 {
 | 
						} else if strings.Index(err.Error(), "Service.Namespace does not match the provided context") == -1 {
 | 
				
			||||||
		t.Errorf("Expected 'Service.Namespace does not match the provided context' error, got '%v'", err.Error())
 | 
							t.Errorf("Expected 'Service.Namespace does not match the provided context' error, got '%s'", err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -729,6 +729,6 @@ func TestUpdateServiceWithConflictingNamespace(t *testing.T) {
 | 
				
			|||||||
	if err == nil {
 | 
						if err == nil {
 | 
				
			||||||
		t.Errorf("Expected an error, but we didn't get one")
 | 
							t.Errorf("Expected an error, but we didn't get one")
 | 
				
			||||||
	} else if strings.Index(err.Error(), "Service.Namespace does not match the provided context") == -1 {
 | 
						} else if strings.Index(err.Error(), "Service.Namespace does not match the provided context") == -1 {
 | 
				
			||||||
		t.Errorf("Expected 'Service.Namespace does not match the provided context' error, got '%v'", err.Error())
 | 
							t.Errorf("Expected 'Service.Namespace does not match the provided context' error, got '%s'", err.Error())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -86,7 +86,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
 | 
				
			|||||||
					},
 | 
										},
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				glog.Errorf("Error getting endpoints: %#v", err)
 | 
									glog.Errorf("Error getting endpoints: %v", err)
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -106,7 +106,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
 | 
				
			|||||||
			_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)
 | 
								_, err = e.client.Endpoints(service.Namespace).Update(newEndpoints)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Error updating endpoints: %#v", err)
 | 
								glog.Errorf("Error updating endpoints: %v", err)
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -378,7 +378,7 @@ func checkEtcd(host string) error {
 | 
				
			|||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !strings.HasPrefix("etcd", string(body)) {
 | 
						if !strings.HasPrefix("etcd", string(body)) {
 | 
				
			||||||
		return fmt.Errorf("Unknown server: %s", string(body))
 | 
							return fmt.Errorf("unknown server: %s", string(body))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -167,7 +167,7 @@ func etcdGetInitialWatchState(client EtcdGetSet, key string, recursive bool, inc
 | 
				
			|||||||
	resp, err := client.Get(key, false, recursive)
 | 
						resp, err := client.Get(key, false, recursive)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		if !IsEtcdNotFound(err) {
 | 
							if !IsEtcdNotFound(err) {
 | 
				
			||||||
			glog.Errorf("watch was unable to retrieve the current index for the provided key: %v (%#v)", err, key)
 | 
								glog.Errorf("watch was unable to retrieve the current index for the provided key (%q): %v", key, err)
 | 
				
			||||||
			return resourceVersion, err
 | 
								return resourceVersion, err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if index, ok := etcdErrorIndex(err); ok {
 | 
							if index, ok := etcdErrorIndex(err); ok {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ import (
 | 
				
			|||||||
func bindata_read(data []byte, name string) ([]byte, error) {
 | 
					func bindata_read(data []byte, name string) ([]byte, error) {
 | 
				
			||||||
	gz, err := gzip.NewReader(bytes.NewBuffer(data))
 | 
						gz, err := gzip.NewReader(bytes.NewBuffer(data))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Read %q: %v", name, err)
 | 
							return nil, fmt.Errorf("read %q: %v", name, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var buf bytes.Buffer
 | 
						var buf bytes.Buffer
 | 
				
			||||||
@@ -35,7 +35,7 @@ func bindata_read(data []byte, name string) ([]byte, error) {
 | 
				
			|||||||
	gz.Close()
 | 
						gz.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Read %q: %v", name, err)
 | 
							return nil, fmt.Errorf("read %q: %v", name, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return buf.Bytes(), nil
 | 
						return buf.Bytes(), nil
 | 
				
			||||||
@@ -2694,7 +2694,7 @@ func Asset(name string) ([]byte, error) {
 | 
				
			|||||||
	if f, ok := _bindata[cannonicalName]; ok {
 | 
						if f, ok := _bindata[cannonicalName]; ok {
 | 
				
			||||||
		return f()
 | 
							return f()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil, fmt.Errorf("Asset %s not found", name)
 | 
						return nil, fmt.Errorf("asset %s not found", name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// AssetNames returns the names of the assets.
 | 
					// AssetNames returns the names of the assets.
 | 
				
			||||||
@@ -2739,12 +2739,12 @@ func AssetDir(name string) ([]string, error) {
 | 
				
			|||||||
		for _, p := range pathList {
 | 
							for _, p := range pathList {
 | 
				
			||||||
			node = node.Children[p]
 | 
								node = node.Children[p]
 | 
				
			||||||
			if node == nil {
 | 
								if node == nil {
 | 
				
			||||||
				return nil, fmt.Errorf("Asset %s not found", name)
 | 
									return nil, fmt.Errorf("asset %s not found", name)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if node.Func != nil {
 | 
						if node.Func != nil {
 | 
				
			||||||
		return nil, fmt.Errorf("Asset %s not found", name)
 | 
							return nil, fmt.Errorf("asset %s not found", name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	rv := make([]string, 0, len(node.Children))
 | 
						rv := make([]string, 0, len(node.Children))
 | 
				
			||||||
	for name := range node.Children {
 | 
						for name := range node.Children {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ func TestExecutorNoArgs(t *testing.T) {
 | 
				
			|||||||
	cmd := ex.Command("true")
 | 
						cmd := ex.Command("true")
 | 
				
			||||||
	out, err := cmd.CombinedOutput()
 | 
						out, err := cmd.CombinedOutput()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if len(out) != 0 {
 | 
						if len(out) != 0 {
 | 
				
			||||||
		t.Errorf("expected no output, got %q", string(out))
 | 
							t.Errorf("expected no output, got %q", string(out))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,7 +68,7 @@ func (f *FakeHandler) ServeHTTP(response http.ResponseWriter, request *http.Requ
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	bodyReceived, err := ioutil.ReadAll(request.Body)
 | 
						bodyReceived, err := ioutil.ReadAll(request.Body)
 | 
				
			||||||
	if err != nil && f.T != nil {
 | 
						if err != nil && f.T != nil {
 | 
				
			||||||
		f.T.Logf("Received read error: %#v", err)
 | 
							f.T.Logf("Received read error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	f.RequestBody = string(bodyReceived)
 | 
						f.RequestBody = string(bodyReceived)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -89,7 +89,7 @@ func (runner *runner) EnsureChain(table Table, chain Chain) (bool, error) {
 | 
				
			|||||||
				return true, nil
 | 
									return true, nil
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return false, fmt.Errorf("error creating chain %q: %s: %s", chain, err, out)
 | 
							return false, fmt.Errorf("error creating chain %q: %v: %s", chain, err, out)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return false, nil
 | 
						return false, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -103,7 +103,7 @@ func (runner *runner) FlushChain(table Table, chain Chain) error {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	out, err := runner.run(opFlushChain, fullArgs)
 | 
						out, err := runner.run(opFlushChain, fullArgs)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("error flushing chain %q: %s: %s", chain, err, out)
 | 
							return fmt.Errorf("error flushing chain %q: %v: %s", chain, err, out)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -124,7 +124,7 @@ func (runner *runner) EnsureRule(table Table, chain Chain, args ...string) (bool
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	out, err := runner.run(opAppendRule, fullArgs)
 | 
						out, err := runner.run(opAppendRule, fullArgs)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return false, fmt.Errorf("error appending rule: %s: %s", err, out)
 | 
							return false, fmt.Errorf("error appending rule: %v: %s", err, out)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return false, nil
 | 
						return false, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -145,7 +145,7 @@ func (runner *runner) DeleteRule(table Table, chain Chain, args ...string) error
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	out, err := runner.run(opDeleteRule, fullArgs)
 | 
						out, err := runner.run(opDeleteRule, fullArgs)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("error deleting rule: %s: %s", err, out)
 | 
							return fmt.Errorf("error deleting rule: %v: %s", err, out)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -191,7 +191,7 @@ func (runner *runner) checkRule(table Table, chain Chain, args ...string) (bool,
 | 
				
			|||||||
func (runner *runner) checkRuleWithoutCheck(table Table, chain Chain, args ...string) (bool, error) {
 | 
					func (runner *runner) checkRuleWithoutCheck(table Table, chain Chain, args ...string) (bool, error) {
 | 
				
			||||||
	out, err := runner.exec.Command("iptables-save", "-t", string(table)).CombinedOutput()
 | 
						out, err := runner.exec.Command("iptables-save", "-t", string(table)).CombinedOutput()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return false, fmt.Errorf("error checking rule: %s", err)
 | 
							return false, fmt.Errorf("error checking rule: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	argset := util.NewStringSet(args...)
 | 
						argset := util.NewStringSet(args...)
 | 
				
			||||||
@@ -225,7 +225,7 @@ func (runner *runner) checkRuleUsingCheck(args []string) (bool, error) {
 | 
				
			|||||||
			return false, nil
 | 
								return false, nil
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return false, fmt.Errorf("error checking rule: %s: %s", err, out)
 | 
						return false, fmt.Errorf("error checking rule: %v: %s", err, out)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type operation string
 | 
					type operation string
 | 
				
			||||||
@@ -263,7 +263,7 @@ func extractIptablesVersion(str string) (int, int, int, error) {
 | 
				
			|||||||
	versionMatcher := regexp.MustCompile("v([0-9]+)\\.([0-9]+)\\.([0-9]+)")
 | 
						versionMatcher := regexp.MustCompile("v([0-9]+)\\.([0-9]+)\\.([0-9]+)")
 | 
				
			||||||
	result := versionMatcher.FindStringSubmatch(str)
 | 
						result := versionMatcher.FindStringSubmatch(str)
 | 
				
			||||||
	if result == nil {
 | 
						if result == nil {
 | 
				
			||||||
		return 0, 0, 0, fmt.Errorf("No iptables version found in string: %s", str)
 | 
							return 0, 0, 0, fmt.Errorf("no iptables version found in string: %s", str)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	v1, err := strconv.Atoi(result[1])
 | 
						v1, err := strconv.Atoi(result[1])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,7 +55,7 @@ func testEnsureChain(t *testing.T, protocol Protocol) {
 | 
				
			|||||||
	// Success.
 | 
						// Success.
 | 
				
			||||||
	exists, err := runner.EnsureChain(TableNAT, Chain("FOOBAR"))
 | 
						exists, err := runner.EnsureChain(TableNAT, Chain("FOOBAR"))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if exists {
 | 
						if exists {
 | 
				
			||||||
		t.Errorf("expected exists = false")
 | 
							t.Errorf("expected exists = false")
 | 
				
			||||||
@@ -70,7 +70,7 @@ func testEnsureChain(t *testing.T, protocol Protocol) {
 | 
				
			|||||||
	// Exists.
 | 
						// Exists.
 | 
				
			||||||
	exists, err = runner.EnsureChain(TableNAT, Chain("FOOBAR"))
 | 
						exists, err = runner.EnsureChain(TableNAT, Chain("FOOBAR"))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !exists {
 | 
						if !exists {
 | 
				
			||||||
		t.Errorf("expected exists = true")
 | 
							t.Errorf("expected exists = true")
 | 
				
			||||||
@@ -109,7 +109,7 @@ func TestFlushChain(t *testing.T) {
 | 
				
			|||||||
	// Success.
 | 
						// Success.
 | 
				
			||||||
	err := runner.FlushChain(TableNAT, Chain("FOOBAR"))
 | 
						err := runner.FlushChain(TableNAT, Chain("FOOBAR"))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if fcmd.CombinedOutputCalls != 1 {
 | 
						if fcmd.CombinedOutputCalls != 1 {
 | 
				
			||||||
		t.Errorf("expected 1 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls)
 | 
							t.Errorf("expected 1 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls)
 | 
				
			||||||
@@ -144,7 +144,7 @@ func TestEnsureRuleAlreadyExists(t *testing.T) {
 | 
				
			|||||||
	runner := New(&fexec, ProtocolIpv4)
 | 
						runner := New(&fexec, ProtocolIpv4)
 | 
				
			||||||
	exists, err := runner.EnsureRule(TableNAT, ChainOutput, "abc", "123")
 | 
						exists, err := runner.EnsureRule(TableNAT, ChainOutput, "abc", "123")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !exists {
 | 
						if !exists {
 | 
				
			||||||
		t.Errorf("expected exists = true")
 | 
							t.Errorf("expected exists = true")
 | 
				
			||||||
@@ -180,7 +180,7 @@ func TestEnsureRuleNew(t *testing.T) {
 | 
				
			|||||||
	runner := New(&fexec, ProtocolIpv4)
 | 
						runner := New(&fexec, ProtocolIpv4)
 | 
				
			||||||
	exists, err := runner.EnsureRule(TableNAT, ChainOutput, "abc", "123")
 | 
						exists, err := runner.EnsureRule(TableNAT, ChainOutput, "abc", "123")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if exists {
 | 
						if exists {
 | 
				
			||||||
		t.Errorf("expected exists = false")
 | 
							t.Errorf("expected exists = false")
 | 
				
			||||||
@@ -270,7 +270,7 @@ func TestDeleteRuleAlreadyExists(t *testing.T) {
 | 
				
			|||||||
	runner := New(&fexec, ProtocolIpv4)
 | 
						runner := New(&fexec, ProtocolIpv4)
 | 
				
			||||||
	err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
 | 
						err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if fcmd.CombinedOutputCalls != 2 {
 | 
						if fcmd.CombinedOutputCalls != 2 {
 | 
				
			||||||
		t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls)
 | 
							t.Errorf("expected 2 CombinedOutput() call, got %d", fcmd.CombinedOutputCalls)
 | 
				
			||||||
@@ -303,7 +303,7 @@ func TestDeleteRuleNew(t *testing.T) {
 | 
				
			|||||||
	runner := New(&fexec, ProtocolIpv4)
 | 
						runner := New(&fexec, ProtocolIpv4)
 | 
				
			||||||
	err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
 | 
						err := runner.DeleteRule(TableNAT, ChainOutput, "abc", "123")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if fcmd.CombinedOutputCalls != 3 {
 | 
						if fcmd.CombinedOutputCalls != 3 {
 | 
				
			||||||
		t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
 | 
							t.Errorf("expected 3 CombinedOutput() calls, got %d", fcmd.CombinedOutputCalls)
 | 
				
			||||||
@@ -488,7 +488,7 @@ COMMIT
 | 
				
			|||||||
	runner := &runner{exec: &fexec}
 | 
						runner := &runner{exec: &fexec}
 | 
				
			||||||
	exists, err := runner.checkRuleWithoutCheck(TableNAT, ChainPrerouting, "-m", "addrtype", "-j", "DOCKER", "--dst-type", "LOCAL")
 | 
						exists, err := runner.checkRuleWithoutCheck(TableNAT, ChainPrerouting, "-m", "addrtype", "-j", "DOCKER", "--dst-type", "LOCAL")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !exists {
 | 
						if !exists {
 | 
				
			||||||
		t.Errorf("expected exists = true")
 | 
							t.Errorf("expected exists = true")
 | 
				
			||||||
@@ -526,7 +526,7 @@ COMMIT
 | 
				
			|||||||
	runner := &runner{exec: &fexec}
 | 
						runner := &runner{exec: &fexec}
 | 
				
			||||||
	exists, err := runner.checkRuleWithoutCheck(TableNAT, ChainPrerouting, "-m", "addrtype", "-j", "DOCKER")
 | 
						exists, err := runner.checkRuleWithoutCheck(TableNAT, ChainPrerouting, "-m", "addrtype", "-j", "DOCKER")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Errorf("expected success, got %+v", err)
 | 
							t.Errorf("expected success, got %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if exists {
 | 
						if exists {
 | 
				
			||||||
		t.Errorf("expected exists = false")
 | 
							t.Errorf("expected exists = false")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -131,7 +131,7 @@ func (g *GitDir) SetUp() error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(files) != 1 {
 | 
						if len(files) != 1 {
 | 
				
			||||||
		return fmt.Errorf("Unexpected directory contents: %v", files)
 | 
							return fmt.Errorf("unexpected directory contents: %v", files)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	dir := path.Join(g.GetPath(), files[0].Name())
 | 
						dir := path.Join(g.GetPath(), files[0].Name())
 | 
				
			||||||
	if _, err := g.ExecCommand("git", []string{"checkout", g.Revision}, dir); err != nil {
 | 
						if _, err := g.ExecCommand("git", []string{"checkout", g.Revision}, dir); err != nil {
 | 
				
			||||||
@@ -389,7 +389,7 @@ func GetCurrentVolumes(rootDirectory string) map[string]Cleaner {
 | 
				
			|||||||
	currentVolumes := make(map[string]Cleaner)
 | 
						currentVolumes := make(map[string]Cleaner)
 | 
				
			||||||
	podIDDirs, err := ioutil.ReadDir(rootDirectory)
 | 
						podIDDirs, err := ioutil.ReadDir(rootDirectory)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		glog.Errorf("Could not read directory: %s, (%s)", rootDirectory, err)
 | 
							glog.Errorf("Could not read directory %s: %v", rootDirectory, err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Volume information is extracted from the directory structure:
 | 
						// Volume information is extracted from the directory structure:
 | 
				
			||||||
	// (ROOT_DIR)/(POD_ID)/volumes/(VOLUME_KIND)/(VOLUME_NAME)
 | 
						// (ROOT_DIR)/(POD_ID)/volumes/(VOLUME_KIND)/(VOLUME_NAME)
 | 
				
			||||||
@@ -404,14 +404,14 @@ func GetCurrentVolumes(rootDirectory string) map[string]Cleaner {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		volumeKindDirs, err := ioutil.ReadDir(podIDPath)
 | 
							volumeKindDirs, err := ioutil.ReadDir(podIDPath)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			glog.Errorf("Could not read directory: %s, (%s)", podIDPath, err)
 | 
								glog.Errorf("Could not read directory %s: %v", podIDPath, err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		for _, volumeKindDir := range volumeKindDirs {
 | 
							for _, volumeKindDir := range volumeKindDirs {
 | 
				
			||||||
			volumeKind := volumeKindDir.Name()
 | 
								volumeKind := volumeKindDir.Name()
 | 
				
			||||||
			volumeKindPath := path.Join(podIDPath, volumeKind)
 | 
								volumeKindPath := path.Join(podIDPath, volumeKind)
 | 
				
			||||||
			volumeNameDirs, err := ioutil.ReadDir(volumeKindPath)
 | 
								volumeNameDirs, err := ioutil.ReadDir(volumeKindPath)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
				glog.Errorf("Could not read directory: %s, (%s)", volumeKindPath, err)
 | 
									glog.Errorf("Could not read directory %s: %v", volumeKindPath, err)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for _, volumeNameDir := range volumeNameDirs {
 | 
								for _, volumeNameDir := range volumeNameDirs {
 | 
				
			||||||
				volumeName := volumeNameDir.Name()
 | 
									volumeName := volumeNameDir.Name()
 | 
				
			||||||
@@ -419,7 +419,7 @@ func GetCurrentVolumes(rootDirectory string) map[string]Cleaner {
 | 
				
			|||||||
				// TODO(thockin) This should instead return a reference to an extant volume object
 | 
									// TODO(thockin) This should instead return a reference to an extant volume object
 | 
				
			||||||
				cleaner, err := CreateVolumeCleaner(volumeKind, volumeName, podID, rootDirectory)
 | 
									cleaner, err := CreateVolumeCleaner(volumeKind, volumeName, podID, rootDirectory)
 | 
				
			||||||
				if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
					glog.Errorf("Could not create volume cleaner: %s, (%s)", volumeNameDir.Name(), err)
 | 
										glog.Errorf("Could not create volume cleaner for %s: %v", volumeNameDir.Name(), err)
 | 
				
			||||||
					continue
 | 
										continue
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				currentVolumes[identifier] = cleaner
 | 
									currentVolumes[identifier] = cleaner
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,7 +150,7 @@ func TestCreateVolumeCleaners(t *testing.T) {
 | 
				
			|||||||
			continue
 | 
								continue
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			t.Errorf("Unexpected error occured: %s", err)
 | 
								t.Errorf("Unexpected error occured: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		actualKind := reflect.TypeOf(vol).Elem().Name()
 | 
							actualKind := reflect.TypeOf(vol).Elem().Name()
 | 
				
			||||||
		if tt.kind == "empty" && actualKind != "EmptyDir" {
 | 
							if tt.kind == "empty" && actualKind != "EmptyDir" {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ type watchEvent struct {
 | 
				
			|||||||
func Object(codec runtime.Codec, event *watch.Event) (interface{}, error) {
 | 
					func Object(codec runtime.Codec, event *watch.Event) (interface{}, error) {
 | 
				
			||||||
	obj, ok := event.Object.(runtime.Object)
 | 
						obj, ok := event.Object.(runtime.Object)
 | 
				
			||||||
	if !ok {
 | 
						if !ok {
 | 
				
			||||||
		return nil, fmt.Errorf("The event object cannot be safely converted to JSON: %v", reflect.TypeOf(event.Object).Name())
 | 
							return nil, fmt.Errorf("the event object cannot be safely converted to JSON: %v", reflect.TypeOf(event.Object).Name())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data, err := codec.Encode(obj)
 | 
						data, err := codec.Encode(obj)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user