id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c25700 | defer cache.mutex.Unlock()
pv, exists := cache.pvs[pvName]
return pv, exists
} | |
c25701 |
cache.pvs[pv.Name] = pv
glog.Infof("Added pv %q to cache", pv.Name)
} | |
c25702 |
delete(cache.pvs, pvName)
glog.Infof("Deleted pv %q from cache", pvName)
} | |
c25703 | pv := range cache.pvs {
pvs = append(pvs, pv)
}
return pvs
} | |
c25704 |
err = ioutil.WriteFile(ganeshaConfig, defaultGaneshaConfigContents, 0600)
if err != nil {
return fmt.Errorf("error writing ganesha config %s: %v", ganeshaConfig, err)
}
}
err = setGracePeriod(ganeshaConfig, gracePeriod)
if err != nil {
return fmt.Errorf("error setting grace period to ganesha config: %v",... | |
c25705 | &glusterBlockProvisioner{
client: client,
identity: id,
}
} | |
c25706 | }
case heketiOpmode:
hBlockCreateErr := p.heketiBlockVolCreate(blockRes, config, volSizeInt, haCountStr, blockVol)
if hBlockCreateErr != nil {
klog.Errorf("heketi block volume creation failed: %v", hBlockCreateErr)
return nil, fmt.Errorf("heketi block volume creation failed: %v", hBlockCreateErr)
}
de... | |
c25707 | v != "" && vol.TargetPortal == "" {
vol.TargetPortal = v
continue
} else {
vol.Portals = append(vol.Portals, v)
}
}
}
return nil
} | |
c25708 | false, fmt.Errorf("IsBlock is unsupported in this build")
} | |
c25709 | functions
return "", fmt.Errorf("Invalid disk name (%s): %v", name, err)
}
if url.Scheme != "aws" {
return "", fmt.Errorf("Invalid scheme for AWS volume (%s)", name)
}
awsID := url.Path
awsID = strings.Trim(awsID, "/")
// We sanity check the resulting volume; the two known formats are
// vol-12345678 and ... | |
c25710 | false
}
glog.V(3).Infof("Using LBaaS extension %v", lbVersion)
}
glog.V(1).Info("Claiming to support LoadBalancer")
if lbVersion == "v2" {
return &LbaasV2{LoadBalancer{network, compute, os.lbOpts}}, true
} else if lbVersion == "v1" {
return &LbaasV1{LoadBalancer{network, compute, os.lbOpts}}, true
} els... | |
c25711 | err != nil {
return nil, false
}
r, err := NewRoutes(compute, network, os.routeOpts)
if err != nil {
glog.Warningf("Error initialising Routes support: %v", err)
return nil, false
}
glog.V(1).Info("Claiming to support Routes")
return r, true
} | |
c25712 | to support Zones")
return os, true
} | |
c25713 | FailureDomain: md.AvailabilityZone,
Region: os.region,
}
glog.V(1).Infof("Current zone is %v", zone)
return zone, nil
} | |
c25714 | scheme,
actualStateOfWorld: asw,
runningOperation: goroutinemap.NewGoRoutineMap(defaultExponentialBackOffOnError),
volumePlugins: volumePlugins,
}
} | |
c25715 | PVC %s not yet bound to a PV, will not attempt to take a snapshot yet", pvcName)
}
pvName := pvc.Spec.VolumeName
pv, err := vs.getPVFromName(pvName)
if err != nil {
return nil, fmt.Errorf("Failed to retrieve PV %s from the API server: %q", pvName, err)
}
return pv, nil
} | |
c25716 | vs.coreClient.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
} | |
c25717 | Resource(crdv1.VolumeSnapshotDataResourcePlural).
Do().Into(&snapshotDataObj)
if err != nil {
glog.Errorf("Error retrieving the VolumeSnapshotData objects from API server: %v", err)
return nil, fmt.Errorf("Could not get snapshot data object %s: %v", snapshotDataName, err)
}
return &snapshotDataObj, nil
} | |
c25718 |
}
// Snapshot is found. Create VolumeSnapshotData, bind VolumeSnapshotData to VolumeSnapshot, and update VolumeSnapshot status
glog.Infof("updateSnapshotIfExists: create VolumeSnapshotData object for VolumeSnapshot %s.", uniqueSnapshotName)
pvName, ok := snapshot.Metadata.Labels[pvNameLabel]
if !ok {
return sta... | |
c25719 | err := vs.getSnapshotDataFromSnapshot(snapshotObj)
if err != nil {
return fmt.Errorf("Failed to find snapshot %v", err)
}
err = vs.waitForSnapshot(uniqueSnapshotName, snapshotObj, snapshotDataObj)
if err != nil {
return fmt.Errorf("Failed to check snapshot state %s with error %v", uniqueSnapshotNam... | |
c25720 | err := vs.bindandUpdateVolumeSnapshot(snapshot, snapshotDataObj.Metadata.Name, snapStatus)
if err != nil {
glog.Errorf("createSnapshot: Error updating volume snapshot %s: %v", uniqueSnapshotName, err)
return fmt.Errorf("Failed to update VolumeSnapshot for snapshot %s", uniqueSnapshotName)
}
// Waiting for snap... | |
c25721 | fmt.Errorf("Error updating snapshot object %s/%s on the API server: %v", snapshot.Metadata.Namespace, snapshot.Metadata.Name, err)
}
cloudTags := make(map[string]string)
cloudTags[CloudSnapshotCreatedForVolumeSnapshotNamespaceTag] = result.Metadata.Namespace
cloudTags[CloudSnapshotCreatedForVolumeSnapshotNameTag]... | |
c25722 | = append(status.Conditions, *newCondition)
} else {
oldCondition := oldStatus.Conditions[len(oldStatus.Conditions)-1]
if newCondition.Status == oldCondition.Status {
newCondition.LastTransitionTime = oldCondition.LastTransitionTime
}
status.Conditions[len(status.Conditions)-1] = *newCondition
isEqual = n... | |
c25723 | == oldCondition.Status {
condition.LastTransitionTime = oldCondition.LastTransitionTime
}
status.Conditions[len(status.Conditions)-1] = *condition
isEqual = condition.Type == oldCondition.Type &&
condition.Status == oldCondition.Status &&
condition.Reason == oldCondition.Reason &&
condition.Message =... | |
c25724 | }
glog.Infof("bindVolumeSnapshotDataToVolumeSnapshot: Updating VolumeSnapshot object [%#v]", snapshotCopy)
// TODO: Make diff of the two objects and then use restClient.Patch to update it
var result crdv1.VolumeSnapshot
err = vs.restClient.Put().
Name(snapshot.Metadata.Name).
Resource(crdv1.VolumeSnapshotResou... | |
c25725 | }
class, err := p.client.StorageV1().StorageClasses().Get(className, metav1.GetOptions{})
if err != nil {
return nil, err
}
return class, nil
} | |
c25726 |
listSnapshotsRetryDuration: listSnapshotsRetryDuration,
desiredStateOfWorld: desiredStateOfWorld,
snapshotStore: snapshotStore,
}
} | |
c25727 | return plugin.NewDriverCallWithTimeout(execPath, command, 0)
} | |
c25728 |
Command: command,
Timeout: timeout,
plugin: plugin,
args: []string{command},
}
} | |
c25729 |
if err != nil {
return fmt.Errorf("Failed to marshal spec, error: %s", err.Error())
}
dc.Append(string(jsonBytes))
return nil
} | |
c25730 |
return nil, execErr
}
klog.Warningf("FlexVolume: driver call failed: executable: %s, args: %s, error: %s, output: %q", dc.Execpath, dc.args, execErr.Error(), output)
return nil, err
}
status, err := handleCmdResponse(dc.Command, output)
if err != nil {
return nil, err
}
return status, nil
} | |
c25731 | for key, value := range volumeOptions {
options[key] = value
}
return OptionsForDriver(options), nil
} | |
c25732 | := cache.MetaNamespaceKeyFunc(newObj)
if err == nil {
glog.Infof("Got update notification for %s", key)
queue.Add(key)
}
return
},
DeleteFunc: func(obj interface{}) {
key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
if err == nil {
glog.Infof("Got delete notification for %s", ... | |
c25733 |
// requeue the item to work on later
c.queue.AddRateLimited(key)
} else {
// err != nil and too many retries
glog.Errorf("Error processing %s (giving up): %v", key, err)
c.queue.Forget(key)
utilruntime.HandleError(err)
}
return true
} | |
c25734 | glog.Warningf("Failed to check whether job %s is running (%s). Assuming its still running.",
jobName, err)
return true
}
return job.Status.Succeeded <= 0
} | |
c25735 | parsedStartTime, err := time.Parse(time.RFC3339Nano, startTimeStr)
if err == nil {
startTime = &parsedStartTime
} else {
glog.Errorf("Failed to parse start time %s: %v", startTimeStr, err)
}
}
if job.Status.Succeeded == 0 {
// Jobs has not yet succeeded. We assume failed jobs to be still running, unti... | |
c25736 | := map[string]string{
DeviceAnnotation: mountPath,
StartTimeAnnotation: time.Now().Format(time.RFC3339Nano),
}
podTemplate := apiv1.Pod{}
podTemplate.Spec = apiv1.PodSpec{
Containers: []apiv1.Container{jobContainer},
Volumes: volumes,
NodeSelector: map[string]string{common.NodeNameLabel: nodeNa... | |
c25737 | bool {
c.IsRunningCount++
_, exists := c.pvCleanupRunning[pvName]
return exists
} | |
c25738 |
return CSUnknown, nil, fmt.Errorf("cannot remove job that has not yet completed %s status %d", pvName, status)
}
return CSSucceeded, nil, nil
} | |
c25739 |
addr, err := openebsObj.GetMayaClusterIP(client)
if err != nil {
glog.Errorf("Error getting maya-apiserver IP Address: %v", err)
return nil
}
mayaServiceURI := "http://" + addr + ":5656"
//Set maya-apiserver IP address along with default port
os.Setenv("MAPI_ADDR", mayaServiceURI)
return &openEBSProvisio... | |
c25740 | state of world: %s", snapshotName)
asw.snapshots[snapshotName] = snapshot
return nil
} | |
c25741 |
glog.Infof("Deleting snapshot from actual state of world: %s", snapshotName)
delete(asw.snapshots, snapshotName)
return nil
} | |
c25742 | {
for index, data := range array {
iterator(data, index)
}
} | |
c25743 | make([]interface{}, len(array))
for index, data := range array {
result[index] = iterator(data, index)
}
return result
} | |
c25744 |
if iterator(data, index) {
return data
}
}
return nil
} | |
c25745 |
if iterator(data, index) {
result = append(result, data)
}
}
return result
} | |
c25746 |
if iterator(data, index) {
count = count + 1
}
}
return count
} | |
c25747 | unicode.IsSpace)
}
r, _ := regexp.Compile("^[" + chars + "]+")
return r.ReplaceAllString(str, "")
} | |
c25748 | unicode.IsSpace)
}
r, _ := regexp.Compile("[" + chars + "]+$")
return r.ReplaceAllString(str, "")
} | |
c25749 | {
return LeftTrim(RightTrim(str, chars), chars)
} | |
c25750 | + chars + "]+"
r, _ := regexp.Compile(pattern)
return r.ReplaceAllString(str, "")
} | |
c25751 | {
r, _ := regexp.Compile(pattern)
return r.ReplaceAllString(str, replace)
} | |
c25752 | j-1 {
r[i], r[j] = r[j], r[i]
}
return string(r)
} | |
c25753 | return "", errors.New("line index out of bounds")
}
return lines[index], nil
} | |
c25754 |
if err == nil {
name = legal.ReplaceAllString(name, "")
}
for strings.Contains(name, "--") {
name = strings.Replace(name, "--", "-", -1)
}
return name
} | |
c25755 |
if (length - before) < (present - length) {
return Trim(befstr, " /\\.,\"'#!?&@+-") + ending
}
return Trim(aftstr, " /\\.,\"'#!?&@+-") + ending
}
}
}
return str
} | |
c25756 | return buildPadStr(str, padStr, padLen, true, false)
} | |
c25757 | return buildPadStr(str, padStr, padLen, true, true)
} | |
c25758 | padLeft && padRight {
targetLenLeft = padLen / 2
targetLenRight = padLen - targetLenLeft
}
strToRepeatLen := utf8.RuneCountInString(padStr)
repeatTimes := int(math.Ceil(float64(targetLen) / float64(strToRepeatLen)))
repeatedString := strings.Repeat(padStr, repeatTimes)
leftSide := ""
if padLeft {
leftSi... | |
c25759 | := strings.Count(str, "%s")
return fmt.Errorf(str, args[:n]...)
} | |
c25760 | res = []byte("")
}
return string(res), err
} | |
c25761 | err != nil {
res = 0.0
}
return res, err
} | |
c25762 |
} else {
err = fmt.Errorf("math: square root of negative number %g", value)
res = 0
}
default:
err = fmt.Errorf("math: square root of negative number %g", value)
res = 0
}
return
} | |
c25763 | reflectRight == reflect.Float32 {
return InRangeFloat32(value.(float32), left.(float32), right.(float32))
} else if reflectValue == reflect.Float64 && reflectLeft == reflect.Float64 && reflectRight == reflect.Float64 {
return InRangeFloat64(value.(float64), left.(float64), right.(float64))
} else {
return fals... | |
c25764 |
return false
}
switch host {
case "localhost", "example.com":
return true
}
if _, err := net.LookupMX(host); err != nil {
if _, err := net.LookupIP(host); err != nil {
return false
}
}
return true
} | |
c25765 | {
return false //Couldn't even parse the rawurl
}
if len(url.Scheme) == 0 {
return false //No Scheme found
}
return true
} | |
c25766 | url.ParseRequestURI(rawurl)
return err == nil
} | |
c25767 | {
return true
}
return str == strings.ToLower(str)
} | |
c25768 | {
return true
}
return str == strings.ToUpper(str)
} | |
c25769 | rxHasLowerCase.MatchString(str)
} | |
c25770 | rxHasUpperCase.MatchString(str)
} | |
c25771 | {
return true
}
return rxInt.MatchString(str)
} | |
c25772 | {
return true
}
return rxFullWidth.MatchString(str)
} | |
c25773 | {
return true
}
return rxHalfWidth.MatchString(str)
} | |
c25774 | return true
}
return rxHalfWidth.MatchString(str) && rxFullWidth.MatchString(str)
} | |
c25775 | return true, Win
} else if rxUnixPath.MatchString(str) {
return true, Unix
}
return false, Unknown
} | |
c25776 | {
return false
}
return IsBase64(dataURI[1])
} | |
c25777 | ISO3166List {
if str == entry.Alpha2Code {
return true
}
}
return false
} | |
c25778 | ISO3166List {
if str == entry.Alpha3Code {
return true
}
}
return false
} | |
c25779 | ISO693List {
if str == entry.Alpha2Code {
return true
}
}
return false
} | |
c25780 | ISO693List {
if str == entry.Alpha3bCode {
return true
}
}
return false
} | |
c25781 | < 65536 {
return true
}
return false
} | |
c25782 | nil && strings.Contains(str, ".")
} | |
c25783 | return false
}
}
key, err := x509.ParsePKIXPublicKey(der)
if err != nil {
return false
}
pubkey, ok := key.(*rsa.PublicKey)
if !ok {
return false
}
bitlen := len(pubkey.N.Bytes()) * 8
return bitlen == int(keylen)
} | |
c25784 | if err2 != nil {
// Replace structure name with JSON name if there is a tag on the variable
jsonTag := toJSONName(typeField.Tag.Get("json"))
if jsonTag != "" {
switch jsonError := err2.(type) {
case Error:
jsonError.Name = jsonTag
err2 = jsonError
case Errors:
for i2, err3 := rang... | |
c25785 | }
return rxSSN.MatchString(str)
} | |
c25786 | := time.Parse(format, str)
return err == nil
} | |
c25787 | ISO4217List {
if str == currency {
return true
}
}
return false
} | |
c25788 |
return len(str) >= int(min) && len(str) <= int(max)
}
return false
} | |
c25789 |
return IsRsaPublicKey(str, int(len))
}
return false
} | |
c25790 | return Matches(s, pattern)
}
return false
} | |
c25791 | _ := ToFloat(params[1])
return InRange(value, min, max)
}
return false
} | |
c25792 | == param {
return true
}
}
return false
} | |
c25793 | return ""
}
return ErrorsByField(e)[field]
} | |
c25794 | := range e.(Errors).Errors() {
n := ErrorsByField(item)
for k, v := range n {
m[k] = v
}
}
}
return m
} | |
c25795 |
args = append(args, packageName)
if err := utils.GoCommand("build", args...); err != nil {
return "", err
}
fp, err := filepath.Abs("./debug")
if err != nil {
return "", err
}
return fp, nil
} | |
c25796 | return filepath.SkipDir
}
if strings.HasSuffix(info.Name(), "vendor") {
return filepath.SkipDir
}
if filepath.Ext(info.Name()) == ".go" {
*paths = append(*paths, path)
}
return nil
})
return nil
} | |
c25797 |
if _, err := client.Restart(); err != nil {
utils.Notify("Error while restarting the client: "+err.Error(), "bee")
} else {
if verbose {
utils.Notify("Delve Debugger Restarted", "bee")
}
}
}
}
}()
// Create the terminal and connect it to the client debugger
term := terminal.Ne... | |
c25798 | utils.Notify("Rebuilding application with the new changes", "bee")
}
// Wait 1s before re-build until there is no file change
scheduleTime := time.Now().Add(1 * time.Second)
time.Sleep(time.Until(scheduleTime))
_, err := buildDebug()
if err != nil {
utils.Notify("Build Failed: "+... | |
c25799 | '.') {
err = parsePackageFromDir(fpath)
if err != nil {
// Send the error to through the channel and continue walking
c <- fmt.Errorf("error while parsing directory: %s", err.Error())
return nil
}
}
return nil
})
close(c)
}()
for err := range c {
beeLogger.Log.Warnf("%s", err)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.