id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c161600
if err != nil { return err } payload := make(libkb.JSONPayload) section := make(libkb.JSONPayload) section["encrypted_parent"] = boxed.EncParentB64 section["visible_parent"] = boxed.VisParentB64 section["version_parent"] = boxed.FormatVersionParent section["account_bundles"] = boxed.AcctBundles payload["st...
c161601
})() bundle, _, _, _, err = fetchBundleForAccount(mctx, &accountID) return bundle, err }
c161602
mctx.Debug("unable to pull secrets for account %v which is not necessarily a problem %v", acct.AccountID, err) continue } accBundle := singleBundle.AccountBundles[acct.AccountID] newAccBundles[acct.AccountID] = accBundle accountGens[acct.AccountID] = singleAccountGens[acct.AccountID] } b.AccountBundles =...
c161603
:= bundle.AdvanceAccounts(*b, []stellar1.AccountID{accountID}) if err := Post(mctx, nextBundle); err != nil { mctx.Debug("SetAccountMobileOnly Post error: %s", err) return err } return nil }
c161604
to log the full folder-branch // name for kbfsfuse but not for kbfs. cmd := flag.Arg(0) args := flag.Args()[1:] switch cmd { case "stat": return stat(ctx, config, args) case "ls": return ls(ctx, config, args) case "mkdir": return mkdir(ctx, config, args) case "read": return read(ctx, config, args) c...
c161605
{ return p.Path[len(p.Path)-1].Name }
c161606
{ return p.Path[len(p.Path)-1].BlockPointer }
c161607
{ return p.Path[len(p.Path)-1].Ref() }
c161608
} return fmt.Sprintf("%s:%s", p.FolderBranch, strings.Join(debugNames, "/")) }
c161609
names = append(names, node.Name) } return strings.Join(names, "/") }
c161610
&Path{p.FolderBranch, p.Path[:len(p.Path)-1]} }
c161611
make([]PathNode, len(p.Path), len(p.Path)+1), } copy(child.Path, p.Path) child.Path = append(child.Path, PathNode{Name: name, BlockPointer: ptr}) return child }
c161612
p.ChildPath(name, BlockPointer{}) }
c161613
fmt.Sprintf("%s(ptr=%s)", n.Name, n.BlockPointer) }
c161614
0, name: s, parent: t} t.locks[s] = ret } ret.incref() t.Unlock() ret.Lock() g.GetVDebugLog().CLogf(ctx, VLog1, "- LockTable.Lock(%s)", s) return ret }
c161615
// This fits in situation 1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, f.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return err } return f.attr(ctx, a) }
c161616
in situation 1 as described in libkbfs/delayed_cancellation.go err = libcontext.EnableDelayedCancellationWithGracePeriod( ctx, f.folder.fs.config.DelayedCancellationGracePeriod()) if err != nil { return err } return f.sync(ctx) }
c161617
sz) defer func() { err = f.folder.processError(ctx, libkbfs.ReadMode, err) }() n, err := f.folder.fs.config.KBFSOps().Read( ctx, f.node, resp.Data[:sz], off) if err != nil { return err } resp.Data = resp.Data[:n] return nil }
c161618
= f.folder.processError(ctx, libkbfs.WriteMode, err) }() f.eiCache.destroy() if err := f.folder.fs.config.KBFSOps().Write( ctx, f.node, req.Data, req.Offset); err != nil { return err } resp.Size = len(req.Data) return nil }
c161619
return err } valid &^= fuse.SetattrMode } if valid.Mtime() { err := f.folder.fs.config.KBFSOps().SetMtime( ctx, f.node, &req.Mtime) if err != nil { return err } valid &^= fuse.SetattrMtime | fuse.SetattrMtimeNow } if valid.Uid() || valid.Gid() { // You can't set the UID/GID on KBFS files, bu...
c161620
{ return &SigsHandler{ BaseHandler: NewBaseHandler(g, xp), Contextified: libkb.NewContextified(g), } }
c161621
err != nil { return nil, -1, time.Time{}, err } if _, ok := cache.tlfsCached[tlfID]; !ok { cache.missMeter.Mark(1) return nil, -1, time.Time{}, errors.WithStack(ldberrors.ErrNotFound) } md, err := cache.getMetadataLocked(tlfID, metered) if err != nil { return nil, -1, time.Time{}, err } return md.Buf,...
c161622
return nil } md := diskMDBlock{ Buf: buf, Ver: ver, Time: timestamp, Revision: rev, } cache.tlfsStaged[tlfID] = append(cache.tlfsStaged[tlfID], md) return nil }
c161623
encodedMetadata, err := cache.config.Codec().Encode(&md) if err != nil { return err } err = cache.headsDb.PutWithMeter( tlfID.Bytes(), encodedMetadata, cache.putMeter) if err != nil { return err } } if !foundMD { // Nothing to do. return nil } cache.tlfsCached[tlfID] = rev if len(newSt...
c161624
== 1 { delete(cache.tlfsStaged, tlfID) } else { cache.tlfsStaged[tlfID] = append( stagedMDs[:i], stagedMDs[i+1:]...) } return nil } } return nil }
c161625
cache.lock.RUnlock() numStaged := uint64(0) for _, mds := range cache.tlfsStaged { numStaged += uint64(len(mds)) } return DiskMDCacheStatus{ StartState: DiskMDCacheStartStateStarted, NumMDs: uint64(len(cache.tlfsCached)), NumStaged: numStaged, Hits: rateMeterToStatus(cache.hitMeter), Misses...
c161626
to be checked under lock, otherwise we can race. select { case <-cache.shutdownCh: cache.log.CWarningf(ctx, "Shutdown called more than once") return default: } close(cache.shutdownCh) if cache.headsDb == nil { return } cache.closer() cache.headsDb = nil cache.hitMeter.Shutdown() cache.missMeter.Shutdo...
c161627
of background service.", }, cli.BoolFlag{ Name: "no-auto-fork, F", Usage: "Disable auto-fork of background service.", }, } }
c161628
return ForkServer(g, cl, keybase1.ForkType_AUTO) }
c161629
config: cliConfig, clients: make(map[int]*Client), Contextified: NewContextified(g), }, } return i, nil }
c161630
resp.Header.Get("Date"))) needUpdate := (criticalClockSkew != a.G().outOfDateInfo.CriticalClockSkew) g.oodiMu.RUnlock() if needUpdate { g.oodiMu.Lock() g.outOfDateInfo.CriticalClockSkew = criticalClockSkew g.oodiMu.Unlock() } }
c161631
m = m.EnsureCtx().WithLogTag("API") return a.getDecode(m, arg, v) }
c161632
arg APIArg) (*APIRes, error) { return a.Post(m, arg) }
c161633
return ops } } resOp, ok := ops[len(ops)-1].(*resolutionOp) if !ok { resOp = newResolutionOp() ops = append(ops, resOp) } resOp.AddUncommittedUnrefBlock(ptr) return ops }
c161634
= make(map[data.BlockPointer]data.BlockInfo) } for _, info := range infos { fup.cachedInfos[info.BlockPointer] = info } }
c161635
false /* resolveSupersedes */) if err != nil { return nil, err } if supersededMsg.IsEphemeral() { metadata = supersededMsg.EphemeralMetadata() metadata.Lifetime = gregor1.ToDurationSec(supersededMsg.RemainingEphemeralLifetime(s.clock.Now())) } return metadata, nil }
c161636
msg.ClientHeader.Deletes = []chat1.MessageID{reactionMsgID} msg.MessageBody = chat1.NewMessageBodyWithDelete(chat1.MessageDelete{ MessageIDs: []chat1.MessageID{reactionMsgID}, }) } else { // bookkeep the reaction used so we can keep track of the user's // popular reactions in the UI if err := storage.Ne...
c161637
%s", err) return nil } if err := s.store.DeleteAssets(ctx, params, s, assets); err != nil { s.G().Log.Warning("error deleting assets: %s", err) // there's no way to get asset information after this point. // any assets not deleted will be stranded on s3. return nil } s.G().Log.Debug("deleted %d asset...
c161638
%v", o.ConvID, o.OutboxID) } return shouldCancel }) if err != nil { return false, err } else if !inOutbox { // we were canceled previously, the jig is up return true, nil } else if numCanceled%2 == 1 { // Since we're just toggling the reaction on/off, we should abort here // and remove ourselves fro...
c161639
groups[name] mu.RUnlock() return g }
c161640
getter, peers: peers, cacheBytes: cacheBytes, loadGroup: &singleflight.Group{}, } if fn := newGroupHook; fn != nil { fn(g) } groups[name] = g return g }
c161641
// 1: Get("key") // 2: Get("key") // 1: lookupCache("key") // 2: lookupCache("key") // 1: load("key") // 2: load("key") // 1: loadGroup.Do("key", fn) // 1: fn() // 2: loadGroup.Do("key", fn) // 2: fn() if value, cacheHit := g.lookupCache(key); cacheHit { g.Stats.CacheHits.Add(1) return value,...
c161642
return g.hotCache.stats() default: return CacheStats{} } }
c161643
atomic.AddInt64((*int64)(i), n) }
c161644
return &byteViewSink{dst: dst} }
c161645
panic("RegisterPeerPicker called more than once") } portPicker = func(_ string) PeerPicker { return fn() } }
c161646
panic("RegisterPeerPicker called more than once") } portPicker = fn }
c161647
return len(v.b) } return len(v.s) }
c161648
v.b != nil { return cloneBytes(v.b) } return []byte(v.s) }
c161649
if v.b != nil { return string(v.b) } return v.s }
c161650
v.b[i] } return v.s[i] }
c161651
!= nil { return ByteView{b: v.b[from:to]} } return ByteView{s: v.s[from:to]} }
c161652
!= nil { return ByteView{b: v.b[from:]} } return ByteView{s: v.s[from:]} }
c161653
v.b != nil { return copy(dest, v.b) } return copy(dest, v.s) }
c161654
return v.EqualString(b2.s) } return v.EqualBytes(b2.b) }
c161655
:= range v.b { if bi != s[i] { return false } } return true }
c161656
for i, bi := range b2 { if bi != v.s[i] { return false } } return true }
c161657
return bytes.NewReader(v.b) } return strings.NewReader(v.s) }
c161658
n = v.SliceFrom(int(off)).Copy(p) if n < len(p) { err = io.EOF } return }
c161659
== nil && m < v.Len() { err = io.ErrShortWrite } n = int64(m) return }
c161660
m.keys = append(m.keys, hash) m.hashMap[hash] = key } } sort.Ints(m.keys) }
c161661
have cycled back to the first replica. if idx == len(m.keys) { idx = 0 } return m.hashMap[m.keys[idx]] }
c161662
e.defaultRole, e.claimsEnforcerFunc, rvals...) }
c161663
rval) } errMsg = fmt.Sprintf("%s: %s", errMsg, strings.Join(rvalsStrs, ", ")) } return status.Error(codes.PermissionDenied, errMsg) } return nil }
c161664
{ log.Warnf("invalid runtime policy: %s", policy) enf = e.Enforcer } } return enforce(enf, e.defaultRole, e.claimsEnforcerFunc, rvals...) }
c161665
s := sub.(type) { case string: // noop case jwt.Claims: if claimsEnforcerFunc != nil && claimsEnforcerFunc(s, rvals...) { return true } rvals = append([]interface{}{""}, rvals[1:]...) default: rvals = append([]interface{}{""}, rvals[1:]...) } return enf.Enforce(rvals...) }
c161666
error { e.adapter.builtinPolicy = policy return e.LoadPolicy() }
c161667
error { e.adapter.userDefinedPolicy = policy return e.LoadPolicy() }
c161668
return v1.NewFilteredConfigMapInformer(e.clientset, e.namespace, defaultRBACSyncPeriod, cache.Indexers{}, tweakConfigMap) }
c161669
} } else { err = e.syncUpdate(cm) if err != nil { return err } } e.runInformer(ctx) return nil }
c161670
cm.Data[ConfigMapPolicyCSVKey] if !ok { policyCSV = "" } return e.SetUserPolicy(policyCSV) }
c161671
return fmt.Errorf("policy syntax error: %s", policy) } return nil }
c161672
workqueue.NewRateLimitingQueue(workqueue.DefaultControllerRateLimiter()), db: db, statusRefreshTimeout: appResyncPeriod, refreshRequestedApps: make(map[string]bool), refreshRequestedAppsMutex: &sync.Mutex{}, auditLogger: argo.NewAuditLogger(namespace, kubeCli...
c161673
{ go wait.Until(func() { for ctrl.processAppRefreshQueueItem() { } }, time.Second, ctx.Done()) } for i := 0; i < operationProcessors; i++ { go wait.Until(func() { for ctrl.processAppOperationQueueItem() { } }, time.Second, ctx.Done()) } <-ctx.Done() }
c161674
} else if !app.Spec.Source.Equals(app.Status.Sync.ComparedTo.Source) { reason = "spec.source differs" } else if !app.Spec.Destination.Equals(app.Status.Sync.ComparedTo.Destination) { reason = "spec.destination differs" } else if expired { reason = fmt.Sprintf("comparison expired. reconciledAt: %v, expiry: %v"...
c161675
if err != nil { logCtx.Errorf("error constructing app spec patch: %v", err) } else if modified { appClient := ctrl.applicationClientset.ArgoprojV1alpha1().Applications(app.Namespace) _, err = appClient.Patch(app.Name, types.MergePatchType, patch) if err != nil { logCtx.Errorf("Error persisting normalized ...
c161676
} delete(newAnnotations, common.AnnotationKeyRefresh) } patch, modified, err := diff.CreateTwoWayMergePatch( &appv1.Application{ObjectMeta: metav1.ObjectMeta{Annotations: orig.GetAnnotations()}, Status: orig.Status}, &appv1.Application{ObjectMeta: metav1.ObjectMeta{Annotations: newAnnotations}, Status: *newSt...
c161677
:= fmt.Sprintf("Failed sync attempt to %s: %s", desiredCommitSHA, app.Status.OperationState.Message) return &appv1.ApplicationCondition{Type: appv1.ApplicationConditionSyncError, Message: message} } logCtx.Infof("Skipping auto-sync: most recent sync already to %s", desiredCommitSHA) return nil } op := appv...
c161678
specSource := app.Spec.Source.DeepCopy() specSource.TargetRevision = "" syncResSource := app.Status.OperationState.SyncResult.Source.DeepCopy() syncResSource.TargetRevision = "" return reflect.DeepEqual(app.Spec.Source, app.Status.OperationState.SyncResult.Source) }
c161679
previously disabled if old.Spec.SyncPolicy == nil || old.Spec.SyncPolicy.Automated == nil { return true } // nothing changed return false }
c161680
now ready to actually perform the sync. if sc.syncOp.SyncStrategy == nil { // default sync strategy to hook if no strategy sc.syncOp.SyncStrategy = &appv1.SyncStrategy{Hook: &appv1.SyncStrategyHook{}} } if sc.syncOp.SyncStrategy.Apply != nil { if !sc.startedSyncPhase() { if !sc.doApplySync(syncTasks, false...
c161681
{ if res.IsHook() && res.HookType == appv1.HookTypePostSync { return true } } return false }
c161682
:= sc.kubectl.ApplyResource(sc.config, targetObj, targetObj.GetNamespace(), dryRun, force) if err != nil { resDetails.Message = err.Error() resDetails.Status = appv1.ResultCodeSyncFailed return resDetails } resDetails.Message = message resDetails.Status = appv1.ResultCodeSynced return resDetails }
c161683
deletionTimestamp := liveObj.GetDeletionTimestamp() if deletionTimestamp == nil || deletionTimestamp.IsZero() { err := sc.kubectl.DeleteResource(sc.config, liveObj.GroupVersionKind(), liveObj.GetName(), liveObj.GetNamespace(), false) if err != nil { resDetails.Message = err.Error() resDetails.Sta...
c161684
res.Name, res.Message, details.Message) } sc.syncRes.Resources[i] = details return } } sc.log.Infof("added resource %s/%s status: %s, message: %s", details.Kind, details.Name, details.Status, details.Message) sc.syncRes.Resources = append(sc.syncRes.Resources, details) }
c161685
&kustomize{ path: path, creds: creds, } }
c161686
if _, err := os.Stat(kustomization); err == nil { return kustomization, nil } } return "", errors.New("did not find kustomization in " + k.path) }
c161687
{ dexURL, _ := url.Parse(dexServerAddr) return DexRewriteURLRoundTripper{ DexURL: dexURL, T: T, } }
c161688
Namespace: namespace, }, } _, err := clientset.CoreV1().ServiceAccounts(namespace).Create(&serviceAccount) if err != nil { if !apierr.IsAlreadyExists(err) { return fmt.Errorf("Failed to create service account %q: %v", serviceAccountName, err) } log.Infof("ServiceAccount %q already exists", serviceAccou...
c161689
} _, err = crclient.Update(&clusterRole) if err != nil { return fmt.Errorf("Failed to update ClusterRole %q: %v", clusterRoleName, err) } log.Infof("ClusterRole %q updated", clusterRoleName) } else { log.Infof("ClusterRole %q created", clusterRoleName) } return nil }
c161690
err != nil { if !apierr.IsAlreadyExists(err) { return fmt.Errorf("Failed to create ClusterRoleBinding %s: %v", clusterBindingRoleName, err) } log.Infof("ClusterRoleBinding %q already exists", clusterBindingRoleName) return nil } log.Infof("ClusterRoleBinding %q created, bound %q to %q", clusterBindingRole...
c161691
wait.Poll(500*time.Millisecond, 30*time.Second, func() (bool, error) { serviceAccount, err = clientset.CoreV1().ServiceAccounts(ns).Get(ArgoCDManagerServiceAccount, metav1.GetOptions{}) if err != nil { return false, err } if len(serviceAccount.Secrets) == 0 { return false, nil } secretName = serviceA...
c161692
"kube-system", ArgoCDManagerClusterRoleBinding, ArgoCDManagerClusterRole, ArgoCDManagerServiceAccount) }
c161693
{ log.Infof("ClusterRole %q deleted", roleName) } if err := clientset.CoreV1().ServiceAccounts(namespace).Delete(serviceAccount, &metav1.DeleteOptions{}); err != nil { if !apierr.IsNotFound(err) { return fmt.Errorf("Failed to delete ServiceAccount: %v", err) } log.Infof("ServiceAccount %q in namespace %q...
c161694
return false } hooks, ok := annotations[common.AnnotationKeyHelmHook] if ok && hasHook(hooks, common.AnnotationValueHelmHookCRDInstall) { return false } return ok }
c161695
h.Write([]byte(s)) return h.Sum32() }
c161696
a.cache.SetOIDCState(randStr, &cache.OIDCState{ReturnURL: returnURL}) if err != nil { // This should never happen with the in-memory cache log.Errorf("Failed to set app state: %v", err) } return randStr }
c161697
if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return } vals.ReturnURL = appState.ReturnURL } renderTemplate(w, implicitFlowTmpl, vals) }
c161698
} // See if scopes_supported has the "offline_access" scope. for _, scope := range scopes { if scope == gooidc.ScopeOfflineAccess { return true } } return false }
c161699
have unintended effects or hard-to-catch issues when populating our application object. jsonData, err := yaml.YAMLToJSON(data) if err != nil { return err } err = json.Unmarshal(jsonData, &obj) if err != nil { return err } return err }