// Updates an ISO file.
547884
func (s *ISOService) UpdateIso(p *UpdateIsoParams) (*UpdateIsoResponse, error) {
	resp, err := s.cs.newRequest("updateIso", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateIsoResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
874019
func (f *VersionFactory) Update(key string, vers *Version) {
	if vers.Scalar > f.latest[key] {
		f.latest[key] = vers.Scalar
	}
}
643144
func (c *FakeSamples) Update(sample *v1alpha1.Sample) (result *v1alpha1.Sample, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(samplesResource, c.ns, sample), &v1alpha1.Sample{})

	if obj == nil {
		return nil, err
	}
	return obj.(*v1alpha1.Sample), err
}
1141601
func (c *ksmdCollector) Update(ch chan<- prometheus.Metric) error {
	for _, n := range ksmdFiles {
		val, err := readUintFromFile(sysFilePath(filepath.Join("kernel/mm/ksm", n)))
		if err != nil {
			return err
		}

		t := prometheus.GaugeValue
		v := float64(val)
		switch n {
		case "full_scans":
			t = prometheus.CounterValue
		case "sleep_millisecs":
			v /= 1000
		}
		ch <- prometheus.MustNewConstMetric(c.metricDescs[n], t, v)
	}

	return nil
}
1193469
func (c *Client) LinodeUpdate(linodeID int, conf LinodeOpts) error {
	args, err := c.argMarshal(conf)
	if err != nil {
		return err
	}
	args["LinodeID"] = linodeID

	_, err = c.apiCall("linode.update", args)
	if err != nil {
		return err
	}
	return nil
}
286835
func (i *VCSInstaller) Update() error {
	debug("updating %s", i.Repo.Remote())
	if i.Repo.IsDirty() {
		return errors.New("plugin repo was modified")
	}
	if err := i.Repo.Update(); err != nil {
		return err
	}
	if !isPlugin(i.Repo.LocalPath()) {
		return ErrMissingMetadata
	}
	return nil
}
1033431
func (f *Frees) Update() {
	f.m.Lock()
	defer f.m.Unlock()

	runtime.ReadMemStats(&f.mem)
	f.d.Update(int64(f.mem.Frees))
}
128358
func (u *Updater) update(ctx Context, options UpdateOptions) (*Update, error) {
	update, err := u.checkForUpdate(ctx, options)
	if err != nil {
		return nil, findErr(err)
	}
	if update == nil || !update.NeedUpdate {
		// No update available
		return nil, nil
	}
	u.log.Infof("Got update with version: %s", update.Version)

	err = ctx.BeforeUpdatePrompt(*update, options)
	if err != nil {
		return update, err
	}

	// Prompt for update
	updatePromptResponse, err := u.promptForUpdateAction(ctx, *update, options)
	if err != nil {
		return update, promptErr(err)
	}
	switch updatePromptResponse.Action {
	case UpdateActionApply:
		ctx.ReportAction(updatePromptResponse, update, options)
	case UpdateActionAuto:
		ctx.ReportAction(updatePromptResponse, update, options)
	case UpdateActionSnooze:
		ctx.ReportAction(updatePromptResponse, update, options)
		return update, CancelErr(fmt.Errorf("Snoozed update"))
	case UpdateActionCancel:
		ctx.ReportAction(updatePromptResponse, update, options)
		return update, CancelErr(fmt.Errorf("Canceled"))
	case UpdateActionError:
		return update, promptErr(fmt.Errorf("Unknown prompt error"))
	case UpdateActionContinue:
		// Continue
	case UpdateActionUIBusy:
		// Return nil so that AfterUpdateCheck won't exit the service
		return nil, guiBusyErr(fmt.Errorf("User active, retrying later"))
	}

	// Linux updates don't have assets so it's ok to prompt for update above before
	// we check for nil asset.
	if update.Asset == nil || update.Asset.URL == "" {
		u.log.Info("No update asset to apply")
		return update, nil
	}

	if err := u.CleanupPreviousUpdates(); err != nil {
		u.log.Infof("Error cleaning up previous downloads: %v", err)
	}

	tmpDir := u.tempDir()
	defer u.Cleanup(tmpDir)
	if err := u.downloadAsset(update.Asset, tmpDir, options); err != nil {
		return update, downloadErr(err)
	}

	u.log.Infof("Verify asset: %s", update.Asset.LocalPath)
	if err := ctx.Verify(*update); err != nil {
		return update, verifyErr(err)
	}

	if err := u.apply(ctx, *update, options, tmpDir); err != nil {
		return update, err
	}

	return update, nil
}
449974
func (repo *repo) Update(user service.Entity) error {
	return dbconn.DB.Save(&user).Error
}
924025
func (zs *Server) Update(ctx context.Context, filePath string, contents []byte, version topo.Version) (topo.Version, error) {
	zkPath := path.Join(zs.root, filePath)

	// Interpret the version
	var zkVersion int32
	if version != nil {
		zkVersion = int32(version.(ZKVersion))
	} else {
		zkVersion = -1
	}

	stat, err := zs.conn.Set(ctx, zkPath, contents, zkVersion)
	if zkVersion == -1 && err == zk.ErrNoNode {
		// In zookeeper, an unconditional set of a nonexisting
		// node will return ErrNoNode. In that case, we want
		// to Create.
		return zs.Create(ctx, filePath, contents)
	}
	if err != nil {
		return nil, convertError(err, zkPath)
	}
	return ZKVersion(stat.Version), nil
}
357604
func (oldFilePV *OldFilePV) Upgrade(keyFilePath, stateFilePath string) *FilePV {
	privKey := oldFilePV.PrivKey
	pvKey := FilePVKey{
		PrivKey:  privKey,
		PubKey:   privKey.PubKey(),
		Address:  privKey.PubKey().Address(),
		filePath: keyFilePath,
	}

	pvState := FilePVLastSignState{
		Height:    oldFilePV.LastHeight,
		Round:     oldFilePV.LastRound,
		Step:      oldFilePV.LastStep,
		Signature: oldFilePV.LastSignature,
		SignBytes: oldFilePV.LastSignBytes,
		filePath:  stateFilePath,
	}

	// Save the new PV files
	pv := &FilePV{
		Key:           pvKey,
		LastSignState: pvState,
	}
	pv.Save()

	// Rename the old PV file
	err := os.Rename(oldFilePV.filePath, oldFilePV.filePath+".bak")
	if err != nil {
		panic(err)
	}
	return pv
}
1153766
func (m *MetadataMapping) Update(ccMd Metadata) {
	m.Lock()
	defer m.Unlock()
	m.mdByName[ccMd.Name] = ccMd
}
817560
func (s *ISOService) NewUpdateIsoParams(id string) *UpdateIsoParams {
	p := &UpdateIsoParams{}
	p.p = make(map[string]interface{})
	p.p["id"] = id
	return p
}
1063692
func (u *Update) CanUpdate() (err error) {
	// get the directory the file exists in
	path, err := u.getPath()
	if err != nil {
		return
	}

	fileDir := filepath.Dir(path)
	fileName := filepath.Base(path)

	// attempt to open a file in the file's directory
	newPath := filepath.Join(fileDir, fmt.Sprintf(".%s.new", fileName))
	fp, err := os.OpenFile(newPath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0755)
	if err != nil {
		return
	}
	fp.Close()

	_ = os.Remove(newPath)
	return
}
11531
func (d *Dashboards) Update(ctx context.Context, dashboard chronograf.Dashboard) error {
	board, _, err := d.idToFile(dashboard.ID)
	if err != nil {
		return err
	}

	if err := d.Delete(ctx, board); err != nil {
		return err
	}
	file := dashboardFile(d.Dir, dashboard)
	return d.Create(file, dashboard)
}
640060
func UpdateFile(filename string, filedata string) bool {
	f, err := os.Create(filename)
	if err != nil {
		fmt.Println(err)
		return false
	}
	n, err := io.WriteString(f, filedata)
	if err != nil {
		fmt.Println(n, err)
		return false
	}
	f.Close()
	return true
}
257280
func (z *ZipArchive) updateStat() {
	z.NumFiles = len(z.files)
	z.isHasChanged = true
}