func (p *Provider) Addrs(args map[string]string, l *log.Logger) ([]string, error) {
	if args["provider"] != "vsphere" {
		return nil, discoverErr("invalid provider %s", args["provider"])
	}

	setLog(l)

	tagName := args["tag_name"]
	categoryName := args["category_name"]
	host := valueOrEnv(args, "host", "VSPHERE_SERVER")
	user := valueOrEnv(args, "user", "VSPHERE_USER")
	password := valueOrEnv(args, "password", "VSPHERE_PASSWORD")
	insecure, err := strconv.ParseBool(valueOrEnv(args, "insecure_ssl", "VSPHERE_ALLOW_UNVERIFIED_SSL"))
	if err != nil {
		logger.Println("[DEBUG] Non-truthy/falsey value for insecure_ssl, assuming false")
	}
	timeout, err := time.ParseDuration(args["timeout"])
	if err != nil {
		logger.Println("[DEBUG] Non-time value given for timeout, assuming 10m")
		timeout = time.Minute * 10
	}

	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()

	client, err := newVSphereClient(ctx, host, user, password, insecure)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	if tagName == "" || categoryName == "" {
		return nil, discoverErr("both tag_name and category_name must be specified")
	}

	logger.Printf("[INFO] Locating all virtual machine IP addresses with tag %q in category %q", tagName, categoryName)

	tagID, err := tagIDFromName(ctx, client.TagsClient, tagName, categoryName)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	addrs, err := virtualMachineIPsForTag(ctx, client, tagID)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	logger.Printf("[INFO] Final IP address list: %s", strings.Join(addrs, ","))
	return addrs, nil
}
func (p *Provider) Addrs(args map[string]string, l *log.Logger) ([]string, error) {
	if args["provider"] != "vsphere" {
		return nil, discoverErr("invalid provider %s", args["provider"])
	}

	setLog(l)

	tagName := args["tag_name"]
	categoryName := args["category_name"]
	host := valueOrEnv(args, "host", "VSPHERE_SERVER")
	user := valueOrEnv(args, "user", "VSPHERE_USER")
	password := valueOrEnv(args, "password", "VSPHERE_PASSWORD")
	insecure, err := strconv.ParseBool(valueOrEnv(args, "insecure_ssl", "VSPHERE_ALLOW_UNVERIFIED_SSL"))
	if err != nil {
		logger.Println("[DEBUG] Non-truthy/falsey value for insecure_ssl, assuming false")
	}
	timeout, err := time.ParseDuration(args["timeout"])
	if err != nil {
		logger.Println("[DEBUG] Non-time value given for timeout, assuming 10m")
		timeout = time.Minute * 10
	}

	ctx, cancel := context.WithTimeout(context.Background(), timeout)
	defer cancel()

	client, err := newVSphereClient(ctx, host, user, password, insecure)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	if tagName == "" || categoryName == "" {
		return nil, discoverErr("both tag_name and category_name must be specified")
	}

	logger.Printf("[INFO] Locating all virtual machine IP addresses with tag %q in category %q", tagName, categoryName)

	tagID, err := tagIDFromName(ctx, client.TagsClient, tagName, categoryName)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	addrs, err := virtualMachineIPsForTag(ctx, client, tagID)
	if err != nil {
		return nil, discoverErr(err.Error())
	}

	logger.Printf("[INFO] Final IP address list: %s", strings.Join(addrs, ","))
	return addrs, nil
}
// Addrs implements the Provider interface for the vsphere package.