id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c4600 | := os.Stat(d.path)
return err == nil
} | |
c4601 |
di := diskInfo{&hi.ChangeVersion, hi.Kind == hooks.RelationJoined}
if err := utils.WriteYaml(path, &di); err != nil {
return err
}
// If write was successful, update own state.
d.state.Members[hi.RemoteUnit] = hi.ChangeVersion
if hi.Kind == hooks.RelationJoined {
d.state.ChangedPending = hi.RemoteUnit
} els... | |
c4602 | return nil, errors.Trace(err)
}
return config.NewWorker(Config{
Facade: facade,
})
} | |
c4603 | engine.APIManifold(
engine.APIManifoldConfig{config.APICallerName},
config.start,
)
} | |
c4604 | := range taggers {
tags, ok := tagger.ResourceTags()
if !ok {
continue
}
for k, v := range tags {
allTags[k] = v
}
}
allTags[JujuModel] = modelTag.Id()
allTags[JujuController] = controllerTag.Id()
return allTags
} | |
c4605 | ok := originTypes[ot]; !ok {
return errors.NewNotValid(nil, "unsupported origin type")
}
return nil
} | |
c4606 | OriginTypeMachine:
if !names.IsValidMachine(name) {
return errors.NewNotValid(nil, "bad machine name")
}
case OriginTypeUnit:
if !names.IsValidUnit(name) {
return errors.NewNotValid(nil, "bad unit name")
}
}
return nil
} | |
c4607 |
return originForAgent(OriginTypeMachine, tag, controller, model, ver)
} | |
c4608 |
return originForAgent(OriginTypeUnit, tag, controller, model, ver)
} | |
c4609 | Origin{}, errors.Annotate(err, "invalid tag")
}
return originForJuju(oType, tag.Id(), controller, model, ver), nil
} | |
c4610 | == "" && o.Type != OriginTypeUnknown {
return errors.NewNotValid(nil, "empty Name")
}
if err := o.Type.ValidateName(o.Name); err != nil {
return errors.Annotatef(err, "invalid Name %q", o.Name)
}
if !o.Software.isZero() {
if err := o.Software.Validate(); err != nil {
return errors.Annotate(err, "invalid ... | |
c4611 | sw.Version == version.Zero {
return errors.NewNotValid(nil, "empty Version")
}
return nil
} | |
c4612 | hostPorts to %+v", hpsToSet)
c.mu.Lock()
c.current = hpsToSet
c.mu.Unlock()
if err := c.setter.SetAPIHostPorts(hpsToSet); err != nil {
return fmt.Errorf("error setting addresses: %v", err)
}
return nil
} | |
c4613 | (result []instances.Instance, err error) {
return broker.manager.ListContainers()
} | |
c4614 |
// There's no InterfaceInfo we expect to get below.
_, err := prepareOrGetContainerInterfaceInfo(
broker.api,
machineID,
false, // maintain, do not allocate.
lxdLogger,
)
return err
} | |
c4615 | broker.manager.(container.LXDProfileNameRetriever)
if !ok {
return make([]string, 0), nil
}
return nameRetriever.LXDProfileNames(containerName)
} | |
c4616 | Type: c.Type,
Key: utils.UnescapeKey(c.Key),
OldValue: c.OldValue,
NewValue: c.NewValue,
}
} | |
c4617 | {
appChanges[i] = ch.coreChange()
}
sort.Sort(appChanges)
changes[appName] = appChanges
}
return changes
} | |
c4618 | }
}
if _, ok := g.doc.AssignedUnits[appName]; ok {
return nil, jujutxn.ErrNoOperations
}
if err := g.CheckNotComplete(); err != nil {
return nil, err
}
return assignGenerationAppTxnOps(g.doc.DocId, appName), nil
}
return errors.Trace(g.st.db().Run(buildTxn))
} | |
c4619 | if !assignedUnits.Contains(name) {
unit, err := g.st.Unit(name)
if err != nil {
return nil, errors.Trace(err)
}
ops = append(ops, assignGenerationUnitTxnOps(g.doc.DocId, appName, unit)...)
}
}
// If there are no units to add to the generation, quit here.
if len(ops) < 2 {
return nil, ... | |
c4620 | jujutxn.ErrNoOperations
}
unit, err := g.st.Unit(unitName)
if err != nil {
return nil, errors.Trace(err)
}
return assignGenerationUnitTxnOps(g.doc.DocId, appName, unit), nil
}
return errors.Trace(g.st.db().Run(buildTxn))
} | |
c4621 | as they were when each setting was first modified under the branch.
if branchHasDelta {
var err error
if newDelta, err = newDelta.ApplyDeltaSource(branchDelta); err != nil {
return nil, errors.Trace(err)
}
}
return []txn.Op{
{
C: generationsC,
Id: g.doc.DocId,
Assert: bson.D{{"$and"... | |
c4622 | 1)
if err != nil {
return nil, errors.Trace(err)
}
newGenId = id
}
// As a proxy for checking that the generation has not changed,
// Assert that the txn rev-no has not changed since we materialised
// this generation object.
ops := []txn.Op{
{
C: generationsC,
Id: g.doc.Doc... | |
c4623 | := col.FindId(g.doc.DocId).One(&doc); err != nil {
return errors.Trace(err)
}
g.doc = doc
return nil
} | |
c4624 | errors.Trace(m.st.AddBranch(branchName, userName))
} | |
c4625 | if err != nil {
return nil, errors.Trace(err)
}
return insertGenerationTxnOps(strconv.Itoa(id), branchName, userName, now), nil
}
err = st.db().Run(buildTxn)
if err != nil {
err = onAbort(err, ErrDead)
logger.Errorf("cannot add branch to the model: %v", err)
}
return err
} | |
c4626 | := m.st.Branches()
return b, errors.Trace(err)
} | |
c4627 | make([]*Generation, len(docs))
for i, d := range docs {
branches[i] = newGeneration(st, &d)
}
return branches, nil
} | |
c4628 | c.Type,
Key: utils.EscapeKey(c.Key),
OldValue: c.OldValue,
NewValue: c.NewValue,
}
}
return changes
} | |
c4629 | &PodSpecSetCommand{ctx: ctx}, nil
} | |
c4630 | defer m.mu.Unlock()
return m.id
} | |
c4631 | make([]network.Address, len(m.addresses))
copy(out, m.addresses)
return out
} | |
c4632 |
// If we end up here, then there are no addresses available in the
// specified space. This should not happen, because the configured
// space is used as a constraint when first enabling HA.
return "", errors.NotFoundf("addresses for machine %q in space %q", m.id, space)
} | |
c4633 | {
m.mu.Lock()
defer m.mu.Unlock()
return network.AddressesWithPort(m.addresses, port)
} | |
c4634 | _ := ret[0].([]containerizer.LinkLayerDevice)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4635 | := ret[0].(set.Strings)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4636 | ret0, _ := ret[0].(instance.ContainerType)
return ret0
} | |
c4637 | := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4638 | _ := ret[0].(map[string][]containerizer.LinkLayerDevice)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4639 | _ := ret[0].(*state.Machine)
return ret0
} | |
c4640 | "Raw", reflect.TypeOf((*MockMachine)(nil).Raw))
} | |
c4641 | := m.ctrl.Call(m, "RemoveAllAddresses")
ret0, _ := ret[0].(error)
return ret0
} | |
c4642 | m.ctrl.Call(m, "SetConstraints", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c4643 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetConstraints", reflect.TypeOf((*MockMachine)(nil).SetConstraints), arg0)
} | |
c4644 | := m.ctrl.Call(m, "SetDevicesAddresses", varargs...)
ret0, _ := ret[0].(error)
return ret0
} | |
c4645 | := m.ctrl.Call(m, "SetLinkLayerDevices", varargs...)
ret0, _ := ret[0].(error)
return ret0
} | |
c4646 | := m.ctrl.Call(m, "SetParentLinkLayerDevicesBeforeTheirChildren", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c4647 | err != nil {
return nil, err
}
return &executor{
file: file,
state: state,
acquireMachineLock: acquireLock,
}, nil
} | |
c4648 |
switch err := x.do(op, stepPrepare); errors.Cause(err) {
case ErrSkipExecute:
case nil:
if err := x.do(op, stepExecute); err != nil {
return err
}
default:
return err
}
return x.do(op, stepCommit)
} | |
c4649 | operation %v", op)
return x.do(op, stepCommit)
} | |
c4650 | if strings.HasPrefix(id, prefix) {
return id
}
return prefix + id
} | |
c4651 |
return ensureModelUUID(modelUUID, id)
}
return id
} | |
c4652 | return "", "", false
}
return parts[0], parts[1], true
} | |
c4653 | marshaling failed")
}
var out bson.D
err = bson.Unmarshal(bytes, &out)
if err != nil {
return nil, errors.Annotate(err, "bson unmarshaling failed")
}
return out, nil
} | |
c4654 | if err != nil {
return nil, err
}
result := make([][]network.HostPort, 0, len(servers)+1)
result = append(result, network.NewHostPorts(port, host))
result = append(result, servers...)
return result, nil
} | |
c4655 | "Client")
return &Client{ClientFacade: frontend, facade: backend, st: st}
} | |
c4656 | UnitTag, got %T %v", st.authTag, st.authTag)
}
return uniter.NewState(st, unitTag), nil
} | |
c4657 | return nil, errors.Errorf("expected names.MachineTag, got %T", tag)
}
} | |
c4658 | st.serverVersion, st.serverVersion != version.Zero
} | |
c4659 | error) {
if err := j.Validate(); err != nil {
return nil, err
}
return &j, nil
} | |
c4660 | make(map[string]set.Strings),
vocab: make(map[string][]interface{}),
}
} | |
c4661 | for _, blue := range blues {
v.conflicts[blue] = set.NewStrings(reds...)
}
} | |
c4662 | = set.NewStrings(unsupported...)
} | |
c4663 | interface{}) {
v.vocab[resolveAlias(attributeName)] = convertToSlice(allowedValues)
} | |
c4664 |
// merge existing values with new, ensuring uniqueness
writeUnique(currentValues)
newValues := convertToSlice(allowedValues)
writeUnique(newValues)
v.updateVocabularyFromMap(attributeName, unique)
} | |
c4665 | continue
}
for _, conflict := range conflicts.SortedValues() {
if attrSet.Contains(conflict) {
return fmt.Errorf("ambiguous constraints: %q overlaps with %q", attrTag, conflict)
}
}
}
return nil
} | |
c4666 | cons.hasAny(v.unsupported.Values()...)
} | |
c4667 | that all values are valid.
val := reflect.ValueOf(attrValue)
for i := 0; i < val.Len(); i++ {
if err := v.checkInVocab(attrTag, val.Index(i).Interface()); err != nil {
return err
}
}
} else {
if err := v.checkInVocab(attrTag, attrValue); err != nil {
return err
}
}
}
return nil
} | |
c4668 |
return nil
}
}
return fmt.Errorf(
"invalid constraint value: %v=%v\nvalid values are: %v", attributeName, attributeValue, validValues)
} | |
c4669 |
if _, ok := vAttr[k]; !ok {
vAttr[k] = v
}
}
return fromAttributes(vAttr)
} | |
c4670 | != nil {
return unsupported, err
}
if err := v.checkValidValues(cons); err != nil {
return unsupported, err
}
return unsupported, nil
} | |
c4671 | cons takes priority. We can't error here because we
// know that aConflicts contains valid attr names.
consFallbackMinusConflicts := consFallback.without(fallbackConflicts...)
// The result is cons with fallbacks coming from any
// non conflicting consFallback attributes.
return withFallbacks(cons, consFallbackMi... | |
c4672 | {
return nil, common.ErrPerm
}
if !admin {
return nil, common.ErrPerm
}
return &API{
metadata: st,
newEnviron: newEnviron,
}, nil
} | |
c4673 | []cloudimagemetadata.Metadata) {
for _, m := range ms {
all = append(all, parseMetadataToParams(m))
}
}
for _, ms := range found {
addAll(ms)
}
sort.Sort(metadataList(all))
return params.ListCloudImageMetadataResult{Result: all}, nil
} | |
c4674 | return params.ErrorResults{}, errors.Trace(err)
}
return params.ErrorResults{Results: all}, nil
} | |
c4675 | for i, imageId := range images.Ids {
err := api.metadata.DeleteMetadata(imageId)
all[i] = params.ErrorResult{common.ServerError(err)}
}
return params.ErrorResults{Results: all}, nil
} | |
c4676 | if err != nil {
results[i].Error = err
common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
continue
}
results[i].Filesystem = filesystem
}
return results, nil
} | |
c4677 | 2 {
return "", "", errors.Errorf(
"invalid filesystem ID %q; expected ID in format <lxd-pool>:<volume-name>", id,
)
}
return fields[0], fields[1], nil
} | |
c4678 |
results[i] = s.releaseFilesystem(filesystemId)
common.HandleCredentialError(IsAuthorisationFailure, results[i], ctx)
}
return results, nil
} | |
c4679 | instances[i].(*environInstance)
}
break
}
attachment, err := s.attachFilesystem(arg, inst)
if err != nil {
results[i].Error = errors.Annotatef(
err, "attaching %s to %s",
names.ReadableString(arg.Filesystem),
names.ReadableString(arg.Machine),
)
common.HandleCredentialError(IsAuthorisa... | |
c4680 | }
// ParseByteSizeString returns bytes, we want MiB.
size = uint64(n / (1024 * 1024))
}
if len(tags) > 0 {
// Update the volume's user-data with the given tags. This will
// include updating the model and controller UUIDs, so that the
// storage is associated with this controller and model.
if volume.C... | |
c4681 | if c := jc.CpuCores; c != nil {
sc.cores = *c
} else {
sc.cores = 1
}
if p := jc.CpuPower; p != nil {
sc.power = *p
} else {
if sc.cores == 1 {
// The default of cpu power is 2000 Mhz
sc.power = defaultCPUPower
} else {
// The maximum amount of cpu per smp is 2300
sc.power = sc.cores * defau... | |
c4682 | reader.Seek(0, os.SEEK_SET); err != nil {
return Content{}, errors.Trace(err)
}
size := sizer.Size()
content := Content{
Data: reader,
Size: size,
Fingerprint: fp,
}
return content, nil
} | |
c4683 | }
if err := gce.createDisk(zone, d); err != nil {
return []*Disk{}, errors.Annotatef(err, "cannot create disk %q", disk.Name)
}
results[i] = NewDisk(d)
}
return results, nil
} | |
c4684 | := make([]*Disk, len(computeDisks))
for i, disk := range computeDisks {
disks[i] = NewDisk(disk)
}
return disks, nil
} | |
c4685 | return nil, errors.Annotatef(err, "cannot get disk %q in zone %q", name, zone)
}
return NewDisk(d), nil
} | |
c4686 | := gce.raw.SetDiskLabels(gce.projectID, zone, name, labelFingerprint, labels)
return errors.Annotatef(err, "cannot update labels for disk %q in zone %q", name, zone)
} | |
c4687 | string(mode),
}
err = gce.raw.AttachDisk(gce.projectID, zone, instanceId, attachedDisk)
if err != nil {
return nil, errors.Annotate(err, "cannot attach disk")
}
return &AttachedDisk{
VolumeName: volumeName,
DeviceName: attachedDisk.DeviceName,
Mode: mode,
}, nil
} | |
c4688 | gce.raw.DetachDisk(gce.projectID, zone, instanceId, dn)
if err != nil {
return errors.Annotatef(err, "cannot detach %q from %q", dn, instanceId)
}
return nil
} | |
c4689 | disks {
att[i] = &AttachedDisk{
VolumeName: sourceToVolumeName(disk.Source),
DeviceName: disk.DeviceName,
Mode: DiskMode(disk.Mode),
}
}
return att, nil
} | |
c4690 | map[string]params.NetworkInfoResult{}, ErrRestrictedContext
} | |
c4691 | error {
return ErrRestrictedContext
} | |
c4692 | ret0, _ := ret[0].(names_v2.ControllerTag)
return ret0
} | |
c4693 | mock.recorder = &MockModelMockRecorder{mock}
return mock
} | |
c4694 | m.ctrl.Call(m, "Branch", arg0)
ret0, _ := ret[0].(modelgeneration.Generation)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4695 | := ret[0].([]modelgeneration.Generation)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c4696 | "ModelTag", reflect.TypeOf((*MockModel)(nil).ModelTag))
} | |
c4697 | mock.recorder = &MockGenerationMockRecorder{mock}
return mock
} | |
c4698 | "AssignAllUnits", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c4699 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AssignUnit", reflect.TypeOf((*MockGeneration)(nil).AssignUnit), arg0)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.