id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c3700 | results.Results[i].Error = common.ServerError(err)
continue
}
results.Results[i].Result = scale
}
logger.Debugf("provisioning info result: %#v", results)
return results, nil
} | |
c3701 | info, err := f.provisioningInfo(model, arg.Tag)
if err != nil {
results.Results[i].Error = common.ServerError(err)
continue
}
results.Results[i].Result = info
}
return results, nil
} | |
c3702 |
f.storagePoolManager, f.registry,
)
if err != nil {
return nil, errors.Annotatef(err, "getting filesystem %q parameters", name)
}
for i := 0; i < int(cons.Count); i++ {
charmStorage := ch.Meta().Storage[name]
id := fmt.Sprintf("%s/%v", name, i)
tag := names.NewStorageTag(id)
location, err := ... | |
c3703 |
}
for i, arg := range args.Entities {
result, err := f.getApplicationConfig(arg.Tag)
results.Results[i].Config = result
results.Results[i].Error = common.ServerError(err)
}
return results, nil
} | |
c3704 | &now,
})
if err != nil {
result.Results[i].Error = common.ServerError(err)
continue
}
}
err = a.updateUnitsFromCloud(app, appUpdate.Scale, appUpdate.Units)
if err != nil {
// Mask any not found errors as the worker (caller) treats them specially
// and they are not relevant here.
result... | |
c3705 |
Message: params.Info,
}
containerStatus = status.Waiting
case status.Running:
// A pod has finished starting so the workload is now active.
agentStatus = &status.StatusInfo{
Status: status.Idle,
}
containerStatus = status.Running
case status.Error:
agentStatus = &status.StatusInfo{
Status: st... | |
c3706 | result.Results[i].Error = common.ServerError(err)
continue
}
if err := app.UpdateCloudService(appUpdate.ProviderId, params.NetworkAddresses(appUpdate.Addresses...)); err != nil {
result.Results[i].Error = common.ServerError(err)
}
}
return result, nil
} | |
c3707 | now := a.clock.Now()
s := status.StatusInfo{
Status: status.Status(arg.Status),
Message: arg.Info,
Data: arg.Data,
Since: &now,
}
if err := app.SetOperatorStatus(s); err != nil {
result.Results[i].Error = common.ServerError(err)
}
}
return result, nil
} | |
c3708 | {
return nil, errors.Errorf("wrong component context type registered: %T", found)
}
return compCtx, nil
} | |
c3709 |
return errors.NotValidf("empty AuthTag")
}
if info.Password == "" && len(info.Macaroons) == 0 {
return errors.NotValidf("missing Password & Macaroons")
}
return nil
} | |
c3710 | simplestreams.UnsignedIndex(currentStreamsVersion, IndexFileVersion))
} | |
c3711 |
existingMetadata, _, err := Fetch([]simplestreams.DataSource{dataSource}, imageConstraint)
if err != nil && !errors.IsNotFound(err) {
return nil, err
}
return existingMetadata, nil
} | |
c3712 | im.productId(), im.RegionName, im.VirtType, im.Storage)
} | |
c3713 | i, im := range newMetadata {
newRecord := *im
newRecord.Version = seriesVersion
newRecord.RegionName = cloudSpec.Region
newRecord.Endpoint = cloudSpec.Endpoint
toWrite[i] = &newRecord
imageIds[mapKey(&newRecord)] = true
addDistinctCloudSpec(&newRecord)
}
for _, im := range existingMetadata {
if _, ok... | |
c3714 |
{IndexStoragePath(), index},
{ProductMetadataStoragePath(), products},
}
for _, md := range metadataInfo {
err = metadataStore.Put(md.Path, bytes.NewReader(md.Data), int64(len(md.Data)))
if err != nil {
return err
}
}
return nil
} | |
c3715 |
p.toRemove = append(p.toRemove, docIDInt64(p.modelUUID, seq))
} | |
c3716 | p.toRemove}})
if err != nil {
return err
}
p.toRemove = p.toRemove[:0]
if matched.Removed > 0 {
p.removedCount += uint64(matched.Removed)
}
return err
} | |
c3717 |
beingsC: beings,
maxQueue: 1000,
pingsC: pings,
delta: delta,
}
} | |
c3718 | return newEnviron(st)
}
return NewAgentToolsAPI(st, newEnviron, findTools, envVersionUpdate, authorizer)
} | |
c3719 | modelGetter,
newEnviron: newEnviron,
authorizer: authorizer,
findTools: findTools,
envVersionUpdate: envVersionUpdate,
}, nil
} | |
c3720 | env.UpdateLatestToolsVersion(ver)
} | |
c3721 | updateToolsAvailability(api.modelGetter, api.newEnviron, api.findTools, api.envVersionUpdate)
} | |
c3722 | of type %T, got %T", endpoints, value)
}
return formatFoundEndpointsTabular(writer, endpoints)
} | |
c3723 | := range one.Endpoints {
interfaces = append(interfaces, fmt.Sprintf("%s:%s", ep.Interface, name))
}
sort.Strings(interfaces)
w.Println(store, url.String(), one.Access, strings.Join(interfaces, ", "))
}
tw.Flush()
return nil
} | |
c3724 | append(parts, u.ModelName)
}
path := strings.Join(parts, "/")
path = fmt.Sprintf("%s.%s", path, u.ApplicationName)
if u.Source == "" {
return path
}
return fmt.Sprintf("%s:%s", u.Source, path)
} | |
c3725 | return nil, err
}
url := OfferURL(*urlParts)
return &url, nil
} | |
c3726 |
return base
}
return fmt.Sprintf("%s:%s", controller, base)
} | |
c3727 |
return nil, errors.Trace(err)
}
env := &environ{
name: args.Config.Name(),
cloud: args.Cloud,
client: client,
}
if err := env.SetConfig(args.Config); err != nil {
return nil, err
}
return env, nil
} | |
c3728 | := validateConfig(old, nil)
if err != nil {
return nil, errors.Errorf("invalid base config: %v", err)
}
if newEcfg, err = validateConfig(cfg, oldEcfg); err != nil {
return nil, errors.Errorf("invalid config change: %v", err)
}
}
return newEcfg.Config, nil
} | |
c3729 | if err != nil {
cleanupLogger.Warningf("failed to cleanup %v - will retry later", err)
return nil
}
select {
case notify <- "cleanupCalled":
default:
}
return nil
}
return jworker.NewPeriodicWorker(f, cleanupPeriod, jworker.NewTimer)
} | |
c3730 | return nil, errors.Trace(err)
}
ig, err := e.ensureInternetGateway(controllerUUID, modelUUID, vcn.Id)
if err != nil {
providerCommon.HandleCredentialError(err, ctx)
return nil, errors.Trace(err)
}
// Create a default route through the gateway created above
// as a default gateway
prefix := AllowAllPrefix... | |
c3731 |
if err := e.removeSeclist(secList); err != nil {
return errors.Trace(err)
}
if err := e.deleteRouteTable(controllerUUID, modelUUID, vcn.Id); err != nil {
return errors.Trace(err)
}
if err := e.deleteInternetGateway(vcn.Id); err != nil {
return errors.Trace(err)
}
if err := e.removeVCN(vcn); ... | |
c3732 | implement metrics")
}
for _, m := range m.doc.Metrics {
if err := chrmMetrics.ValidateMetric(m.Key, m.Value); err != nil {
return errors.Trace(err)
}
}
return nil
} | |
c3733 | }
buildTxn := func(attempt int) ([]txn.Op, error) {
if attempt > 0 {
notDead, err := isNotDead(st, unitsC, batch.Unit.Id())
if err != nil || !notDead {
return nil, errors.NotFoundf(batch.Unit.Id())
}
exists, err := st.MetricBatch(batch.UUID)
if exists != nil && err == nil {
return nil, errors... | |
c3734 | }
if !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
}
ops := []txn.Op{{
C: metricsC,
Id: metric.UUID(),
Assert: txn.DocMissing,
Insert: &metric.doc,
}}
return ops, nil
}
err = st.db().Run(buildTxn)
if err != nil {
return nil, errors.Trace(err)
}
return metric, ... | |
c3735 | return nil, errors.Trace(err)
}
return st.queryMetricBatches(bson.M{"unit": unit})
} | |
c3736 | st.queryMetricBatches(bson.M{"model-uuid": st.ModelUUID()})
} | |
c3737 |
}
unitNames := make([]bson.M, len(units))
for i, u := range units {
unitNames[i] = bson.M{"unit": u.Name()}
}
return st.queryMetricBatches(bson.M{"$or": unitNames})
} | |
c3738 | err := c.Find(bson.M{"_id": id}).One(&doc)
if err == mgo.ErrNotFound {
return nil, errors.NotFoundf("metric %v", id)
}
if err != nil {
return nil, err
}
return &MetricBatch{st: st, doc: doc}, nil
} | |
c3739 | if err != nil {
return nil, errors.Trace(err)
}
batch := make([]*MetricBatch, len(docs))
for i, doc := range docs {
batch[i] = &MetricBatch{st: st, doc: doc}
}
return batch, nil
} | |
c3740 |
defer closer()
return c.Find(bson.M{
"model-uuid": st.ModelUUID(),
"sent": false,
}).Count()
} | |
c3741 |
defer closer()
return c.Find(bson.M{
"model-uuid": st.ModelUUID(),
"sent": true,
}).Count()
} | |
c3742 | make([]Metric, len(m.doc.Metrics))
copy(result, m.doc.Metrics)
return result
} | |
c3743 | {
uniq[fmt.Sprintf("%s-%s", m.Key, labelsKey(m.Labels))] = m
}
results := make([]Metric, len(uniq))
i := 0
for _, m := range uniq {
results[i] = m
i++
}
sort.Sort(byKey(results))
return results
} | |
c3744 | if err := m.st.db().RunTransaction(ops); err != nil {
return errors.Annotatef(err, "cannot set metric sent for metric %q", m.UUID())
}
m.doc.Sent = true
m.doc.DeleteTime = deleteTime
return nil
} | |
c3745 | err != nil {
return errors.Annotatef(err, "cannot set metric sent in bulk call")
}
return nil
} | |
c3746 | &ActionSetCommand{ctx: ctx}, nil
} | |
c3747 | errors.Trace(err)
}
hash := sha256.New()
_, err = hash.Write(bytes)
if err != nil {
return "", errors.Trace(err)
}
return hex.EncodeToString(hash.Sum(nil)), nil
} | |
c3748 | ClientFacade: frontend,
facade: backend,
ControllerConfigAPI: common.NewControllerConfig(backend),
ModelStatusAPI: common.NewModelStatusAPI(backend),
}
} | |
c3749 | := cloudspec.NewCloudSpecAPI(c.facade, modelTag)
return api.CloudSpec()
} | |
c3750 |
}
hostedConfigs[i].Owner = tag
if modelConfig.Error != nil {
hostedConfigs[i].Error = errors.Trace(modelConfig.Error)
continue
}
hostedConfigs[i].Config = modelConfig.Config
spec, err := c.MakeCloudSpec(modelConfig.CloudSpec)
if err != nil {
hostedConfigs[i].Error = errors.Trace(err)
continue... | |
c3751 | return c.facade.FacadeCall("DestroyController", params.DestroyControllerArgs{
DestroyModels: args.DestroyModels,
DestroyStorage: args.DestroyStorage,
}, nil)
} | |
c3752 | c.facade.FacadeCall("ListBlockedModels", nil, &result)
return result.Models, err
} | |
c3753 | {
return c.modifyControllerUser(params.GrantControllerAccess, user, access)
} | |
c3754 | {
return c.modifyControllerUser(params.RevokeControllerAccess, user, access)
} | |
c3755 |
}
if len(results.Results) != 1 {
return "", errors.Errorf("expected 1 result, got %d", len(results.Results))
}
if err := results.Results[0].Error; err != nil {
return "", errors.Trace(err)
}
return permission.Access(results.Results[0].Result.Access), nil
} | |
c3756 |
return errors.Trace(
c.facade.FacadeCall("ConfigSet", params.ControllerConfigSet{Config: values}, nil),
)
} | |
c3757 |
if !names.IsValidUser(s.TargetUser) {
return errors.NotValidf("target user")
}
if s.TargetPassword == "" && len(s.TargetMacaroons) == 0 {
return errors.NotValidf("missing authentication secrets")
}
return nil
} | |
c3758 | leadershipChecker)
agentSetter := common.NewStatusSetter(&common.UnitAgentFinder{st}, getCanModify)
return &StatusAPI{
agentSetter: agentSetter,
unitSetter: unitSetter,
unitGetter: unitGetter,
applicationSetter: applicationSetter,
applicationGetter: applicationGetter,
getCanModify: ... | |
c3759 | {
return s.SetAgentStatus(args)
} | |
c3760 | return s.unitSetter.SetStatus(args)
} | |
c3761 | return s.applicationSetter.SetStatus(args)
} | |
c3762 | (params.StatusResults, error) {
return s.unitGetter.Status(args)
} | |
c3763 | {
return s.applicationGetter.Status(args)
} | |
c3764 | for _, rule := range rules {
w.Println(rule.KnownService, strings.Join(rule.WhitelistCIDRS, ","))
}
tw.Flush()
} | |
c3765 | defer s.mu.Unlock()
return s.store.FirstIndex()
} | |
c3766 |
defer s.mu.Unlock()
return s.store.GetLog(index, log)
} | |
c3767 | defer s.mu.Unlock()
return s.store.StoreLog(log)
} | |
c3768 |
defer s.mu.Unlock()
return s.store.StoreLogs(logs)
} | |
c3769 | defer s.mu.Unlock()
return s.store.DeleteRange(min, max)
} | |
c3770 | s.mu.Lock()
defer s.mu.Unlock()
return s.store.Close()
} | |
c3771 | doc should have already been validated when stored.
meta.FileMetadata.Raw.Size = doc.Size
meta.FileMetadata.Raw.Checksum = doc.Checksum
meta.FileMetadata.Raw.ChecksumFormat = doc.ChecksumFormat
}
if doc.Stored != 0 {
stored := metadocUnixToTime(doc.Stored)
meta.SetStored(&stored)
}
return meta
} | |
c3772 | nil {
doc.Finished = metadocTimeToUnix(*meta.Finished)
}
doc.Notes = meta.Notes
doc.Model = meta.Origin.Model
doc.Machine = meta.Origin.Machine
doc.Hostname = meta.Origin.Hostname
doc.Version = meta.Origin.Version
doc.Series = meta.Origin.Series
return doc
} | |
c3773 | db,
ServerSideTransactions: false,
})
dbWrap := storageDBWrapper{
session: session,
db: db,
metaColl: coll,
txnRunner: txnRunner,
modelUUID: modelUUID,
}
return &dbWrap
} | |
c3774 | errors.NotFoundf("backup metadata %q", id)
}
return errors.Trace(err)
} | |
c3775 | := b.metaColl.Find(nil).All(docs)
return errors.Trace(err)
} | |
c3776 | := b.metaColl.RemoveId(id)
return errors.Trace(err)
} | |
c3777 | b.metaColl.Name,
Id: id,
}
return op
} | |
c3778 | txn.Op {
op := b.txnOpBase(id)
op.Assert = txn.DocMissing
op.Insert = doc
return op
} | |
c3779 |
op.Update = bson.D{{"$set", bson.D(updates)}}
return op
} | |
c3780 |
err := b.txnRunner.RunTransaction(&jujutxn.Transaction{Ops: ops})
return errors.Trace(err)
} | |
c3781 | blobstore.NewGridFS(blobDB, blobDB, b.session)
return blobstore.NewManagedStorage(b.db, dataStore)
} | |
c3782 |
ServerSideTransactions: false,
})
dbWrap := storageDBWrapper{
session: session,
db: db,
metaColl: coll,
txnRunner: txnRunner,
modelUUID: b.modelUUID,
}
return &dbWrap
} | |
c3783 | if errors.Cause(err) == txn.ErrAborted {
return "", errors.AlreadyExistsf("backup metadata %q", doc.ID)
}
return "", errors.Annotate(err, "while running transaction")
}
return id, nil
} | |
c3784 | be of type *backups.Metadata")
}
metaDoc := newStorageMetaDoc(metadata)
dbWrap := s.dbWrap.Copy()
defer dbWrap.Close()
id, err := addStorageMetadata(dbWrap, &metaDoc)
return id, errors.Trace(err)
} | |
c3785 |
doc, err := getStorageMetadata(dbWrap, id)
if err != nil {
return nil, errors.Trace(err)
}
metadata := docAsMetadata(doc)
return metadata, nil
} | |
c3786 | make([]filestorage.Document, len(docs))
for i, doc := range docs {
meta := docAsMetadata(&doc)
list[i] = meta
}
return list, nil
} | |
c3787 | := s.dbWrap.Copy()
defer dbWrap.Close()
return errors.Trace(dbWrap.removeMetadataID(id))
} | |
c3788 | lp:1558657
err := setStorageStoredTime(dbWrap, id, time.Now())
return errors.Trace(err)
} | |
c3789 | := s.storeImpl.GetForBucket(s.modelUUID, s.path(id))
return file, errors.Trace(err)
} | |
c3790 |
return s.storeImpl.PutForBucket(s.modelUUID, s.path(id), file, size)
} | |
c3791 | s.storeImpl.RemoveForBucket(s.modelUUID, s.path(id))
} | |
c3792 |
return &UnitUpgraderAPI{
ToolsSetter: common.NewToolsSetter(st, getCanWrite),
st: st,
resources: resources,
authorizer: authorizer,
}, nil
} | |
c3793 |
watcherId, err = u.watchAssignedMachine(tag)
if err == nil {
result.Results[i].NotifyWatcherId = watcherId
}
}
result.Results[i].Error = common.ServerError(err)
}
return result, nil
} | |
c3794 | }
err = common.ErrPerm
if u.authorizer.AuthOwner(tag) {
result[i].Version, err = u.getMachineToolsVersion(tag)
}
result[i].Error = common.ServerError(err)
}
return params.VersionResults{Results: result}, nil
} | |
c3795 | copyUnits(gs.Units)
result.Relations = make(map[string]unitsGoalStateContents, len(gs.Relations))
for relation, units := range gs.Relations {
result.Relations[relation] = copyUnits(units)
}
return result
} | |
c3796 | charmSeries)
}
case IAAS:
if caasOS.Contains(os.String()) {
return errors.NotValidf("series %q in a non container model", charmSeries)
}
}
return nil
} | |
c3797 | return nil, errors.NotSupportedf("Firewall Rules for non-IAAS models")
}
return &stateShim{
State: st,
Model: m,
}, nil
} | |
c3798 | return &v, nil
}
return nil, errors.New("failed to get model's agent version.")
} | |
c3799 | != 1 {
return nil, fmt.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
return nil, result.Error
}
return result.Result, nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.