id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c3500 | arg1 string) error {
ret := m.ctrl.Call(m, "DestroyController", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | |
c3501 |
ret0, _ := ret[0].(instances.InstanceTypesWithCostMetadata)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3502 |
ret0, _ := ret[0].([]instances.Instance)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3503 | := m.ctrl.Call(m, "MaintainInstance", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | |
c3504 | := m.ctrl.Call(m, "PrecheckInstance", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | |
c3505 | string) error {
ret := m.ctrl.Call(m, "PrepareForBootstrap", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
} | |
c3506 | ret[0].(environs.EnvironProvider)
return ret0
} | |
c3507 | m.ctrl.Call(m, "SetConfig", arg0)
ret0, _ := ret[0].(error)
return ret0
} | |
c3508 | ret := m.ctrl.Call(m, "StopInstances", varargs...)
ret0, _ := ret[0].(error)
return ret0
} | |
c3509 | _ := ret[0].(storage.Provider)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3510 | mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageProvider", reflect.TypeOf((*MockZonedEnviron)(nil).StorageProvider), arg0)
} | |
c3511 | := m.ctrl.Call(m, "StorageProviderTypes")
ret0, _ := ret[0].([]storage.ProviderType)
ret1, _ := ret[1].(error)
return ret0, ret1
} | |
c3512 | &StorageAddCommand{ctx: ctx}, nil
} | |
c3513 | from state when they are no
// longer needed.
deployerName: ifNotMigrating(deployer.Manifold(deployer.ManifoldConfig{
NewDeployContext: config.NewDeployContext,
AgentName: agentName,
APICallerName: apiCallerName,
})),
// The reboot manifold manages a worker which will reboot the
// machin... | |
c3514 | AgentName: agentName,
APICallerName: apiCallerName,
UpgradeStepsGateName: upgradeStepsGateName,
UpgradeCheckGateName: upgradeCheckGateName,
PreviousAgentVersion: config.PreviousAgentVersion,
}),
})
} | |
c3515 | rules []network.IngressRule) error {
return errors.NotSupportedf("OpenPorts")
} | |
c3516 | {
return nil, errors.NotSupportedf("Ports")
} | |
c3517 | context.ProviderCallContext, names ...string) error {
return nil
} | |
c3518 | context.ProviderCallContext, controllerUUID string) error {
return nil
} | |
c3519 | ids ...instance.Id) ([]string, error) {
return nil, nil
} | |
c3520 | controllerUUID, machineId string, apiPort int) ([]string, error) {
return nil, nil
} | |
c3521 |
}
aliveFilesystemTags := filesystemTags[:len(alive)]
dyingFilesystemTags := filesystemTags[len(alive) : len(alive)+len(dying)]
deadFilesystemTags := filesystemTags[len(alive)+len(dying):]
aliveFilesystemResults := filesystemResults[:len(alive)]
dyingFilesystemResults := filesystemResults[len(alive) : len(alive)... | |
c3522 |
}
// Deprovision Dying filesystem attachments.
dyingFilesystemAttachmentResults := filesystemAttachmentResults[len(alive):]
if err := processDyingFilesystemAttachments(ctx, dying, dyingFilesystemAttachmentResults); err != nil {
return errors.Annotate(err, "destroying filesystem attachments")
}
// Provision A... | |
c3523 | []params.FilesystemResult) error {
for _, tag := range tags {
removePendingFilesystem(ctx, tag)
}
return nil
} | |
c3524 | then the block device
// may not have been seen yet. We must wait for the block
// device watcher to trigger.
if _, ok := ctx.volumeBlockDevices[filesystem.Volume]; !ok {
incomplete = true
}
}
}
if params.InstanceId == "" {
watchMachine(ctx, params.Machine.(names.MachineTag))
incomplete = true
... | |
c3525 | return errors.Annotate(err, "getting filesystem info")
}
updateFilesystem(ctx, filesystem)
destroy = append(destroy, tag)
continue
}
if params.IsCodeNotProvisioned(result.Error) {
logger.Debugf("filesystem %s is not provisioned, queuing for removal", tag.Id())
remove = append(remove, tag)
cont... | |
c3526 | continue
}
if params.IsCodeNotProvisioned(result.Error) {
remove = append(remove, id)
continue
}
return errors.Annotatef(result.Error, "getting information for filesystem attachment %v", id)
}
if len(detach) > 0 {
attachmentParams, err := filesystemAttachmentParams(ctx, detach)
if err != nil {
... | |
c3527 |
return errors.Annotatef(
result.Error, "getting filesystem information for filesystem %q", tag.Id(),
)
}
// The filesystem has not yet been provisioned, so record its tag
// to enquire about parameters below.
pending = append(pending, tag)
}
if len(pending) == 0 {
return nil
}
params, err := fi... | |
c3528 | )
}
// The filesystem has not yet been attached, so
// record its tag to enquire about parameters below.
pending = append(pending, ids[i])
}
if len(pending) == 0 {
return nil
}
params, err := filesystemAttachmentParams(ctx, pending)
if err != nil {
return errors.Trace(err)
}
for i, params := range ... | |
c3529 | len(ids))
for i, result := range paramsResults {
if result.Error != nil {
return nil, errors.Annotate(result.Error, "getting filesystem attachment parameters")
}
params, err := filesystemAttachmentParamsFromParams(result.Result)
if err != nil {
return nil, errors.Annotate(err, "getting filesystem attach... | |
c3530 | len(tags))
for i, result := range paramsResults {
if result.Error != nil {
return nil, errors.Annotate(result.Error, "getting filesystem parameters")
}
params, err := filesystemParamsFromParams(result.Result)
if err != nil {
return nil, errors.Annotate(err, "getting filesystem parameters")
}
allPara... | |
c3531 |
if result.Error != nil {
return nil, errors.Annotate(result.Error, "getting filesystem removal parameters")
}
allParams[i] = result.Result
}
return allParams, nil
} | |
c3532 |
for _, id := range productIds {
if catalog, ok := metadata.Products[id]; ok {
result = append(result, catalog)
}
}
return result
} | |
c3533 | for _, metadata := range ind.Indexes {
result = append(result, metadata)
}
} else {
// Return metadata for just the specified ids.
for _, id := range indexIds {
if metadata, ok := ind.Indexes[id]; ok {
result = append(result, metadata)
}
}
}
return result
} | |
c3534 | := range metadata.Clouds {
if metadataCloud.equals(&cloud) {
return true
}
}
return len(metadata.Clouds) == 0
} | |
c3535 | pid := range metadata.ProductIds {
if containsString(prodIds, pid) {
return true
}
}
return false
} | |
c3536 | {
if match(metadata) {
result = append(result, metadata)
}
}
return result
} | |
c3537 | > 1 {
indexFileSuffix = fmt.Sprintf("%d", indexFileVersion)
}
return fmt.Sprintf(unsignedIndex, streamsVersion, indexFileSuffix)
} | |
c3538 | != nil {
if errors.IsNotFound(err) || errors.IsUnauthorized(err) {
logger.Tracef("cannot load index %q: %v", indexURL, err)
}
return nil, resolveInfo, err
}
logger.Tracef("read metadata index at %q", indexURL)
items, err := indexRef.getLatestMetadataWithFormat(cons, ProductFormat, signed)
if err != nil {
... | |
c3539 | when logging messages.
indexURL = indexPath
}
indexRef, err = GetIndexWithFormat(
source, indexPath, IndexFormat, mirrorsPath, signed, cloudSpec, params,
)
return indexRef, indexURL, err
} | |
c3540 | DecodeCheckSignature(rc, source.PublicSigningKey())
} else {
data, err = ioutil.ReadAll(rc)
}
if err != nil {
return nil, dataURL, errors.Annotatef(err, "cannot read data for source %q at URL %v", source.Description(), dataURL)
}
return data, dataURL, nil
} | |
c3541 | valueParams: params,
}
// Apply any mirror information to the source.
if params.MirrorContentId != "" {
mirrorInfo, err := getMirror(
source, mirrors, params.DataType, params.MirrorContentId, cloudSpec, requireSigned)
if err == nil {
logger.Debugf("using mirrored products path: %s", path.Join(mirrorInfo.... | |
c3542 | := fetchData(source, mirrorsPath, requireSigned)
if err != nil {
if errors.IsNotFound(err) || errors.IsUnauthorized(err) {
return mirrors, url, err
}
return mirrors, url, fmt.Errorf("cannot read mirrors data, %v", err)
}
err = json.Unmarshal(data, &mirrors)
if err != nil {
return mirrors, url, fmt.Error... | |
c3543 | contentId, cloudSpec, MirrorFormat, requireSigned)
if err != nil {
return nil, err
}
if mirrorInfo == nil {
return nil, errors.NotFoundf("mirror metadata for %q and cloud %v", contentId, cloudSpec)
}
return mirrorInfo, nil
} | |
c3544 | candidates = candidates.filter(hasRightCloud)
if len(candidates) == 0 {
return "", errors.NotFoundf("index file has no data for cloud %v", cons.Params().CloudSpec)
}
}
// Restrict by product IDs.
hasProduct := func(metadata *IndexMetadata) bool {
return metadata.hasProduct(prodIds)
}
candidates = candida... | |
c3545 |
if id == contentId {
return refs
}
}
return nil
} | |
c3546 | refCloud := range mirrorRef.Clouds {
if refCloud.equals(&cloud) {
return true
}
}
return false
} | |
c3547 | range candidates {
if len(candidate.Clouds) == 0 {
logger.Debugf("using default candidate for content id %q are %v", contentId, candidate)
return &candidate, nil
}
}
return nil, errors.NotFoundf("index file with cloud %v", cloud)
}
logger.Debugf("candidate matches for content id %q are %v", conten... | |
c3548 | }
mirrorInfo, err := metadata.getMirrorInfo(contentId, cloud)
if err != nil {
return nil, err
}
return mirrorInfo, nil
} | |
c3549 | unmarshal JSON mirror metadata at URL %q: %v", url, err)
}
if mirrors.Format != format {
return nil, fmt.Errorf("unexpected mirror file format %q, expected %q at URL %q", mirrors.Format, format, url)
}
return &mirrors, nil
} | |
c3550 | := range mirrorInfo.Clouds {
if metadataCloud.equals(&cloud) {
return true
}
}
return false
} | |
c3551 |
return nil, errors.NotFoundf("mirror info for %q", contentId)
}
// Restrict by cloud spec.
hasRightCloud := func(mirrorInfo *MirrorInfo) bool {
return mirrorInfo.hasCloud(cloud)
}
candidates = candidates.filter(hasRightCloud)
if len(candidates) == 0 {
return nil, errors.NotFoundf("mirror info with cloud %... | |
c3552 | value == element {
return true
}
}
return false
} | |
c3553 | metadata struct.
// Now check to see if the field matches one of the defined aliases.
fields, ok := aliases[fieldByTag(item, tag)]
if !ok {
continue
}
// The alias matches - set all the aliased fields in the struct.
for attr, val := range fields {
setFieldByTag(item, attr, val, true)
}
}
} | |
c3554 | for _, ItemCollection := range metadataCatalog.Items {
for _, item := range ItemCollection.Items {
metadata.processAliases(item)
}
}
}
} | |
c3555 |
for _, ItemCollection := range metadataCatalog.Items {
if err := ItemCollection.construct(valueType); err != nil {
return err
}
}
}
return nil
} | |
c3556 | {
logger.Tracef("can't read product data: %v", err)
return nil, fmt.Errorf("cannot read product data, %v", err)
}
return ParseCloudMetadata(data, format, url, indexRef.valueParams.ValueTemplate)
} | |
c3557 | != nil {
logger.Errorf("bad JSON product data at URL %q: %v", url, string(data))
return nil, fmt.Errorf("cannot unmarshal JSON metadata at URL %q: %v", url, err)
}
metadata.applyAliases()
metadata.denormaliseMetadata()
return &metadata, nil
} | |
c3558 | string(subnet.ProviderId),
ProviderNetworkId: string(subnet.ProviderNetworkId),
ProviderSpaceId: string(subnet.SpaceProviderId),
VLANTag: subnet.VLANTag,
Zones: subnet.AvailabilityZones,
}
result.Subnets = append(result.Subnets, resultSubnet)
}
return result
} | |
c3559 | subnet.ProviderId(),
ProviderNetworkId: subnet.ProviderNetworkId(),
VLANTag: subnet.VLANTag(),
AvailabilityZones: subnet.AvailabilityZones(),
}
result.Subnets = append(result.Subnets, resultSubnet)
}
return result, nil
} | |
c3560 | virtual type depends on the virtual type of the selected image, i.e.
// picking an image with a virt type gives a machine with this virt type.
instanceType.VirtType = ic.Constraints.VirtType
}
allInstanceTypes = append(allInstanceTypes, instanceType)
}
images := instances.ImageMetadataToImages(imageMetada... | |
c3561 | client is not appropriate for controller-only API")
}
return &Client{
modelTag: modelTag,
caller: base.NewFacadeCaller(caller, "Undertaker"),
newWatcher: newWatcher,
}, nil
} | |
c3562 | got %d", len(results.Results))
}
result := results.Results[0]
if result.Error != nil {
return nil, result.Error
}
w := c.newWatcher(c.caller.RawAPICaller(), result)
return w, nil
} | |
c3563 | clock.Clock) *Firewall {
return &Firewall{
environ: cfg,
client: client,
clock: c,
}
} | |
c3564 | globalGroupName := f.globalGroupName()
seclist, err := f.ensureSecList(f.client.ComposeName(globalGroupName))
if err != nil {
return errors.Trace(err)
}
err = f.ensureSecRules(seclist, rules)
if err != nil {
return errors.Trace(err)
}
return nil
} | |
c3565 | error {
groupName := f.globalGroupName()
return f.closePortsOnList(ctx, f.client.ComposeName(groupName), rules)
} | |
c3566 | ([]network.IngressRule, error) {
return f.GlobalIngressRules(ctx)
} | |
c3567 | := f.machineGroupName(machineId)
return f.getIngressRules(ctx, f.client.ComposeName(seclist))
} | |
c3568 | nil {
return errors.Trace(err)
}
err = f.ensureSecRules(seclist, rules)
if err != nil {
return errors.Trace(err)
}
return nil
} | |
c3569 |
// fetch the group name based on the machine id provided
groupName := f.machineGroupName(machineId)
return f.closePortsOnList(ctx, f.client.ComposeName(groupName), rules)
} | |
c3570 |
}
name := f.machineGroupName(machineId)
resourceName := f.client.ComposeName(name)
secList, err := f.ensureSecList(resourceName)
if err != nil {
return nil, errors.Trace(err)
}
return []string{
defaultSecList.Name,
secList.Name,
}, nil
} | |
c3571 | delete the global list as well
err = f.maybeDeleteList(f.client.ComposeName(globalListName))
if err != nil {
return errors.Trace(err)
}
return nil
} | |
c3572 | !api.IsNotFound(err) {
return err
}
}
}
err = f.client.DeleteAcl(resourceName)
if err != nil {
if !api.IsNotFound(err) {
return err
}
}
return nil
} | |
c3573 | error) {
seclist := f.globalGroupName()
return f.getIngressRules(ctx, f.client.ComposeName(seclist))
} | |
c3574 | ToPort: 3389,
Protocol: "tcp",
},
SourceCIDRs: []string{
"0.0.0.0/0",
},
},
{
PortRange: corenetwork.PortRange{
FromPort: apiPort,
ToPort: apiPort,
Protocol: "tcp",
},
SourceCIDRs: []string{
"0.0.0.0/0",
},
},
{
PortRange: corenetwork.PortRange{
FromPort:... | |
c3575 | for _, ingressRule := range rules {
sort.Strings(ingressRule.SourceCIDRs)
if reflect.DeepEqual(rule, ingressRule) {
err := f.client.DeleteSecRule(name)
if err != nil {
return errors.Trace(err)
}
}
}
}
return nil
} | |
c3576 | secrules {
err := f.client.DeleteSecRule(rule.Name)
if err != nil {
if api.IsNotFound(err) {
continue
}
return errors.Trace(err)
}
}
return nil
} | |
c3577 | <-f.clock.After(1 * time.Second)
iter++
continue
}
found = false
break
}
if found {
logger.Warningf(
"seclist %s is still has some associations to instance(s): %v. Will not delete",
list, assoc.Result,
)
return nil
}
err := f.deleteAllSecRulesOnList(list)
if err != nil {
return errors.... | |
c3578 | (gsamfira):this should not really happen,
// but I get paranoid when I run out of coffee
continue
}
allApps = append(allApps, val)
}
for _, val := range defaultApps.Result {
if val.PortProtocolPair() == "" {
continue
}
allApps = append(allApps, val)
}
return allApps, nil
} | |
c3579 | this map
allApps := map[string]response.SecApplication{}
for _, val := range apps {
if val.String() == "" {
continue
}
if _, ok := allApps[val.String()]; !ok {
allApps[val.String()] = val
}
}
return allApps, nil
} | |
c3580 | resourceName := f.client.ComposeName(name)
dstList := fmt.Sprintf("seclist:%s", seclist.Name)
srcList := fmt.Sprintf("seciplist:%s", ipList)
// create the new security rule parameters
rule := api.SecRuleParams{
Action: common.SecRulePermit,
Application: app,
Description: "Juju created security ru... | |
c3581 | -1 {
appCopy.Value2 = appCopy.Value1
}
return corenetwork.PortRange{
FromPort: appCopy.Value1,
ToPort: appCopy.Value2,
Protocol: string(appCopy.Protocol),
}
} | |
c3582 | {
PortRange: portRange,
SourceCIDRs: iplists[srcList].Secipentries,
},
}
} else {
toAdd := network.IngressRule{
PortRange: portRange,
SourceCIDRs: iplists[srcList].Secipentries,
}
ret[dstList] = append(ret[dstList], toAdd)
}
}
return ret, nil
} | |
c3583 | fmt.Sprintf("juju-%s-global", f.environ.Config().UUID())
} | |
c3584 | {
return fmt.Sprintf("juju-%s-%s", f.environ.Config().UUID(), machineId)
} | |
c3585 | {
return fmt.Sprintf("juju-%s-%s", f.environ.Config().UUID(), appName)
} | |
c3586 | nil
}
var ret []response.SecurityRule
for _, val := range rules.Result {
if val.Acl == aclName {
ret = append(ret, val)
}
}
return ret, nil
} | |
c3587 | when writing the oracle API
// that some fields should be bool, some should be string.
// never mind they both are boolean values...but hey.
// I swear...some people like to watch the world burn
if val.Dst_is_ip == "true" {
continue
}
// We only care about rules that have an IP list as source
if val.S... | |
c3588 |
}
if found {
continue
}
missing = append(missing, toAdd)
}
if len(missing) == 0 {
return nil
}
logger.Tracef("Found missing rules: %v", missing)
// convert the missing rules back to sec rules
asSecRule, err := f.convertToSecRules(seclist, missing)
if err != nil {
return errors.Trace(err)
}
for... | |
c3589 | name,
common.SecRulePermit,
common.SecRuleDeny)
if err != nil {
return response.SecList{}, err
}
return details, nil
}
return response.SecList{}, err
}
return details, nil
} | |
c3590 | }
allIpLists := map[string]response.SecIpList{}
for _, val := range allIps {
allIpLists[val.Name] = val
}
return allIpLists, nil
} | |
c3591 |
}
uuid, err := utils.NewUUID()
if err != nil {
return "", errors.Trace(err)
}
name := f.newResourceName(uuid.String())
resource := f.client.ComposeName(name)
secList, err := f.client.CreateSecIpList(
"Juju created security IP list",
resource, cidr)
if err != nil {
return "", errors.Trace(err)
}
*cach... | |
c3592 | := sendStatusAndJSON(w, status, err); err != nil {
logger.Errorf("%v", err)
}
} | |
c3593 | defer rs.mu.Unlock()
return rs.resources[id]
} | |
c3594 | rs.stack = append(rs.stack, id)
logger.Tracef("registered unnamed resource: %s", id)
return id
} | |
c3595 |
}
err := r.Stop()
rs.mu.Lock()
defer rs.mu.Unlock()
delete(rs.resources, id)
for pos := 0; pos < len(rs.stack); pos++ {
if rs.stack[pos] == id {
rs.stack = append(rs.stack[0:pos], rs.stack[pos+1:]...)
break
}
}
return err
} | |
c3596 | logger.Errorf("error stopping %T resource: %v", r, err)
}
}
rs.resources = make(map[string]facade.Resource)
rs.stack = nil
} | |
c3597 | rs.mu.Unlock()
return len(rs.resources)
} | |
c3598 | {
return network.Id(s.doc.ProviderId)
} | |
c3599 | childIter := subnetsCollection.Find(bson.D{{"fan-local-underlay", doc.CIDR}}).Iter()
for childIter.Next(&doc) {
subnet := &Subnet{s.st, doc, name}
results = append(results, subnet)
}
}
if err := iter.Close(); err != nil {
return nil, err
}
return results, nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.