agent/api/container/containertype.go
func (containerType *ContainerType) UnmarshalJSON(b []byte) error {
	strType := string(b)

	switch strType {
	case "null":
		*containerType = ContainerNormal
		seelog.Warn("Unmarshalled nil ContainerType as Normal")
		return nil
	// 'true' or 'false' for compatibility with state version <= 5
	case "true":
		*containerType = ContainerEmptyHostVolume
		return nil
	case "false":
		*containerType = ContainerNormal
		return nil
	}

	if len(strType) < 2 {
		*containerType = ContainerNormal
		return errors.New("invalid length set for ContainerType: " + string(b))
	}
	if b[0] != '"' || b[len(b)-1] != '"' {
		*containerType = ContainerNormal
		return errors.New("invalid value set for ContainerType, must be a string or null; got " + string(b))
	}
	strType = string(b[1 : len(b)-1])

	contType, ok := stringToContainerType[strType]
	if !ok {
		*containerType = ContainerNormal
		return errors.New("unrecognized ContainerType: " + strType)
	}
	*containerType = contType
	return nil
}
func (containerType *ContainerType) UnmarshalJSON(b []byte) error {
	strType := string(b)

	switch strType {
	case "null":
		*containerType = ContainerNormal
		seelog.Warn("Unmarshalled nil ContainerType as Normal")
		return nil
	// 'true' or 'false' for compatibility with state version <= 5
	case "true":
		*containerType = ContainerEmptyHostVolume
		return nil
	case "false":
		*containerType = ContainerNormal
		return nil
	}

	if len(strType) < 2 {
		*containerType = ContainerNormal
		return errors.New("invalid length set for ContainerType: " + string(b))
	}
	if b[0] != '"' || b[len(b)-1] != '"' {
		*containerType = ContainerNormal
		return errors.New("invalid value set for ContainerType, must be a string or null; got " + string(b))
	}
	strType = string(b[1 : len(b)-1])

	contType, ok := stringToContainerType[strType]
	if !ok {
		*containerType = ContainerNormal
		return errors.New("unrecognized ContainerType: " + strType)
	}
	*containerType = contType
	return nil
}
func ( containerType * ContainerType ) UnmarshalJSON ( b [ ] byte ) error { strType := string ( b ) switch strType { case " " : * containerType = ContainerNormal seelog . Warn ( " " ) return nil // 'true' or 'false' for compatibility with state version <= 5 case " " : * containerType = ContainerEmptyHostVolume return nil case " " : * containerType = ContainerNormal return nil } if len ( strType ) < 2 { * containerType = ContainerNormal return errors . New ( " " + string ( b ) ) } if b [ 0 ] != '"' || b [ len ( b ) - 1 ] != '"' { * containerType = ContainerNormal return errors . New ( " " + string ( b ) ) } strType = string ( b [ 1 : len ( b ) - 1 ] ) contType , ok := stringToContainerType [ strType ] if ! ok { * containerType = ContainerNormal return errors . New ( " " + strType ) } * containerType = contType return nil }
// UnmarshalJSON decodes the container type field in the JSON encoded string
// into the ContainerType object
UnmarshalJSON decodes the container type field in the JSON encoded string into the ContainerType object