id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c3800 | := results.Results[0]
if result.Error != nil {
return "", "", result.Error
}
// TODO(perrito666) add status validation.
return status.Status(result.Status), result.Info, nil
} | |
c3801 |
}
err := m.st.facade.FacadeCall("SetModificationStatus", args, &result)
if err != nil {
return err
}
return result.OneError()
} | |
c3802 | != 1 {
return "", fmt.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
return "", result.Error
}
return result.Result, nil
} | |
c3803 | Volumes: volumes,
VolumeAttachments: volumeAttachments,
NetworkConfig: networkConfig,
CharmProfiles: charmProfiles,
}},
}
err := m.st.facade.FacadeCall("SetInstanceInfo", args, &result)
if err != nil {
return err
}
return result.OneError()
} | |
c3804 | nil {
return nil, err
}
if len(results.Results) != 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
}
w := apiwatcher.NewStringsWatcher(m.st.facade.RawAPICaller(), result)
return w, nil
} | |
c3805 | != 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
}
w := apiwatcher.NewStringsWatcher(m.st.facade.RawAPICaller(), result)
return w, nil
} | |
c3806 | {
return err
}
if len(results.Results) != 1 {
return fmt.Errorf("expected 1 result, got %d", len(results.Results))
}
apiError := results.Results[0].Error
if apiError != nil {
return apiError
}
return nil
} | |
c3807 |
if err != nil {
return nil, false, err
}
if len(results.Results) != 1 {
return nil, false, errors.Errorf("expected 1 result, got %d", len(results.Results))
}
apiError := results.Results[0].Error
if apiError != nil {
return nil, false, apiError
}
result := results.Results[0]
return result.ContainerTypes,... | |
c3808 | return fmt.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
return result.Error
}
return nil
} | |
c3809 | }
if termId.Revision == 0 {
return errors.Errorf("must specify a valid term revision %q", t)
}
c.terms = append(c.terms, term{owner: termId.Owner, name: termId.Name, revision: termId.Revision})
c.termIds = append(c.termIds, t)
}
if len(c.terms) == 0 {
return errors.New("must specify a valid term revisio... | |
c3810 |
return manager.Claimer(applicationLeadershipNamespace, st.modelUUID())
}},
}
} | |
c3811 |
return manager.Checker(applicationLeadershipNamespace, st.modelUUID())
}},
}
} | |
c3812 | ops, err := buildTxn(attempt)
if err == jujutxn.ErrNoOperations {
return nil, jujutxn.ErrNoOperations
} else if err != nil {
return nil, errors.Trace(err)
}
return append(prereqs, ops...), nil
}
} | |
c3813 | key := range logIndexes {
err := logsColl.EnsureIndex(mgo.Index{Key: key})
if err != nil {
return errors.Annotate(err, "cannot create index for logs collection")
}
}
return nil
} | |
c3814 | fmt.Sprintf("%s#%s", modelUUID, sink),
model: modelUUID,
sink: sink,
session: session,
}
} | |
c3815 | Sink: logger.sink,
RecordID: recID,
RecordTimestamp: recTimestamp,
},
)
return errors.Trace(err)
} | |
c3816 | 0, errors.Trace(ErrNeverForwarded)
}
return 0, 0, errors.Trace(err)
}
return doc.RecordID, doc.RecordTimestamp, nil
} | |
c3817 | Id: bson.NewObjectId(),
Time: r.Time.UnixNano(),
Entity: r.Entity.String(),
Version: versionString,
Module: r.Module,
Location: r.Location,
Level: int(r.Level),
Message: r.Message,
})
}
_, err := bulk.Run()
return errors.Annotatef(err, "inserting %d log record(s)", len(re... | |
c3818 | logger.logsColl.Database.Session.Close()
}
} | |
c3819 | newRecentIdTracker(maxRecentLogIds),
maxInitialLines: maxInitialLines,
}
t.tomb.Go(func() error {
defer close(t.logCh)
defer session.Close()
err := t.loop()
return errors.Cause(err)
})
return t, nil
} | |
c3820 | return t.tomb.Wait()
} | |
c3821 | {
session, db := initLogsSessionDB(st)
return session, db.C(logCollectionName(st.ModelUUID()))
} | |
c3822 | return 0, errors.Trace(err)
}
total += size
}
return total, nil
} | |
c3823 | range names {
if !strings.HasPrefix(name, logsCPrefix) {
continue
}
uuid := name[len(logsCPrefix):]
result[uuid] = db.C(name)
}
return result, nil
} | |
c3824 | return "", -1, errors.Trace(err)
}
if count > maxCount {
maxModelUUID = modelUUID
maxCount = count
}
}
return maxModelUUID, maxCount, nil
} | |
c3825 | return -1, errors.Annotate(err, "failed to get log count")
}
return count, nil
} | |
c3826 | machineGroup, err = c.ensureGroup(ctx, c.globalGroupName(controllerUUID), nil)
}
if err != nil {
return nil, errors.Trace(err)
}
groupNames := []string{jujuGroup.Name, machineGroup.Name}
if c.environ.ecfg().useDefaultSecurityGroup() {
groupNames = append(groupNames, "default")
}
return groupNames, nil
} | |
c3827 | }
return *group, nil
}
}
// The new group is created so now add the rules.
group.Rules = make([]nova.SecurityGroupRule, len(rules))
for i, rule := range rules {
rule.ParentGroupId = group.Id
if rule.Cidr == "" {
// http://pad.lv/1226996 Rules that don't have a CIDR
// are meant to apply only to this... | |
c3828 | deleteSecurityGroupsMatchingName(ctx, c.deleteSecurityGroups, c.jujuGroupRegexp())
} | |
c3829 |
return deleteSecurityGroupsOneOfNames(ctx, c.deleteSecurityGroups, names...)
} | |
c3830 | portRange.Protocol &&
*rule.FromPort == portRange.FromPort &&
*rule.ToPort == portRange.ToPort
} | |
c3831 | }
result.List = make([]params.BackupsMetadataResult, len(metaList))
for i, meta := range metaList {
result.List[i] = CreateResult(meta, "")
}
return result, nil
} | |
c3832 | return nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if err := result.Error; err != nil {
return nil, err
}
return result.Result, nil
} | |
c3833 | nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
// TODO: Not directly tested
return nil, result.Error
}
w := apiwatcher.NewNotifyWatcher(st.facade.RawAPICaller(), result)
return w, nil
} | |
c3834 | }
return prechecker.PrecheckInstance(
CallContext(st),
environs.PrecheckInstanceParams{
Series: series,
Constraints: cons,
Placement: placement,
VolumeAttachments: volumeAttachments,
})
} | |
c3835 | if err != nil {
return constraints.Value{}, err
}
modelCons, err := st.ModelConstraints()
if err != nil {
return constraints.Value{}, err
}
return validator.Merge(modelCons, cons)
} | |
c3836 | nil {
return nil, err
}
return validator.Validate(cons)
} | |
c3837 | return nil, err
}
if configValidator == nil {
return nil, errors.New("policy returned nil configValidator without an error")
}
return configValidator.Validate(cfg, old)
} | |
c3838 | m.mu.Unlock()
return m.details.Id
} | |
c3839 | == "" {
return "", errors.NotProvisionedf("machine %v", m.details.Id)
}
return instance.Id(m.details.InstanceId), nil
} | |
c3840 | m.mu.Unlock()
return m.details.CharmProfiles
} | |
c3841 |
return result, errors.NotFoundf("principal unit %q for subordinate %s", unit.details.Principal, unitName)
}
if principalUnit.details.MachineId == m.details.Id {
result = append(result, unit)
}
}
}
return result, nil
} | |
c3842 | that is in the list.
cost := len(machineSizeCost)
sizeName := to.String(size.Name)
for i, name := range machineSizeCost {
if sizeName == name {
cost = i
break
}
}
if cost == len(machineSizeCost) {
logger.Debugf("found unknown VM size %q", sizeName)
}
vtype := "Hyper-V"
return instances.InstanceTyp... | |
c3843 | var value uint64 = defaultMem
result.Mem = &value
}
return result
} | |
c3844 | err := firewaller.NewClient(apiCaller)
if err != nil {
return nil, errors.Trace(err)
}
return facade, nil
} | |
c3845 | return nil, errors.Trace(err)
}
return w, nil
} | |
c3846 | nil {
return nil, errors.Trace(err)
}
facade := crossmodelrelations.NewClient(conn)
return &crossModelFirewallerFacadeCloser{facade, conn}, nil
}
} | |
c3847 | "getting new updater")
}
w := &updaterWorker{
config: config,
updater: updater,
}
w.tomb.Go(w.loop)
return w, nil
} | |
c3848 | r.st.setRelationStatus(r.id, status)
} | |
c3849 | := r.st.relation(r.tag, r.st.unitTag)
if err != nil {
return nil, err
}
return &Endpoint{r.toCharmRelation(result.Endpoint.Relation)}, nil
} | |
c3850 | {
return modelcmd.Wrap(&ListCommand{deps: deps})
} | |
c3851 |
AgentEntityWatcher: common.NewAgentEntityWatcher(st, resources, getCanRead),
APIAddresser: common.NewAPIAddresser(st, resources),
NetworkConfigAPI: networkingcommon.NewNetworkConfigAPI(st, state.CallContext(st), getCanModify),
st: st,
auth: authorizer,
getCanModify: ... | |
c3852 | machine, err := api.getMachine(tag)
if err != nil {
result.Results[i].Error = common.ServerError(err)
continue
}
machineJobs := machine.Jobs()
jobs := make([]multiwatcher.MachineJob, len(machineJobs))
for i, job := range machineJobs {
jobs[i] = job.ToParams()
}
result.Results[i].Jobs = jobs
}
... | |
c3853 | return m.state.db().GetCollection(name)
} | |
c3854 | error {
return m.state.db().Run(buildTxn)
} | |
c3855 | member
} else {
result.Members = append(result.Members, member)
}
machines = append(machines, m)
}
rsMembers, err := replicaset.CurrentMembers(st.session)
if err != nil {
return UpgradeMongoParams{}, errors.Annotate(err, "cannot obtain current replicaset members")
}
masterRs, err := replicaset.MasterHo... | |
c3856 | replicaset.Add(st.session, members...)
} | |
c3857 | nil, common.ErrPerm
}
return &CleanerAPI{
st: getState(st),
resources: res,
}, nil
} | |
c3858 | NotifyWatcherId: api.resources.Register(watch),
}, nil
}
return params.NotifyWatchResult{
Error: common.ServerError(watcher.EnsureErr(watch)),
}, nil
} | |
c3859 |
if err != nil {
return err
}
logger.Infof("upgraded from %v to %v (%q)", e.OldTools, agentTools.Version, agentTools.URL)
return nil
} | |
c3860 | hard to test.
serviceError, ok = ociCommon.IsServiceError(err)
}
if ok && authErrorCodes.Contains(serviceError.GetCode()) {
return true
}
return false
} | |
c3861 | common.HandleCredentialError(IsAuthorisationFailure, err, ctx)
} | |
c3862 |
return nil, errors.Annotate(err, "cannot read controller config")
}
orchestrator, err := newOrchestratorForController(OrchestratorArgs{
ControllerUUID: controllerCfg.ControllerUUID(),
LogForwardConfig: agentFacade,
Caller: apiCaller,
Sinks: config.Sinks,
OpenLogStr... | |
c3863 | storage,
Firewall: networking,
Identity: identity,
ociConfig: provider,
clock: clock.WallClock,
p: e,
}
if err := env.SetConfig(params.Config); err != nil {
return nil, err
}
env.namespace, err = instance.NewNamespace(env.Config().UUID())
cfg := env.ecfg()
if cfg.compartmentID()... | |
c3864 | configFields, configDefaults,
)
if err != nil {
return nil, err
}
return cfg.Apply(newAttrs)
} | |
c3865 | ctrl}
mock.recorder = &MockLinkLayerDeviceMockRecorder{mock}
return mock
} | |
c3866 | _ := ret[0].([]*state.Address)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3867 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Addresses", reflect.TypeOf((*MockLinkLayerDevice)(nil).Addresses))
} | |
c3868 | _ := ret[0].(state.LinkLayerDeviceArgs)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3869 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EthernetDeviceForBridge", reflect.TypeOf((*MockLinkLayerDevice)(nil).EthernetDeviceForBridge), arg0)
} | |
c3870 | ret0, _ := ret[0].(bool)
return ret0
} | |
c3871 | ret0, _ := ret[0].(uint)
return ret0
} | |
c3872 | := m.ctrl.Call(m, "ParentDevice")
ret0, _ := ret[0].(containerizer.LinkLayerDevice)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3873 | mock.recorder = &MockUnitMockRecorder{mock}
return mock
} | |
c3874 |
mock.recorder = &MockApplicationMockRecorder{mock}
return mock
} | |
c3875 | mock.recorder = &MockCharmMockRecorder{mock}
return mock
} | |
c3876 | there instead of passing it like that.
f.StringVar(&c.dataDir, "data-dir", util.DataDir, "directory for juju data")
} | |
c3877 | return util.RequiredError("data-dir")
}
return cmd.CheckEmpty(args)
} | |
c3878 | err := agent.ReadConfig(agent.ConfigPath(c.dataDir, t))
if err != nil {
return errors.Trace(err)
}
c._config = conf
return nil
} | |
c3879 | != nil {
return errors.Trace(err)
}
if err := c._config.Write(); err != nil {
return errors.Annotate(err, "cannot write agent configuration")
}
return nil
} | |
c3880 | defer c.mu.Unlock()
return c._config.Clone()
} | |
c3881 |
if config == nil {
return version.Number{}, errors.Errorf("%s agent conf is not found", machineAgent)
}
return config.UpgradedToVersion(), nil
} | |
c3882 | mock.recorder = &MockRunnerMockRecorder{mock}
return mock
} | |
c3883 | m.ctrl.Call(m, "MaybePruneTransactions", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c3884 | ret0, _ := ret[0].(error)
return ret0
} | |
c3885 | "ResumeTransactions", reflect.TypeOf((*MockRunner)(nil).ResumeTransactions))
} | |
c3886 | {
ret := m.ctrl.Call(m, "Run", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c3887 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockRunner)(nil).Run), arg0)
} | |
c3888 | mock.recorder = &MockEnvironMockRecorder{mock}
return mock
} | |
c3889 | _ := ret[0].([]instances.Instance)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3890 | arg1, arg2)
ret0, _ := ret[0].(*environs.BootstrapResult)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3891 |
ret0, _ := ret[0].([]instance.Id)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3892 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DestroyController", reflect.TypeOf((*MockEnviron)(nil).DestroyController), arg0, arg1)
} | |
c3893 | "Provider", reflect.TypeOf((*MockEnviron)(nil).Provider))
} | |
c3894 | &kubernetesClient{
clock: clock,
clientUnlocked: k8sClient,
apiextensionsClientUnlocked: apiextensionsClient,
envCfgUnlocked: newCfg.Config,
namespace: newCfg.Name(),
modelUUID: modelUUID,
newWatcher: new... | |
c3895 | return k.annotations.Add(key, value)
} | |
c3896 | k.lock.Unlock()
cfg := k.envCfgUnlocked
return cfg
} | |
c3897 |
}
if !errors.IsNotFound(err) {
return errors.Trace(err)
}
// Good, no existing namespace has the same name.
// Now, try to find if there is any existing controller running in this cluster.
// Note: we have to do this check before we are confident to support multi controllers running in same k8s cluster.
_, e... | |
c3898 | error {
// must raise errors.AlreadyExistsf if it's already exist.
return k.createNamespace(k.namespace)
} | |
c3899 | we avoid it in broker.PrepareForBootstrap before reaching here.
return errors.NotValidf("existing namespace %q found", broker.namespace)
}
return errors.Trace(err)
}
if err := setControllerNamespace(pcfg.ControllerName, k); err != nil {
return errors.Trace(err)
}
// create configmap, secret, vol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.