コード例 #1
0
ファイル: validator.go プロジェクト: vmware/vic
func (v *Validator) target(ctx context.Context, input *data.Data, conf *config.VirtualContainerHostConfigSpec) {
	defer trace.End(trace.Begin(""))

	targetURL := input.Target.URLWithoutPassword()
	if !v.IsVC() {
		var err error
		targetURL, err = url.Parse(v.Session.Service)
		if err != nil {
			v.NoteIssue(fmt.Errorf("Error processing target after transformation to SOAP endpoint: %q: %s", v.Session.Service, err))
			return
		}

		// ESXi requires user/password to be encoded in the Target URL
		// However, this gets lost when the URL is Marshaled
		conf.UserPassword = targetURL.User.String()
	}

	// check if host is managed by VC
	v.managedbyVC(ctx)

	conf.Target = *targetURL
	conf.TargetThumbprint = input.Thumbprint

	// TODO: more checks needed here if specifying service account for VCH
}