iaas/hc.go
func BuildHealthCheck(providerName string) func() error {
	return func() error {
		iaasConfig, err := config.Get("iaas")
		if err != nil {
			return hc.ErrDisabledComponent
		}
		iaases, _ := iaasConfig.(map[interface{}]interface{})
		for ifaceName := range iaases {
			name := ifaceName.(string)
			if name == "custom" {
				customIaases := iaases[name].(map[interface{}]interface{})
				for ifaceName := range customIaases {
					iaas := customIaases[ifaceName.(string)].(map[interface{}]interface{})
					if iaas["provider"].(string) != providerName {
						continue
					}
					name = ifaceName.(string)
				}
			} else if name != providerName {
				continue
			}
			err := healthCheck(name)
			if err != nil {
				return err
			}
		}
		return nil
	}
}
func BuildHealthCheck(providerName string) func() error {
	return func() error {
		iaasConfig, err := config.Get("iaas")
		if err != nil {
			return hc.ErrDisabledComponent
		}
		iaases, _ := iaasConfig.(map[interface{}]interface{})
		for ifaceName := range iaases {
			name := ifaceName.(string)
			if name == "custom" {
				customIaases := iaases[name].(map[interface{}]interface{})
				for ifaceName := range customIaases {
					iaas := customIaases[ifaceName.(string)].(map[interface{}]interface{})
					if iaas["provider"].(string) != providerName {
						continue
					}
					name = ifaceName.(string)
				}
			} else if name != providerName {
				continue
			}
			err := healthCheck(name)
			if err != nil {
				return err
			}
		}
		return nil
	}
}
// BuildHealthCheck creates a healthcheck function for the given providerName.
//
// It will call the HealthCheck() method in the provider (only if it's also a
// HealthChecker), for each instance of it (including the "main" instance and
// all custom IaaSes).