// ProvisionerSuccess is called on provisioner when it successfully provisions another device.
552921
func (c ProvisionUiClient) ProvisionerSuccess(ctx context.Context, __arg ProvisionerSuccessArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.provisionUi.ProvisionerSuccess", []interface{}{__arg}, nil)
	return
}
384366
func Provisioner() terraform.ResourceProvisioner {
	return &schema.Provisioner{
		Schema: map[string]*schema.Schema{
			"local_state_tree": &schema.Schema{
				Type:     schema.TypeString,
				Required: true,
			},
			"local_pillar_roots": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"remote_state_tree": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Default:  DefaultStateTreeDir,
			},
			"remote_pillar_roots": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Default:  DefaultPillarRootDir,
			},
			"temp_config_dir": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
				Default:  "/tmp/salt",
			},
			"skip_bootstrap": &schema.Schema{
				Type:     schema.TypeBool,
				Optional: true,
			},
			"no_exit_on_failure": &schema.Schema{
				Type:     schema.TypeBool,
				Optional: true,
			},
			"bootstrap_args": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"disable_sudo": &schema.Schema{
				Type:     schema.TypeBool,
				Optional: true,
			},
			"custom_state": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"minion_config_file": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"cmd_args": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"salt_call_args": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
			"log_level": &schema.Schema{
				Type:     schema.TypeString,
				Optional: true,
			},
		},

		ApplyFunc:    applyFn,
		ValidateFunc: validateFn,
	}
}
164940
func (b *Bundler) provisionVendorAstilectron() (err error) {
	var p = filepath.Join(b.pathCache, fmt.Sprintf("astilectron-%s.zip", astilectron.VersionAstilectron))
	if len(b.pathAstilectron) > 0 {
		// Zip
		astilog.Debugf("Zipping %s into %s", b.pathAstilectron, p)
		if err = astiarchive.Zip(b.ctx, b.pathAstilectron, p, fmt.Sprintf("astilectron-%s", astilectron.VersionAstilectron)); err != nil {
			err = errors.Wrapf(err, "zipping %s into %s failed", b.pathAstilectron, p)
			return
		}

		// Check context error
		if b.ctx.Err() != nil {
			return b.ctx.Err()
		}
	}
	return b.provisionVendorZip(astilectron.AstilectronDownloadSrc(), p, filepath.Join(b.pathVendor, zipNameAstilectron))
}
1277422
func (p *defaultProvisioner) provisionPackage(ctx context.Context, paths Paths, s *ProvisionStatusPackage, m mover, name, version, pathUnzipSrc, pathDirectory string, finish func() error) (err error) {
	// Package has already been provisioned
	if s != nil && s.Version == version {
		astilog.Debugf("%s has already been provisioned to version %s, moving on...", name, version)
		return
	}
	astilog.Debugf("Provisioning %s...", name)

	// Remove previous install
	astilog.Debugf("Removing directory %s", pathDirectory)
	if err = os.RemoveAll(pathDirectory); err != nil && !os.IsNotExist(err) {
		return errors.Wrapf(err, "removing %s failed", pathDirectory)
	}

	// Move
	if err = m(ctx, paths); err != nil {
		return errors.Wrapf(err, "moving %s failed", name)
	}

	// Create directory
	astilog.Debugf("Creating directory %s", pathDirectory)
	if err = os.MkdirAll(pathDirectory, 0755); err != nil {
		return errors.Wrapf(err, "mkdirall %s failed", pathDirectory)
	}

	// Unzip
	if err = Unzip(ctx, pathUnzipSrc, pathDirectory); err != nil {
		return errors.Wrapf(err, "unzipping %s into %s failed", pathUnzipSrc, pathDirectory)
	}

	// Finish
	if finish != nil {
		if err = finish(); err != nil {
			return errors.Wrap(err, "finishing failed")
		}
	}
	return
}
1171460
func (s *ProgressCounters) SetSuccessSteps(v int64) *ProgressCounters {
	s.SuccessSteps = &v
	return s
}
293226
func ecsWithCaching(ecs *ECS) *cachingECSClient {
	return &cachingECSClient{
		ecsClient:       ecs,
		taskDefinitions: cache.New(defaultExpiration, defaultPurge),
	}
}
1178771
func (sbtp SingleBinaryThrustProvisioner) Provision() error {
	err := sbtp.extractToPath(spawn.GetDownloadPath())
	if err != nil {
		return err
	}
	return spawn.Bootstrap()
}
1035816
func (s *Storage) GetAndroidSuccess() int64 {
	count := atomic.LoadInt64(&s.stat.Android.PushSuccess)

	return count
}
1157382
func ProvisionTokensFromV1(in []ProvisionTokenV1) []ProvisionToken {
	if in == nil {
		return nil
	}
	out := make([]ProvisionToken, len(in))
	for i := range in {
		out[i] = in[i].V2()
	}
	return out
}
1145379
func (vm *VM) Provision() error {
	s, err := vm.getService()
	if err != nil {
		return err
	}

	return s.provision()
}
772922
func (p *defaultProvisioner) provisionAstilectron(ctx context.Context, paths Paths, s ProvisionStatus) error {
	return p.provisionPackage(ctx, paths, s.Astilectron, p.moverAstilectron, "Astilectron", VersionAstilectron, paths.AstilectronUnzipSrc(), paths.AstilectronDirectory(), nil)
}
1214790
func (c *Client) Provision(ctxt context.Context, typ, name, token string) error {
	if typ != allowedRecordType {
		return errors.New("only TXT records are supported")
	}

	// check name
	if !strings.HasSuffix(name, "."+c.domain) {
		return errors.New("invalid domain")
	}
	if n := strings.TrimSuffix(name, "."+c.domain); n == "" {
		return errors.New("invalid name")
	}
	name += "."

	// no nameservers supplied, use the nameservers from the managed zone
	if c.nameservers == nil {
		mz, err := c.dnsService.ManagedZones.Get(c.projectID, c.managedZone).Context(ctxt).Do()
		if err != nil {
			return fmt.Errorf("could not retrieve nameservers for %s/%s: %v", c.projectID, c.managedZone, err)
		}

		// add port to nameservers
		ns := make([]string, len(mz.NameServers))
		for i, n := range mz.NameServers {
			ns[i] = n + ":53"
		}
		c.nameservers = ns
	}

	// create dns record
	c.logf("provisioning (type: %s, name: %s, token: %s)", typ, name, token)

	// build deletions
	deletions, err := c.buildDeletions(ctxt, typ, name)
	if err != nil {
		return err
	}

	// do change
	var chg *dns.Change
	chg, err = c.dnsService.Changes.Create(
		c.projectID, c.managedZone,
		&dns.Change{
			Deletions: deletions,
			Additions: []*dns.ResourceRecordSet{
				&dns.ResourceRecordSet{
					Type:    typ,
					Name:    name,
					Rrdatas: []string{token},
					Ttl:     1,
				},
			},
		},
	).Context(ctxt).Do()
	if err != nil {
		c.errf("unable to provision (type: %s, name: %s, token: %s): %v", typ, name, token, err)
		return err
	} /*else {
		c.logf("successfully provisioned (type: %s, name: %s, token: %s)", typ, name, token)
	}*/

	// check pending status
	for chg.Status == "pending" {
		time.Sleep(1 * time.Second)
		chg, err = c.dnsService.Changes.Get(c.projectID, c.managedZone, chg.Id).Context(ctxt).Do()
		if err != nil {
			return err
		}
	}

	var cancel func()
	ctxt, cancel = context.WithTimeout(ctxt, c.propagationWait)
	defer cancel()

	eg, ctxt := errgroup.WithContext(ctxt)
	for _, nn := range c.nameservers {
		ns := nn
		eg.Go(func() error {
			// create dnsr client and question
			cl, m := new(dnsr.Client), new(dnsr.Msg)
			m.SetQuestion(name, dnsr.TypeTXT)
			for {
				select {
				case <-ctxt.Done():
					return ctxt.Err()
				default:
					// query nameserver
					res, _, err := cl.Exchange(m, ns)
					if err == nil && len(res.Answer) > 0 {
						for _, a := range res.Answer {
							if txtRecord, ok := a.(*dnsr.TXT); ok && contains(txtRecord.Txt, token) {
								c.logf("%s has propagated to %s", name, ns)
								return nil
							}
						}
					}
					time.Sleep(c.checkDelay)
				}
			}

			return nil
		})
	}

	if err = eg.Wait(); err != nil && !c.ignorePropagationErrors {
		return err
	} else if err != nil {
		c.errf("ignored propagated error: %v", err)
	}

	time.Sleep(c.provisionDelay)

	return nil
}
845719
func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool {
	code := httpCode(handler, method, url, values)
	if code == -1 {
		return false
	}
	return code >= http.StatusOK && code <= http.StatusPartialContent
}
50719
func (c *Client) Provision(ctxt context.Context, typ, name, token string) error {
	if typ != allowedRecordType {
		return errors.New("only TXT records are supported")
	}

	// check name
	if !strings.HasSuffix(name, "."+c.domain) {
		return errors.New("invalid domain")
	}
	name = strings.TrimSuffix(name, "."+c.domain)
	if name == "" {
		return errors.New("invalid name")
	}

	// create dns record
	c.logf("provisioning (type: %s, name: %s, token: %s)", typ, name, token)
	_, _, err := c.client.Domains.CreateRecord(ctxt, c.domain, &godo.DomainRecordEditRequest{
		Type: allowedRecordType,
		Name: name,
		Data: token,
	})
	if err != nil {
		c.errf("unable to provision (type: %s, name: %s, token: %s): %v", typ, name, token, err)
	} /*else {
		c.logf("successfully provisioned (type: %s, name: %s, token: %s)", typ, name, token)
	}*/

	return err
}
1086566
func (s *Storage) GetAndroidSuccess() int64 {
	var count int64
	getInt64(storage.AndroidSuccessKey, &count)

	return count
}
138248
func (p *rbdProvisioner) Provision(options controller.VolumeOptions) (*v1.PersistentVolume, error) {
	if !util.AccessModesContainedInAll(p.getAccessModes(), options.PVC.Spec.AccessModes) {
		return nil, fmt.Errorf("invalid AccessModes %v: only AccessModes %v are supported", options.PVC.Spec.AccessModes, p.getAccessModes())
	}
	if options.PVC.Spec.Selector != nil {
		return nil, fmt.Errorf("claim Selector is not supported")
	}
	opts, err := p.parseParameters(options.Parameters)
	if err != nil {
		return nil, err
	}
	image := options.PVName
	// If use-pv-name flag not set, generate image name
	if !p.usePVName {
		// create random image name
		image = fmt.Sprintf("kubernetes-dynamic-pvc-%s", uuid.NewUUID())
	}
	rbd, sizeMB, err := p.rbdUtil.CreateImage(image, opts, options)
	if err != nil {
		klog.Errorf("rbd: create volume failed, err: %v", err)
		return nil, err
	}
	klog.Infof("successfully created rbd image %q", image)

	rbd.SecretRef = new(v1.SecretReference)
	rbd.SecretRef.Name = opts.userSecretName
	if len(opts.userSecretNamespace) > 0 {
		rbd.SecretRef.Namespace = opts.userSecretNamespace
	}
	rbd.RadosUser = opts.userID

	pv := &v1.PersistentVolume{
		ObjectMeta: metav1.ObjectMeta{
			Name: options.PVName,
			Annotations: map[string]string{
				provisionerIDAnn: p.identity,
			},
		},
		Spec: v1.PersistentVolumeSpec{
			PersistentVolumeReclaimPolicy: options.PersistentVolumeReclaimPolicy,
			AccessModes:                   options.PVC.Spec.AccessModes,
			VolumeMode:                    options.PVC.Spec.VolumeMode,
			MountOptions:                  options.MountOptions,
			Capacity: v1.ResourceList{
				v1.ResourceName(v1.ResourceStorage): resource.MustParse(fmt.Sprintf("%dMi", sizeMB)),
			},
			PersistentVolumeSource: v1.PersistentVolumeSource{
				RBD: rbd,
			},
		},
	}
	// use default access modes if missing
	if len(pv.Spec.AccessModes) == 0 {
		klog.Warningf("no access modes specified, use default: %v", p.getAccessModes())
		pv.Spec.AccessModes = p.getAccessModes()
	}

	return pv, nil
}
353822
func (vm *VM) Provision() error {
	wait() // Avoid the AWS rate limit.

	svc, err := getService(vm.Region)
	if err != nil {
		return fmt.Errorf("failed to get AWS service: %v", err)
	}

	resp, err := svc.RunInstances(instanceInfo(vm))
	if err != nil {
		return fmt.Errorf("Failed to create instance: %v", err)
	}

	if hasInstanceID(resp.Instances[0]) {
		vm.InstanceID = *resp.Instances[0].InstanceId
	} else {
		return ErrNoInstanceID
	}

	if err := waitUntilReady(svc, vm.InstanceID); err != nil {
		return err
	}

	if vm.DeleteNonRootVolumeOnDestroy {
		return setNonRootDeleteOnDestroy(svc, vm.InstanceID, true)
	}

	if vm.Name != "" {
		if err := vm.SetTag("Name", vm.GetName()); err != nil {
			return err
		}
	}

	return nil
}