id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c4100 | continue
}
w.logger.Errorf("failed to unpin leader for application %q: %s", app, err.Error())
lastErr = err
}
if lastErr == nil {
w.leadersPinned = false
return nil
}
return errors.Trace(lastErr)
} | |
c4101 | return nil, errors.Trace(err)
}
return service.FindUnitServiceNames(services), nil
} | |
c4102 | range units {
unitIds[i] = u
i++
}
return strings.Join(unitIds, ", ")
} | |
c4103 | fmt.Sprintf(HTTPEndpointPath, application, name)
} | |
c4104 | = url.Query().Get(":resource")
return application, name
} | |
c4105 | `Basic realm="juju"`)
}
w.Header().Set("Content-Type", params.ContentTypeJSON)
w.Header().Set("Content-Length", fmt.Sprint(len(body)))
w.WriteHeader(statusCode)
w.Write(body)
} | |
c4106 | return config.Facade.SetModelStatus(config.ModelTag, s, info, nil)
}
if err := setStatus(status.Available, ""); err != nil {
return errors.Trace(err)
}
config.GateUnlocker.Unlock()
return nil
}), nil
} | |
c4107 | {
return nil, errors.Trace(err)
}
return &API{
access: getState(st, m),
authorizer: authorizer,
}, nil
} | |
c4108 |
entityResults := []params.AnnotationsGetResult{}
for _, entity := range args.Entities {
anEntityResult := params.AnnotationsGetResult{EntityTag: entity.Tag}
if annts, err := api.getEntityAnnotations(entity.Tag); err != nil {
anEntityResult.Error = params.ErrorResult{annotateError(err, entity.Tag, "getting")}... | |
c4109 | := api.setEntityAnnotations(entityAnnotation.EntityTag, entityAnnotation.Annotations)
if err != nil {
setErrors = append(setErrors,
params.ErrorResult{Error: annotateError(err, entityAnnotation.EntityTag, "setting")})
}
}
return params.ErrorResults{Results: setErrors}
} | |
c4110 | err != nil {
return errors.Trace(err)
}
if err := c.promptConfirmation(ctx, units); err != nil {
return errors.Trace(err)
}
if err = c.upgradeMachineSeriesClient.UpgradeSeriesPrepare(c.machineNumber, c.series, c.force); err != nil {
return errors.Trace(err)
}
if err = c.handleNotifications(ctx); err != n... | |
c4111 | for {
select {
case <-c.catacomb.Dying():
return c.catacomb.ErrDying()
case <-uw.Changes():
err = c.handleUpgradeSeriesChange(ctx, wid)
if err != nil {
return errors.Trace(err)
}
}
}
}
} | |
c4112 |
if err := c.handleNotifications(ctx); err != nil {
return errors.Trace(err)
}
m := UpgradeSeriesCompleteFinishedMessage + "\n"
ctx.Infof(m, c.machineNumber)
return nil
} | |
c4113 | fixed, also fix code in status.go for UnitAgent.
if info.Status == status.Error {
return status.StatusInfo{
Status: status.Idle,
Message: "",
Data: map[string]interface{}{},
Since: info.Since,
}, nil
}
return info, nil
} | |
c4114 | shouldBeAssigned {
return errors.Errorf("cannot set invalid status %q", unitAgentStatus.Status)
}
case status.Lost:
return errors.Errorf("cannot set status %q", unitAgentStatus.Status)
default:
return errors.Errorf("cannot set invalid status %q", unitAgentStatus.Status)
}
return setStatus(u.st.db(), setSt... | |
c4115 | = networkDefaultName
}
return networkPathRoot + name
} | |
c4116 | if using a reserved public IP)
})
// TODO(ericsnow) Will we need to support more access configs?
}
return &compute.NetworkInterface{
Network: ns.Path(),
AccessConfigs: access,
}
} | |
c4117 | sort.Strings(sortedProtocols)
for _, protocol := range sortedProtocols {
allowed := compute.FirewallAllowed{
IPProtocol: protocol,
Ports: ports.portStrings(protocol),
}
firewall.Allowed = append(firewall.Allowed, &allowed)
}
return &firewall
} | |
c4118 | != nil {
status[i].Error = ServerError(err)
continue
}
status[i] = modelStatus
}
return params.ModelStatusResults{Results: status}, nil
} | |
c4119 |
}
out[i] = params.ModelFilesystemInfo{
Id: in.Tag().Id(),
ProviderId: providerId,
Status: statusString,
Message: status.Message,
Detachable: in.Detachable(),
}
}
return out
} | |
c4120 |
}
out[i] = params.ModelVolumeInfo{
Id: in.Tag().Id(),
ProviderId: providerId,
Status: statusString,
Message: status.Message,
Detachable: in.Detachable(),
}
}
return out
} | |
c4121 | v.value = r.FakeId()
} else if !errors.IsNotFound(err) {
return nil, errors.Trace(err)
}
*result = id
return v, nil
} | |
c4122 | }
if _, err := v.ctx.Relation(id); err != nil {
return errors.Trace(err)
}
*v.result = id
v.value = value
return nil
} | |
c4123 | return ""
}
return UserFriendlyDuration(*when, now)
} | |
c4124 | modelInfo.Status = status
}
status.Migration = info.Migration.Status
status.MigrationStart = FriendlyDuration(info.Migration.Start, now)
status.MigrationEnd = FriendlyDuration(info.Migration.End, now)
}
if info.ProviderType != "" {
modelInfo.ProviderType = info.ProviderType
}
if len(info.Users) != 0 {
... | |
c4125 | return modelName
}
return jujuclient.JoinOwnerModelName(owner, modelName)
} | |
c4126 | CharmResourcesCommand
c.setResourceLister(resourceLister)
return modelcmd.Wrap(&c)
} | |
c4127 | := getCharmStoreAPIURL(conAPIRoot)
if err != nil {
return nil, errors.Trace(err)
}
client, err := charmstore.NewCustomClient(bakeryClient, csURL)
if err != nil {
return nil, errors.Trace(err)
}
return client.ListResources(ids)
} | |
c4128 | if newMaxAge != maxAge || newMaxCollectionMB != maxCollectionMB {
logger.Infof("status history config: max age: %v, max collection size %dM for %s (%s)",
newMaxAge, newMaxCollectionMB, modelConfig.Name(), modelConfig.UUID())
maxAge = newMaxAge
maxCollectionMB = newMaxCollectionMB
}
if timer == n... | |
c4129 | values failed")
}
cfg, err = provider.PrepareConfig(environs.PrepareConfigParams{
Cloud: cloud,
Config: cfg,
})
if err != nil {
return nil, errors.Annotate(err, "provider config preparation failed")
}
cfg, err = provider.Validate(cfg, nil)
if err != nil {
return nil, errors.Annotate(err, "provider conf... | |
c4130 | := args.Client.ProvisioningScript(params.ProvisioningScriptParams{
MachineId: machineId,
Nonce: machineParams.Nonce,
DisablePackageCommands: !args.EnableOSRefreshUpdate && !args.EnableOSUpgrade,
})
if err != nil {
logger.Errorf("cannot obtain provisioning script")
return "", ... | |
c4131 | return credentialvalidator.NewFacade(apiCaller), nil
} | |
c4132 | dying,
InvalidateCredentialFunc: c.InvalidateModelCredential,
}
} | |
c4133 | newAPIRoot) (blockClientAPI, error) {
return getBlockAPI(c)
},
})
} | |
c4134 |
return &DeployerAPI{
Remover: common.NewRemover(st, true, getAuthFunc),
PasswordChanger: common.NewPasswordChanger(st, getAuthFunc),
LifeGetter: common.NewLifeGetter(st, getAuthFunc),
APIAddresser: common.NewAPIAddresser(st, resources),
UnitsWatcher: common.NewUnitsWatcher(st, resources, ... | |
c4135 | return d.StatusSetter.SetStatus(args)
} | |
c4136 | ok := <-watch.Changes(); ok {
return units, nil
}
return nil, fmt.Errorf("cannot obtain units of machine %q: %v", tag, watch.Err())
} | |
c4137 | { return c.NewModelManagerAPIClient() }
return modelcmd.Wrap(c)
} | |
c4138 | the backup")
f.StringVar(&c.BackupId, "id", "", "Provide the name of the backup to be restored")
} | |
c4139 | backup id but not both.")
}
if c.Filename != "" {
var err error
c.Filename, err = filepath.Abs(c.Filename)
if err != nil {
return errors.Trace(err)
}
}
return nil
} | |
c4140 |
client, err := c.NewAPIClient()
if err != nil {
return errors.Trace(err)
}
defer client.Close()
// We have a backup client, now use the relevant method
// to restore the backup.
if c.Filename != "" {
err = client.RestoreReader(archive, meta, c.newClient)
} else {
err = client.Restore(c.BackupId, c.newC... | |
c4141 | error {
return w.loop(started)
})
select {
case <-started:
case <-time.After(10 * time.Second):
return nil, errors.New("worker failed to start properly")
}
return w, nil
} | |
c4142 | return manager.Claimer(singularControllerNamespace, st.modelUUID())
}}
} | |
c4143 | charm.RolePeer:
return charm.RolePeer
}
panic(fmt.Errorf("unknown relation role %q", r))
} | |
c4144 | ep.Role != charm.RolePeer &&
counterpartRole(ep.Role) == other.Role
} | |
c4145 |
common.AuthFuncForTag(m.ModelTag()),
)
return NewFirewallerAPI(stateShim{st: st, State: firewall.StateShim(st, m)}, context.Resources(), context.Auth(), cloudSpecAPI)
} | |
c4146 | ControllerConfigAPI: common.NewStateControllerConfig(context.State()),
FirewallerAPIV3: facadev3,
}, nil
} | |
c4147 | return nil, err
}
return &FirewallerAPIV5{
FirewallerAPIV4: facadev4,
}, nil
} | |
c4148 | )
// WatchModelMachines() is allowed with unrestricted access.
machinesWatcher := common.NewModelMachinesWatcher(
st,
resources,
authorizer,
)
// InstanceId() is supported for machines.
instanceIdGetter := common.NewInstanceIdGetter(
st,
accessMachine,
)
return &FirewallerAPIV3{
LifeGetter: ... | |
c4149 |
if !canWatch(tag) {
result.Results[i].Error = common.ServerError(common.ErrPerm)
continue
}
watcherId, initial, err := f.watchOneModelOpenedPorts(tag)
if err != nil {
result.Results[i].Error = common.ServerError(err)
continue
}
result.Results[i].StringsWatcherId = watcherId
result.Results[i].... | |
c4150 |
continue
}
if ports != nil {
portRangeMap := ports.AllPortRanges()
var portRanges []network.PortRange
for portRange := range portRangeMap {
portRanges = append(portRanges, portRange)
}
network.SortPortRanges(portRanges)
for _, portRange := range portRanges {
unitTag := names.NewUnitTa... | |
c4151 | }
application, err := f.getApplication(canAccess, tag)
if err == nil {
result.Results[i].Result = application.IsExposed()
}
result.Results[i].Error = common.ServerError(err)
}
return result, nil
} | |
c4152 | != nil {
return "", nil, errors.Trace(err)
}
rel, err := f.st.KeyRelation(relationTag.Id())
if err != nil {
return "", nil, errors.Trace(err)
}
w := rel.WatchRelationIngressNetworks()
changes, ok := <-w.Changes()
if !ok {
return "", nil, common.ServerError(watcher.EnsureErr(w))
}
return f.re... | |
c4153 | relationTag, err := names.ParseRelationTag(entity.Tag)
if err != nil {
result.Results[i].Error = common.ServerError(err)
continue
}
mac, err := f.st.GetMacaroon(relationTag)
if err != nil {
result.Results[i].Error = common.ServerError(err)
continue
}
result.Results[i].Result = mac
}
return r... | |
c4154 | result.Results[i].Error = common.ServerError(err)
continue
}
err = rel.SetStatus(status.StatusInfo{
Status: status.Status(entity.Status),
Message: entity.Info,
})
result.Results[i].Error = common.ServerError(err)
}
return result, nil
} | |
c4155 |
if err != nil {
continue
}
result.Rules = append(result.Rules, params.FirewallRule{
KnownService: knownService,
WhitelistCIDRS: rule.WhitelistCIDRs,
})
}
return result, nil
} | |
c4156 | version,
}
// TODO(dfc) Backup should take a Tag.
if mgoInfo.Tag != nil {
info.Username = mgoInfo.Tag.String()
}
return &info, nil
} | |
c4157 |
return nil, errors.Annotate(err, "mongodump not available")
}
dumper := mongoDumper{
DBInfo: info,
binPath: mongodumpPath,
}
return &dumper, nil
} | |
c4158 | the dump dir.
ignored := found.Difference(md.Targets)
// Admin must be removed only if the mongo version is 3.x or
// above, since 2.x will not restore properly without admin.
if md.DBInfo.MongoVersion.NewerThan(mongo.Mongo26) == -1 {
ignored.Remove("admin")
}
err = stripIgnored(ignored, baseDumpDir)
return e... | |
c4159 | !info.IsDir() {
// Notably, oplog.bson is thus excluded here.
continue
}
databases.Add(info.Name())
}
return databases, nil
} | |
c4160 |
}
switch args.Version.Major {
case 2:
restorer = &mongoRestorer24{
mongoRestorer: mgoRestorer,
startMongo: args.StartMongo,
stopMongo: args.StopMongo,
}
case 3:
restorer = &mongoRestorer32{
mongoRestorer: mgoRestorer,
getDB: args.GetDB,
newMongoSession: args.NewMongoSessi... | |
c4161 | mgoErr != nil {
return errors.Errorf("could not grant special role to %q, result was: %#v", md.DialInfo.Username, mgoErr)
}
grant = bson.D{
{"grantRolesToUser", "admin"},
{"roles", []string{"oploger"}},
}
err = s.Run(grant, &mgoErr)
if err != nil {
return errors.Trace(err)
}
result, ok = mgoErr["ok"]
... | |
c4162 | {
startFunc := newUniter(uniterParams)
w, err := startFunc()
return w.(*Uniter), err
} | |
c4163 | uniter for %q", params.UnitTag.Id())
err := runner.StartWorker(params.UnitTag.Id(), startFunc)
return errors.Annotate(err, "error starting uniter worker")
} | |
c4164 | return ErrCAASUnitDead
}
return jworker.ErrTerminateAgent
} | |
c4165 | Comment: action,
}
releaser, err := u.hookLock.Acquire(spec)
if err != nil {
return nil, errors.Trace(err)
}
return releaser, nil
} | |
c4166 | err = errors.NotFoundf("%s", path)
}
return "", errors.Trace(err)
}
return string(data), nil
}
clientCert, err := readFileString(clientCertPath)
if err != nil {
return cloud.Credential{}, errors.Annotate(err, "reading client certificate")
}
clientKey, err := readFileString(clientKeyPath)
if err != n... | |
c4167 | }
storedCredential, err := backend.CloudCredential(credentialTag)
if err != nil {
return params.ErrorResults{}, errors.Trace(err)
}
if !storedCredential.IsValid() {
return params.ErrorResults{}, errors.NotValidf("credential %q", storedCredential.Name)
}
credential := cloud.NewCredential(cloud.AuthType(stor... | |
c4168 |
}
model, err := backend.Model()
if err != nil {
return params.ErrorResults{}, errors.Trace(err)
}
switch model.Type() {
case state.ModelTypeCAAS:
return checkCAASModelCredential(openParams)
case state.ModelTypeIAAS:
return checkIAASModelCredential(openParams, backend, callCtx)
default:
return params.Er... | |
c4169 | append(results, serverError(errors.Annotatef(err, "getting instance id for machine %s", machine.Id())))
continue
}
machinesByInstance[string(instanceId)] = machine.Id()
}
// Check can see all machines' instances
instances, err := provider.AllInstances(callCtx)
if err != nil {
return fail(errors.Trace(err... | |
c4170 | (*environs.BootstrapResult, error) {
result, err := Bootstrap(ctx, dp.Env, callCtx, args)
if err != nil {
return nil, errors.Trace(err)
}
return result, nil
} | |
c4171 | != nil {
return errors.Trace(err)
}
return nil
} | |
c4172 | the environ
// setting, otherwise bootstrap or provisioning will fail.
if config.SeriesRequiresCloudArchiveTools(series) && !addUpdateScripts {
addUpdateScripts = true
}
// Bring packages up-to-date.
cfg.SetSystemUpdate(addUpdateScripts)
cfg.SetSystemUpgrade(addUpgradeScripts)
// Always run this step - this... | |
c4173 |
// the subshell and redirecting stderr.
script = append(script, InitProgressCmd())
stdout, stderr := cfg.Output(OutAll)
script = append(script, "(")
if stderr != "" {
script = append(script, "(")
}
script = append(script, bootcmds...)
script = append(script, pkgcmds...)
script = append(script, runcmds...)
... | |
c4174 | return &restrictedRoot{
Root: root,
check: check,
}
} | |
c4175 | != nil {
return nil, err
}
return r.Root.FindMethod(facadeName, version, methodName)
} | |
c4176 | func(string, string) error {
return err
})
} | |
c4177 | case jujuos.Windows:
return winVals[valname], nil
default:
return nixVals[valname], nil
}
} | |
c4178 | return caller.APICall(facadeName, bestVersion,
watcherId, request, nil, &result)
}
} | |
c4179 |
}
if w.call == nil {
panic("call must be set")
}
} | |
c4180 | result := w.newResult()
err := w.call("Next", &result)
if err != nil {
if params.IsCodeStopped(err) || params.IsCodeNotFound(err) {
if w.tomb.Err() != tomb.ErrStillAlive {
// The watcher has been stopped at the client end, so we're
// expecting one of the above two kinds of error.
// ... | |
c4181 |
caller: caller,
notifyWatcherId: result.NotifyWatcherId,
out: make(chan struct{}),
}
w.tomb.Go(w.loop)
return w
} | |
c4182 | make(chan []watcher.RelationStatusChange),
}
w.tomb.Go(func() error {
return w.loop(result.Changes)
})
return w
} | |
c4183 | make(chan []watcher.OfferStatusChange),
}
w.tomb.Go(func() error {
return w.loop(result.Changes)
})
return w
} | |
c4184 | newMachineStorageIdsWatcher("VolumeAttachmentsWatcher", caller, result)
} | |
c4185 | out: make(chan watcher.MigrationStatus),
}
w.tomb.Go(w.loop)
return w
} | |
c4186 | {
netplan.Rollback()
return nil, err
}
environ := os.Environ()
// TODO(wpk) 2017-06-21 Is there a way to verify that apply is finished?
// https://bugs.launchpad.net/netplan/+bug/1701436
command := fmt.Sprintf("%snetplan generate && netplan apply && sleep 10", params.RunPrefix)
result, err := scriptrunner.... | |
c4187 |
out: out,
errOut: errOut,
in: in,
}
} | |
c4188 | p.SelectVerify(l, VerifyOptions(l.Singular, l.Options, l.Default != ""))
} | |
c4189 | QueryVerify(question, p.scanner, p.out, p.errOut, verify)
if err != nil {
return "", errors.Trace(err)
}
if val == "" {
return l.Default, nil
}
return val, nil
} | |
c4190 | msg string, err error) {
return s != "", "", nil
})
} | |
c4191 | }
value, err := terminal.ReadPassword(int(f.Fd()))
if err != nil {
return "", errors.Trace(err)
}
return string(value), nil
}
return p.Enter(valueName)
} | |
c4192 | return p.EnterVerifyDefault(valueName, nil, defVal)
} | |
c4193 | "+valueName+" (optional): ", p.scanner, p.out, p.errOut, nil)
} | |
c4194 | err := QueryVerify("Enter "+valueName+" ["+defVal+"]: ", p.scanner, p.out, p.errOut, verifyDefault)
if err != nil {
return "", errors.Trace(err)
}
if s == "" {
return defVal, nil
}
return s, nil
} | |
c4195 | := range options {
if strings.ToLower(opt) == strings.ToLower(s) {
return true, "", nil
}
}
return false, fmt.Sprintf("Invalid %s: %q", singular, s), nil
}
} | |
c4196 |
ret = append(ret, n)
}
sort.Strings(ret)
return ret
} | |
c4197 | default:
return nil, errors.Errorf("unknown value for boolean type: %q", s)
}
default:
return nil, errors.Errorf("don't know how to convert value %q of type %q", s, t)
}
} | |
c4198 | make(chan struct{}),
initialUpgradeCheckComplete: gate.NewLock(),
bufferedLogger: bufferedLogger,
prometheusRegistry: prometheusRegistry,
preUpgradeSteps: upgrades.PreUpgradeSteps,
}, nil
} | |
c4199 | {
a.errReason = err
close(a.dead)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.