id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c4700 | "AssignedUnits", reflect.TypeOf((*MockGeneration)(nil).AssignedUnits))
} | |
c4701 | _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4702 | ret0, _ := ret[0].(int64)
return ret0
} | |
c4703 | ret0, _ := ret[0].(string)
return ret0
} | |
c4704 | _ := ret[0].(charm_v6.Settings)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4705 | := ret[0].([]string)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4706 | lease.ErrWaitCancelled
case ch <- b:
ch = nil
case <-b.unblock:
return nil
}
}
} | |
c4707 | = append(b[block.leaseKey], block.unblock)
} | |
c4708 |
delete(b, lease)
for _, unblock := range unblocks {
close(unblock)
}
} | |
c4709 | := agentConfig.UpgradedToVersion()
upgradedToVersion.Build = 0
currentVersion := jujuversion.Current
currentVersion.Build = 0
if upgradedToVersion == currentVersion {
logger.Infof(
"upgrade steps for %v have already been run.",
jujuversion.Current,
)
lock.Unlock()
}
return lock
} | |
c4710 | apiConn,
jobs: jobs,
openState: openState,
preUpgradeSteps: preUpgradeSteps,
machine: machine,
tag: agent.CurrentConfig().Tag(),
isCaas: isCaas,
}
w.tomb.Go(w.run)
return w, nil
} | |
c4711 |
if err := w.agent.ChangeConfig(w.runUpgradeSteps); err != nil {
return err
}
if err := w.finaliseUpgrade(upgradeInfo); err != nil {
return err
}
return nil
} | |
c4712 |
}
if cmdutil.ConnectionIsDead(logger, w.apiConn) {
// API connection has gone away - abort!
return &apiLostDuringUpgrade{upgradeErr}
}
if attempt.HasNext() {
w.reportUpgradeFailure(upgradeErr, true)
}
}
if upgradeErr != nil {
return upgradeErr
}
agentConfig.SetUpgradedToVersion(w.toVersion)
r... | |
c4713 | targets = append(targets, upgrades.DatabaseMaster)
}
case multiwatcher.JobHostUnits:
targets = append(targets, upgrades.HostMachine)
}
}
return
} | |
c4714 | return errors.NotValidf("nil Facade")
}
return nil
} | |
c4715 | Handler: &handler{config},
}
return watcher.NewStringsWorker(swConfig)
} | |
c4716 | return handler.config.Facade.Rescale(applications)
} | |
c4717 | string {
return modelUUID + ":" + strconv.FormatInt(localID, 10)
} | |
c4718 |
w.tomb.Kill(errors.Trace(err))
return &w
} | |
c4719 | // tomb expects ErrDying or ErrStillAlive as
// exact values, so we need to log and unwrap
// the error first.
if err != nil && cause != tomb.ErrDying {
logger.Infof("watcher loop failed: %v", err)
}
return cause
})
return w
} | |
c4720 |
w.sendReq(reqWatch{key, ch})
} | |
c4721 |
w.sendReq(reqUnwatch{key, ch})
} | |
c4722 |
case <-done:
case <-w.tomb.Dying():
}
} | |
c4723 | case alive = <-result:
case <-w.tomb.Dying():
return false, errors.Errorf("cannot check liveness: watcher is dying")
}
logger.Tracef("[%s] Alive(%q) -> %v", w.modelUUID[:6], key, alive)
return alive, nil
} | |
c4724 |
if err := w.sync(); err != nil {
return errors.Trace(err)
}
w.flush()
for _, done := range syncDone {
close(done)
}
w.syncsSinceLastPrune++
w.checkShouldPrune()
case req := <-w.request:
w.handle(req)
w.flush()
}
}
} | |
c4725 |
pruner := NewPruner(w.modelUUID, w.beings, w.pings, w.delta)
err := pruner.Prune(w.ignoredSeqs)
if err != nil {
logger.Warningf("error while pruning %q for %q: %v", w.beings.Name, w.modelUUID, err)
}
} | |
c4726 | range baseToBits {
base, err := strconv.ParseInt(hexbase, 16, 64)
if err != nil {
return nil, errors.Annotatef(err, "presence cannot parse alive key: %q", base)
}
base *= 63
for i := int64(0); i < 63 && bits > 0; i++ {
on := (bits&1 == 1)
bits >>= 1
if !on {
continue
}
seq := base + i
... | |
c4727 | dead. Dispatch
// the respective events and forget their sequences.
for seq, key := range w.beingKey {
if dead[seq] || !alive[seq] {
logger.Tracef("[%s] removing seq=%d with key %q", w.modelUUID[:6], seq, key)
delete(w.beingKey, seq)
delete(w.beingSeq, key)
for _, ch := range w.watches[key] {
w.pen... | |
c4728 | pings: pingsC(base),
beingKey: key,
modelUUID: modelTag.Id(),
recorderFunc: recorderFunc,
}
} | |
c4729 | // tomb expects ErrDying or ErrStillAlive as
// exact values, so we need to log and unwrap
// the error first.
if err != nil && cause != tomb.ErrDying {
logger.Infof("pinger loop failed: %v", err)
}
return cause
})
return nil
} | |
c4730 | err := p.tomb.Wait()
// TODO ping one more time to guarantee a late timeout.
p.started = false
return errors.Trace(err)
} | |
c4731 | session.Close()
pings := p.pings.With(session)
if _, err := pings.UpsertId(docIDInt64(p.modelUUID, slot), udoc); err != nil {
return errors.Trace(err)
}
return errors.Trace(killErr)
} | |
c4732 | p.fieldBit},
}}}
session := p.pings.Database.Session.Copy()
defer session.Close()
pings := p.pings.With(session)
_, err := pings.UpsertId(docIDInt64(p.modelUUID, slot), udoc)
return errors.Trace(err)
} | |
c4733 | * time.Second):
if err := p.ping(); err != nil {
return errors.Trace(err)
}
}
}
} | |
c4734 | seqID := docIDStr(p.modelUUID, "beings")
if _, err := seqs.FindId(seqID).Apply(change, &seq); err != nil {
return errors.Trace(err)
}
p.beingSeq = seq.Seq
p.fieldKey = fmt.Sprintf("%x", p.beingSeq/63)
p.fieldBit = 1 << uint64(p.beingSeq%63)
p.lastSlot = 0
beings := beingsC(base)
return errors.Trace(beings.In... | |
c4735 | delta
}
// TODO(perrito666) 2016-05-02 lp:1558657
slot := timeSlot(time.Now(), p.delta)
if slot == p.lastSlot {
// Never, ever, ping the same slot twice.
// The increment below would corrupt the slot.
return nil
}
p.lastSlot = slot
p.recorderFunc().Ping(p.modelUUID, slot, p.fieldKey, p.fieldBit)
return e... | |
c4736 | a busy server.
// TODO(perrito666) 2016-05-02 lp:1558657
before = time.Now()
err := db.Run(bson.D{{"$eval", "function() { return new Date(); }"}}, &server)
// TODO(perrito666) 2016-05-02 lp:1558657
after = time.Now()
if err != nil {
return 0, errors.Trace(err)
}
serverDelay = server.Sub(bef... | |
c4737 |
if fake {
slot += int64(fakeOffset) * period
}
fakeMutex.Unlock()
return slot
} | |
c4738 |
logger.Infof("not faking presence time. Real time slot in use.")
} | |
c4739 | errs = append(errs, err)
}
}
if len(errs) != 0 {
return errors.Errorf("errors removing presence for model %q: %v", modelTag.Id(), errs)
}
return nil
} | |
c4740 | "", errors.Errorf("%q is not a valid space name", name)
}
return name, nil
} | |
c4741 | %q specified", cidr)
}
return CIDRs, errors.Errorf("subnet %q overlaps with %q", arg, cidr)
}
CIDRs.Add(cidr)
}
if CIDRs.IsEmpty() && !cidrsOptional {
return CIDRs, errors.New("CIDRs required but not provided")
}
return CIDRs, nil
} | |
c4742 | tested with a feature test.
shim := &mvpAPIShim{
apiState: root,
facade: spaces.NewAPI(root),
}
return shim, nil
} | |
c4743 |
available := opState.Started && !opState.Stopped && !changing
logger.Tracef("charmdir: available=%v opState: started=%v stopped=%v changing=%v",
available, opState.Started, opState.Stopped, changing)
if available {
return guard.Unlock()
} else {
return guard.Lockdown(abort)
}
} | |
c4744 | ctrl}
mock.recorder = &MockStorageV1InterfaceMockRecorder{mock}
return mock
} | |
c4745 | {
ret := m.ctrl.Call(m, "StorageClasses")
ret0, _ := ret[0].(v11.StorageClassInterface)
return ret0
} | |
c4746 | {
mock := &MockStorageClassInterface{ctrl: ctrl}
mock.recorder = &MockStorageClassInterfaceMockRecorder{mock}
return mock
} | |
c4747 |
if !ok {
return phase, errors.Errorf("invalid phase in DB: %v", mig.statusDoc.Phase)
}
return phase, nil
} | |
c4748 | ControllerAlias: mig.doc.TargetControllerAlias,
Addrs: mig.doc.TargetAddrs,
CACert: mig.doc.TargetCACert,
AuthTag: authTag,
Password: mig.doc.TargetPassword,
Macaroons: macs,
}, nil
} | |
c4749 | return errors.Trace(err)
}
// If the migration aborted, make the model active again.
if nextPhase == migration.ABORTDONE {
ops = append(ops, txn.Op{
C: modelsC,
Id: mig.doc.ModelUUID,
Assert: txn.DocExists,
Update: bson.M{
"$set": bson.M{"migration-mode": MigrationModeNone},
},
})
... | |
c4750 | "" {
msg = "migrating: " + msg
}
doc := statusDoc{
Status: modelStatus,
StatusInfo: msg,
Updated: now,
}
ops, err := statusSetOps(st.db(), doc, globalKey)
if err != nil {
return nil, errors.Trace(err)
}
probablyUpdateStatusHistory(st.db(), globalKey, doc)
return ops, nil
} | |
c4751 | txn.DocExists,
})
if err := mig.st.db().RunTransaction(ops); err != nil {
return errors.Annotate(err, "failed to set migration status")
}
mig.statusDoc.StatusMessage = text
return nil
} | |
c4752 | {
coll, closer := mig.st.db().GetCollection(migrationsMinionSyncC)
defer closer()
var existingDoc modelMigMinionSyncDoc
err := coll.FindId(docID).Select(bson.M{"success": 1}).One(&existingDoc)
if err != nil {
return errors.Annotate(err, "checking existing report")
}
if existingDoc.Success != success {... | |
c4753 |
return nil, errors.Annotate(err, "retrieving minion reports")
}
succeeded := names.NewSet()
failed := names.NewSet()
for _, doc := range docs {
entityKey, ok := doc["entity-key"].(string)
if !ok {
return nil, errors.Errorf("unexpected entity-key %v", doc["entity-key"])
}
tag, err := globalKeyToAgentT... | |
c4754 | rawId.(string)
if !ok {
return false
}
return strings.HasPrefix(id, prefix)
}
return newNotifyCollWatcher(mig.st, migrationsMinionSyncC, filter), nil
} | |
c4755 | errors.NotFoundf("migration status")
} else if err != nil {
return errors.Annotate(err, "migration status lookup failed")
}
mig.statusDoc = statusDoc
return nil
} | |
c4756 | if user.UserID == id {
return user.Access
}
}
return permission.NoAccess
} | |
c4757 | errors.NotValidf("InitiatedBy")
}
return spec.TargetInfo.Validate()
} | |
c4758 |
defer closer()
mig, err := st.migrationFromQuery(migColl.FindId(id))
if err != nil {
return nil, errors.Trace(err)
}
return mig, nil
} | |
c4759 |
defer closer()
n, err := active.FindId(modelUUID).Count()
if err != nil {
return false, errors.Trace(err)
}
return n > 0, nil
} | |
c4760 | housing.Occupy)
}
for _, name := range housing.Flags {
manifold.Inputs = maybeAdd(manifold.Inputs, name)
manifold.Start = flagStart(manifold.Start, name)
}
if housing.Filter != nil {
manifold.Filter = housing.Filter
}
return manifold
} | |
c4761 | errors.Trace(err)
}
payloads = payload.Filter(payloads, filters...)
for _, payload := range payloads {
apiInfo := api.Payload2api(payload)
r.Results = append(r.Results, apiInfo)
}
return r, nil
} | |
c4762 | string {
value := m[key]
delete(m, key)
return value
} | |
c4763 | := range m {
logger.Infof("unused config option: %q -> %q", key, value)
}
} | |
c4764 | nil {
if err := sendJSONError(w, r, errors.Trace(err)); err != nil {
logger.Errorf("%v", errors.Annotate(err, "cannot return error to user"))
}
}
} | |
c4765 | }
st, _, err := h.ctxt.stateForRequestAuthenticated(r)
if err != nil {
return errors.Trace(err)
}
defer st.Release()
return errors.Trace(h.processGet(r, w, st.State))
} | |
c4766 | // TODO(wallyworld) - support more than just "remote-application"
switch entity {
case "remote-application":
return h.processRemoteApplication(r, w, st)
default:
return errors.NotSupportedf("entity %v", entity)
}
} | |
c4767 |
store := storage.NewStorage(sourceSt.ModelUUID(), sourceSt.MongoSession())
// Use the storage to retrieve and save the charm archive.
charmPath, err := common.ReadCharmFromStorage(store, h.dataDir, ch.StoragePath())
if errors.IsNotFound(err) {
return h.byteSender(w, ".svg", []byte(common.DefaultCharmIcon))
}
i... | |
c4768 |
mock.recorder = &MockNotifyWatcherMockRecorder{mock}
return mock
} | |
c4769 | ctrl}
mock.recorder = &MockStringsWatcherMockRecorder{mock}
return mock
} | |
c4770 | under the current client username are",
)
}
images := make([]*imagemetadata.ImageMetadata, 0, n)
for _, val := range resp.Result {
uri, err := url.Parse(val.Uri)
if err != nil {
logger.Warningf("image with ID %q had invalid resource URI %q", val.Name, val.Uri)
continue
}
requestUri := strings.Split... | |
c4771 | images from the oracle market",
)
}
for _, val := range resp.Result {
if strings.Contains(val.Name, id) {
s := strings.Split(val.Name, "/")
return s[len(s)-1], nil
}
}
return "", errors.NotFoundf("image not found: %q", id)
} | |
c4772 | return errors.NotValidf("nil Handler")
}
return nil
} | |
c4773 | Site: &sw.catacomb,
Work: sw.loop,
})
if err != nil {
return nil, errors.Trace(err)
}
return sw, nil
} | |
c4774 | return &managedFilesystemSource{
logAndExec,
&osDirFuncs{logAndExec},
volumeBlockDevices, filesystems,
}
} | |
c4775 | last = r
}
return !unicode.IsDigit(last)
} | |
c4776 | ctx.machineChanges)
if err != nil {
ctx.kill(errors.Trace(err))
} else if err := ctx.addWorker(w); err != nil {
ctx.kill(errors.Trace(err))
} else {
ctx.machines[tag] = w
}
} | |
c4777 | else if params.IsCodeNotFound(err) {
// Machine is gone, so stop watching.
return stopAndRemove()
}
return errors.Annotate(err, "getting machine instance ID")
}
machineProvisioned(ctx, tag, instance.Id(results[0].Result))
// machine provisioning is the only thing we care about;
// stop the watcher.
retu... | |
c4778 | id, params)
}
for id, params := range ctx.incompleteFilesystemAttachmentParams {
if params.Machine != tag || params.InstanceId != "" {
continue
}
params.InstanceId = instanceId
updatePendingFilesystemAttachment(ctx, id, params)
}
} | |
c4779 |
inputs = append(inputs, config.RaftName)
}
return dependency.Manifold{
Inputs: inputs,
Start: config.start,
}
} | |
c4780 | application, nor machine id, start watching when machine id assigned.", unitName)
w.metrics.LXDProfileChangeError.Inc()
continue
}
chURL := app.CharmURL()
info := appInfo{
charmURL: chURL,
units: set.NewStrings(unitName),
}
ch, err := w.modeler.Charm(chURL)
if err != nil {
return err
... | |
c4781 | lxdProfile := ch.LXDProfile()
if (!info.charmProfile.Empty() && lxdProfile.Empty()) || !lxdProfile.Empty() {
logger.Tracef("notifying due to change of charm lxd profile for %s, machine-%s", appName, w.machineId)
notify = true
} else {
logger.Tracef("no notification of charm lxd profile needed for %s, mac... | |
c4782 | return
}
if w.machineId != principal.MachineId() {
logger.Tracef("watching unit changes on machine-%s not machine-%s", w.machineId, unitMachineId)
return
}
case w.machineId != unitMachineId:
logger.Tracef("watching unit changes on machine-%s not machine-%s", w.machineId, unitMachineId)
return
}
lo... | |
c4783 | if !ok {
w.logError("programming error, value not of type unitLXDProfileRemove")
return
}
app, ok := w.applications[rUnit.appName]
if !ok {
w.logError("programming error, unit removed before being added, application name not found")
return
}
if !app.units.Contains(rUnit.name) {
return
}
profile := ap... | |
c4784 | logger.Tracef("notifying due to machine-%s now provisioned", w.machineId)
w.metrics.LXDProfileChangeHit.Inc()
w.notify()
} | |
c4785 |
return multiwatcher.MachineJob(fmt.Sprintf("<unknown job %d>", int(job)))
} | |
c4786 | len(jobs))
for i, machineJob := range jobs {
jujuJobs[i] = machineJob.ToParams()
}
return jujuJobs
} | |
c4787 | {
return value
}
return "unknown"
} | |
c4788 | {
return instance.ContainerType(m.doc.ContainerType)
} | |
c4789 | doesn't exist, that's ok; there's nothing to keep,
// but that's not an error we care about.
return errors.Annotatef(onAbort(err, nil), "cannot set KeepInstance on machine %v", m)
}
return nil
} | |
c4790 | return false, err
}
return instData.KeepInstance, nil
} | |
c4791 |
}
if err != nil {
return nil, err
}
return instData.CharmProfiles, nil
} | |
c4792 | ops := []txn.Op{{
C: instanceDataC,
Id: m.doc.DocID,
Assert: txn.DocExists,
Update: bson.D{{"$set", bson.D{{"charm-profiles", profiles}}}},
}}
return ops, nil
}
err := m.st.db().Run(buildTxn)
return errors.Annotatef(err, "cannot update profiles for %q to %s", m, strings.Join(profiles, ", "... | |
c4793 | {
return wantsVote(m.doc.Jobs, m.doc.NoVote)
} | |
c4794 | nil {
return errors.Trace(err)
}
m.doc.HasVote = hasVote
return nil
} | |
c4795 |
}}
if err := m.st.db().RunTransaction(ops); err != nil {
return fmt.Errorf("cannot set StopMongoUntilVersion %v: %v", m, onAbort(err, ErrDead))
}
m.doc.StopMongoUntilVersion = v.String()
return nil
} | |
c4796 | mongo.NewVersion(m.doc.StopMongoUntilVersion)
} | |
c4797 | "0" {
model, err := m.st.Model()
if err != nil {
return false, errors.Trace(err)
}
cfg, err := model.ModelConfig()
if err != nil {
return false, err
}
t := cfg.Type()
return t == "null" || t == "manual", nil
}
return false, nil
} | |
c4798 | {
return nil, errors.NotFoundf("agent binaries for machine %v", m)
}
tools := *m.doc.Tools
return &tools, nil
} | |
c4799 | return fmt.Errorf("empty series or arch")
}
return nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.