id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c4500
"InvalidSubnetID.NotFound": // This shouldn't happen, as we validate the subnet IDs, but it can // happen if the user manually deleted the subnet outside of Juju. return true } } return false }
c4501
if !isVPCIDSet(vpcId) { return nil, errors.NotSupportedf("Not a VPC environment") } cidr, err := getVPCCIDR(e.ec2, ctx, vpcId) if err != nil { return nil, err } return []string{cidr}, nil }
c4502
nil { return annotations.Results, errors.Trace(err) } return annotations.Results, nil }
c4503
results := new(params.ErrorResults) if err := c.facade.FacadeCall("Set", args, results); err != nil { return nil, errors.Trace(err) } return results.Results, nil }
c4504
if unitInfo.MachineId == machineId { filesystemAttachmentInfo.UnitId = unitId filesystemAttachmentInfo.UnitStorageAttachment = unitInfo break } } haveMachines = true filesystemAttachmentInfos = append(filesystemAttachmentInfos, filesystemAttachmentInfo) } for hostId, containerInfo := r...
c4505
:= newUpgradeOpsIterator(from) if err := runUpgradeSteps(ops, targets, context.APIContext()); err != nil { return err } logger.Infof("All upgrade steps completed successfully") return nil }
c4506
logger.Errorf("upgrade step %q failed: %v", step.Description(), err) return &upgradeError{ description: step.Description(), err: err, } } } } } return nil }
c4507
for _, stepTarget := range stepTargets { if machineTarget == stepTarget || stepTarget == AllMachines { return true } } } return false }
c4508
the API // server needs to run before mongo upgrades have happened and // any state manipulation may be be relying on features of the // database added by upgrades. Here be dragons. return newServer(cfg) }
c4509
return srv.tomb.Wait() }
c4510
srv.mux.AddHandler("HEAD", ep.Pattern, ep.Handler) defer srv.mux.RemoveHandler("HEAD", ep.Pattern) } } close(ready) <-srv.tomb.Dying() srv.wg.Wait() // wait for any outstanding requests to complete. return tomb.ErrDying }
c4511
srv.mu.Lock() defer srv.mu.Unlock() return srv.publicDNSName_ }
c4512
:= env.Config() server, rootdrive, arch, err := client.newInstance(args, img, userData, cfg.AuthorizedKeys()) if err != nil { return nil, errors.Errorf("failed start instance: %v", err) } inst := &sigmaInstance{server: server} // prepare hardware characteristics hwch, err := inst.hardware(arch, rootdrive.Siz...
c4513
{ instance := sigmaInstance{server: server} instances = append(instances, instance) } if logger.LogLevel() <= loggo.TRACE { logger.Tracef("All instances, len = %d:", len(instances)) for _, instance := range instances { logger.Tracef("... id: %q, status: %q", instance.Id(), instance.Status(ctx)) } } ...
c4514
m, err := env.client.instanceMap() if err != nil { return nil, errors.Annotate(err, "environ.Instances failed") } var found int r := make([]instances.Instance, len(ids)) for i, id := range ids { if s, ok := m[string(id)]; ok { r[i] = sigmaInstance{server: s} found++ } } if found == 0 { err = e...
c4515
nil { continue } addrs, err := inst.Addresses(ctx) if err != nil { logger.Debugf( "failed to get addresses for %v: %v (ignoring)", inst.Id(), err, ) continue } allAddrs = append(allAddrs, addrs...) } return allAddrs }
c4516
{ logger.Debugf("error getting state instances: %v", err) return nil, err } addrs = getAddresses(ctx, instances) } if len(addrs) == 0 { return nil, errors.NotFoundf("addresses for %v", instanceIds) } return addrs, nil }
c4517
return nil, err } apiAddrs := network.HostPortsToStrings( network.AddressesWithPort(addrs, apiPort), ) modelTag := names.NewModelTag(modelUUID) apiInfo := &api.Info{Addrs: apiAddrs, CACert: caCert, ModelTag: modelTag} return apiInfo, nil }
c4518
underlying substrate is ok. _, err := env.AllInstances(ctx) switch err { case nil, ErrPartialInstances, ErrNoInstances: return nil } return errors.Annotate(err, "cannot make API call to provider") }
c4519
nil { return nil, errors.Trace(err) } allUnits, err := app.AllUnits() if err != nil { return nil, errors.Trace(err) } return func(tag names.Tag) bool { for _, u := range allUnits { if u.Tag() == tag { return true } } return false }, nil default: return nil, er...
c4520
continue } charm, force, err := application.Charm() if err != nil { results.Results[i].Error = common.ServerError(err) continue } results.Results[i].Result = &params.ApplicationCharm{ URL: charm.URL().String(), ForceUpgrade: force, SHA256: charm.BundleS...
c4521
{ results.Results[i].Error = common.ServerError(common.ErrPerm) continue } if !f.auth.AuthOwner(tag) { results.Results[i].Error = common.ServerError(common.ErrPerm) continue } if _, err := caasProvider.ParsePodSpec(arg.Value); err != nil { results.Results[i].Error = common.ServerError(errors.New...
c4522
if err != nil { results.Results[i].Error = common.ServerError(err) continue } results.Results[i].StringsWatcherId = id results.Results[i].Changes = changes } return results, nil }
c4523
return &connFacade{ caller: facadeCaller, }, nil }
c4524
if len(results.Entities) != 1 { return "", errors.Errorf("expected 1 result, got %d", len(results.Entities)) } if err := results.Entities[0].Error; err != nil { if params.IsCodeNotFoundOrCodeUnauthorized(err) { return "", ErrDenied } return "", errors.Trace(err) } life := Life(results.Entities[0].Life)...
c4525
if err != nil { return errors.Trace(err) } if len(results.Results) != 1 { return errors.Errorf("expected 1 result, got %d", len(results.Results)) } if err := results.Results[0].Error; err != nil { if params.IsCodeDead(err) { return ErrDenied } else if params.IsCodeNotFoundOrCodeUnauthorized(err) { r...
c4526
mock.recorder = &MockCollectionMockRecorder{mock} return mock }
c4527
"Count") ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 }
c4528
{ ret := m.ctrl.Call(m, "Pipe", arg0) ret0, _ := ret[0].(*mgo_v2.Pipe) return ret0 }
c4529
"Pipe", reflect.TypeOf((*MockCollection)(nil).Pipe), arg0) }
c4530
ret := m.ctrl.Call(m, "Writeable") ret0, _ := ret[0].(mongo.WriteCollection) return ret0 }
c4531
mock.recorder = &MockQueryMockRecorder{mock} return mock }
c4532
ret0, _ := ret[0].(mongo.Query) return ret0 }
c4533
{ ret := m.ctrl.Call(m, "Distinct", arg0, arg1) ret0, _ := ret[0].(error) return ret0 }
c4534
_ := ret[0].(mongo.Iterator) return ret0 }
c4535
"Iter", reflect.TypeOf((*MockQuery)(nil).Iter)) }
c4536
ret0, _ := ret[0].(mongo.Query) return ret0 }
c4537
_ := ret[0].(mongo.Query) return ret0 }
c4538
ret0, _ := ret[0].(*mgo_v2.MapReduceInfo) ret1, _ := ret[1].(error) return ret0, ret1 }
c4539
arg0) ret0, _ := ret[0].(error) return ret0 }
c4540
ret0, _ := ret[0].(mongo.Query) return ret0 }
c4541
ret := m.ctrl.Call(m, "Select", arg0) ret0, _ := ret[0].(mongo.Query) return ret0 }
c4542
{ ret := m.ctrl.Call(m, "SetMaxTime", arg0) ret0, _ := ret[0].(mongo.Query) return ret0 }
c4543
mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetMaxTime", reflect.TypeOf((*MockQuery)(nil).SetMaxTime), arg0) }
c4544
} ret := m.ctrl.Call(m, "Sort", varargs...) ret0, _ := ret[0].(mongo.Query) return ret0 }
c4545
ret := m.ctrl.Call(m, "Tail", arg0) ret0, _ := ret[0].(*mgo_v2.Iter) return ret0 }
c4546
} return &APIBase{ backend: backend, resources: resources, authorizer: authorizer, }, nil }
c4547
if errors.Results[i].Error == nil { results.Results[i] = api.oneWatch() } else { results.Results[i].Error = errors.Results[i].Error } } return results }
c4548
err != nil { results[i].Error = errors.Annotate(err, "creating volume") } results[i].Volume = &volume } return results, nil }
c4549
need it. return nil, errors.NotImplementedf("ListVolumes") }
c4550
([]storage.DescribeVolumesResult, error) { // TODO(axw) implement this when we need it. return nil, errors.NotImplementedf("DescribeVolumes") }
c4551
for i, volumeId := range volumeIds { if err := lvs.destroyVolume(volumeId); err != nil { results[i] = errors.Annotatef(err, "destroying %q", volumeId) } } return results, nil }
c4552
volumeIds []string) ([]error, error) { return make([]error, len(volumeIds)), nil }
c4553
err != nil { results[i].Error = errors.Annotatef(err, "attaching volume %v", arg.Volume.Id()) continue } results[i].VolumeAttachment = attachment } return results, nil }
c4554
nil { results[i] = errors.Annotatef(err, "detaching volume %s", arg.Volume.Id()) } } return results, nil }
c4555
to it. _, err := run("fallocate", "-l", fmt.Sprintf("%dMiB", sizeInMiB), filePath) if err != nil { return errors.Annotatef(err, "allocating loop backing file %q", filePath) } return nil }
c4556
return errors.Annotatef(err, "detaching loop device %q", deviceName) } return err }
c4557
:= strings.IndexRune(line, ':') if pos == -1 { return nil, errors.Errorf("unexpected output %q", line) } deviceName := line[:pos][len("/dev/"):] deviceNames[i] = deviceName } return deviceNames, nil }
c4558
= jujuclient.NewFileClientStore() c.CanClearCurrentModel = true return modelcmd.WrapBase(c) }
c4559
name>", Purpose: usageRegisterSummary, Doc: usageRegisterDetails, }) }
c4560
args[1:] if err := cmd.CheckEmpty(args); err != nil { return errors.Trace(err) } return nil }
c4561
return c.publicControllerDetails(p.publicHost, controllerName) } return c.nonPublicControllerDetails(ctx, p, controllerName) }
c4562
as %v, not a user", conn.AuthTag())) } // If we get to here, then we have a cached macaroon for the registered // user. If we encounter an error after here, we need to clear it. c.onRunError = func() { if err := c.ClearControllerMacaroons(c.store, controllerName); err != nil { logger.Errorf("failed to clear m...
c4563
// will be expired. // Log the error as it will be useful for debugging, but give user a // suggestion for the way forward instead of error details. logger.Infof("while validating secret key: %v", err) err = errors.Errorf("Provided registration token may have been expired.\nA controller administrator must res...
c4564
} ctx.Warningf(buf.String()) return errors.Errorf("controller is already registered as %q", name) } } if err := store.AddController(controllerName, controllerDetails); err != nil { return errors.Trace(err) } if err := store.UpdateAccount(controllerName, accountDetails); err != nil { return errors.Anno...
c4565
if err != nil { return nil, errors.Trace(err) } var info jujuclient.RegistrationInfo if _, err := asn1.Unmarshal(decodedData, &info); err != nil { return nil, errors.Trace(err) } params.controllerAddrs = info.Addrs params.userTag = names.NewUserTag(info.User) if len(info.SecretKey) != len(params.key) { r...
c4566
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV4{provisionerAPI}, nil }
c4567
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV5{provisionerAPI}, nil }
c4568
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV6{provisionerAPI}, nil }
c4569
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV7{provisionerAPI}, nil }
c4570
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV8{provisionerAPI}, nil }
c4571
if err != nil { return nil, errors.Trace(err) } return &ProvisionerAPIV9{provisionerAPI}, nil }
c4572
} for i, arg := range args.Params { watcherResult, err := p.watchOneMachineContainers(arg) result.Results[i] = watcherResult result.Results[i].Error = common.ServerError(err) } return result, nil }
c4573
(params.StringsWatchResults, error) { return p.WatchContainers(args) }
c4574
tag) if err != nil { result.Results[i].Error = common.ServerError(err) continue } if len(arg.ContainerTypes) == 0 { err = machine.SupportsNoContainers() } else { err = machine.SetSupportedContainers(arg.ContainerTypes) } if err != nil { result.Results[i].Error = common.ServerError(err) } ...
c4575
} machine, err := p.getMachine(canAccess, tag) if err != nil { result.Results[i].Error = common.ServerError(err) continue } containerTypes, determined := machine.SupportedContainers() result.Results[i].ContainerTypes = containerTypes result.Results[i].Determined = determined } return result, nil }
c4576
if statusInfo.Status != status.Error && statusInfo.Status != status.ProvisioningError { continue } // Transient errors are marked as such in the status data. if transient, ok := result.Data["transient"].(bool); !ok || !transient { continue } result.Id = machine.Id() result.Life = params.Life(machine...
c4577
machine, err := p.getMachine(canAccess, tag) if err == nil { result.Results[i].Result = machine.Series() } result.Results[i].Error = common.ServerError(err) } return result, nil }
c4578
if err == nil { keep, err := machine.KeepInstance() result.Results[i].Result = keep result.Results[i].Error = common.ServerError(err) } result.Results[i].Error = common.ServerError(err) } return result, nil }
c4579
the machine is a controller, return // controller instances. Otherwise, return // instances with services in common with the machine // being provisioned. if machine.IsManager() { result.Results[i].Result, err = controllerInstances(p.st) } else { result.Results[i].Result, err = commonServiceInst...
c4580
err == nil { instances = append(instances, instanceId) } else if !errors.IsNotProvisioned(err) { return nil, err } } return instances, nil }
c4581
} instanceIds := make([]instance.Id, instanceIdSet.Size()) // Sort values to simplify testing. for i, instanceId := range instanceIdSet.SortedValues() { instanceIds[i] = instance.Id(instanceId) } return instanceIds, nil }
c4582
is a controller, return // controller instances. Otherwise, return // instances with services in common with the machine // being provisioned. if machine.IsManager() { result.Results[i].Result, err = controllerMachineIds(p.st, machine) } else { result.Results[i].Result, err = commonApplicationMa...
c4583
if err != nil { return nil, err } result := set.NewStrings(info.MachineIds...) result.Remove(m.Id()) return result.SortedValues(), nil }
c4584
return nil, err } union = union.Union(set.NewStrings(machines...)) } union.Remove(m.Id()) return union.SortedValues(), nil }
c4585
if err == nil { var cons constraints.Value cons, err = machine.Constraints() if err == nil { result.Results[i].Constraints = cons } } result.Results[i].Error = common.ServerError(err) } return result, nil }
c4586
} devicesArgs, devicesAddrs := networkingcommon.NetworkConfigsToStateArgs(arg.NetworkConfig) err = machine.SetInstanceInfo( arg.InstanceId, arg.DisplayName, arg.Nonce, arg.Characteristics, devicesArgs, devicesAddrs, volumes, volumeAttachments, arg.CharmProfiles, ) if err != nil { return errors....
c4587
if _, ok := <-watch.Changes(); ok { result.NotifyWatcherId = p.resources.Register(watch) } else { return result, watcher.EnsureErr(watch) } return result, nil }
c4588
result.Results[i].Error = common.ServerError(err) continue } else if !guest.IsContainer() { err = errors.Errorf("cannot mark addresses for removal for %q: not a container", tag) result.Results[i].Error = common.ServerError(err) continue } // TODO(dimitern): Release those via the provider once we hav...
c4589
if hostAuthTag == nil { return nil, nil, nil, errors.Errorf("authenticated entity tag is nil") } hostTag, err := names.ParseMachineTag(hostAuthTag.String()) if err != nil { return nil, nil, nil, errors.Trace(err) } host, err := p.getMachine(canAccess, hostTag) if err != nil { return nil, nil, nil, errors.T...
c4590
} if err := p.processEachContainer(args, ctx); err != nil { return ctx.result, errors.Trace(err) } return ctx.result, nil }
c4591
ctx.result.Results[idx].Error = common.ServerError(err) }
c4592
err) return result, errors.Trace(err) } for i, arg := range args.Entities { err = p.setOneModificationStatus(canAccess, arg) result.Results[i].Error = common.ServerError(err) } return result, nil }
c4593
} for i, machine := range machines.Entities { results[i].Error = common.ServerError(p.markOneMachineForRemoval(machine.Tag, canAccess)) } return params.ErrorResults{Results: results}, nil }
c4594
make([]params.ErrorResult, len(args.Entities)), } return results, nil }
c4595
"", errors.Annotate(err, "extracting registry from path") } return reference.Domain(imageNamed), nil }
c4596
copy.Members = map[string]int64{} for m, v := range s.Members { copy.Members[m] = v } } return copy }
c4597
s.ChangedPending != "" { if unit != s.ChangedPending || kind != hooks.RelationChanged { return fmt.Errorf(`expected "relation-changed" for %q`, s.ChangedPending) } } else if _, joined := s.Members[unit]; joined && kind == hooks.RelationJoined { return fmt.Errorf("unit already joined") } else if !joined && k...
c4598
info diskInfo if err = utils.ReadYaml(filepath.Join(d.path, name), &info); err != nil { return nil, fmt.Errorf("invalid unit file %q: %v", name, err) } if info.ChangeVersion == nil { return nil, fmt.Errorf(`invalid unit file %q: "changed-version" not set`, name) } d.state.Members[unitName] = *info.Chan...
c4599
StateDir // data; all other names will be ignored. relationId, err := strconv.Atoi(fi.Name()) if err != nil { // This doesn't look like a relation. continue } dir, err := ReadStateDir(dirPath, relationId) if err != nil { return nil, err } dirs[relationId] = dir } return dirs, nil }