test: Tokens should always have a colon
This commit is contained in:
18
etcd/etcd.go
18
etcd/etcd.go
@@ -1086,7 +1086,7 @@ func (obj *EmbdEtcd) rawAddWatcher(ctx context.Context, aw *AW) (func(), error)
|
||||
}
|
||||
|
||||
if err == nil { // watch from latest good revision
|
||||
rev = response.Header.Revision // TODO +1 ?
|
||||
rev = response.Header.Revision // TODO: +1 ?
|
||||
useRev = true
|
||||
if !locked {
|
||||
retry = false
|
||||
@@ -1400,7 +1400,7 @@ func (obj *EmbdEtcd) nominateCallback(re *RE) error {
|
||||
if global.DEBUG {
|
||||
log.Printf("Etcd: nominateCallback(): newCluster: %v; exists: %v; obj.server == nil: %t", newCluster, exists, obj.server == nil)
|
||||
}
|
||||
// XXX check if i have actually volunteered first of all...
|
||||
// XXX: check if i have actually volunteered first of all...
|
||||
if obj.server == nil && (newCluster || exists) {
|
||||
|
||||
log.Printf("Etcd: StartServer(newCluster: %t): %+v", newCluster, obj.nominated)
|
||||
@@ -1431,7 +1431,7 @@ func (obj *EmbdEtcd) nominateCallback(re *RE) error {
|
||||
// XXX: just put this wherever for now so we don't block
|
||||
// nominate self so "member" list is correct for peers to see
|
||||
EtcdNominate(obj, obj.hostname, obj.serverURLs)
|
||||
// XXX if this fails, where will we retry this part ?
|
||||
// XXX: if this fails, where will we retry this part ?
|
||||
}
|
||||
|
||||
// advertise client urls
|
||||
@@ -1439,7 +1439,7 @@ func (obj *EmbdEtcd) nominateCallback(re *RE) error {
|
||||
// XXX: don't advertise local addresses! 127.0.0.1:2381 doesn't really help remote hosts
|
||||
// XXX: but sometimes this is what we want... hmmm how do we decide? filter on callback?
|
||||
EtcdAdvertiseEndpoints(obj, curls)
|
||||
// XXX if this fails, where will we retry this part ?
|
||||
// XXX: if this fails, where will we retry this part ?
|
||||
|
||||
// force this to remove sentinel before we reconnect...
|
||||
obj.endpointCallback(nil)
|
||||
@@ -1655,7 +1655,7 @@ func (obj *EmbdEtcd) StartServer(newCluster bool, peerURLsMap etcdtypes.URLsMap)
|
||||
} else {
|
||||
cfg.ClusterState = embed.ClusterStateFlagExisting
|
||||
}
|
||||
//cfg.ForceNewCluster = newCluster // TODO ?
|
||||
//cfg.ForceNewCluster = newCluster // TODO: ?
|
||||
|
||||
log.Printf("Etcd: StartServer: Starting server...")
|
||||
obj.server, err = embed.StartEtcd(cfg)
|
||||
@@ -1959,7 +1959,7 @@ func EtcdGetClusterSize(obj *EmbdEtcd) (uint16, error) {
|
||||
|
||||
// EtcdMemberAdd adds a member to the cluster.
|
||||
func EtcdMemberAdd(obj *EmbdEtcd, peerURLs etcdtypes.URLs) (*etcd.MemberAddResponse, error) {
|
||||
//obj.Connect(false) // TODO ?
|
||||
//obj.Connect(false) // TODO: ?
|
||||
ctx := context.Background()
|
||||
var response *etcd.MemberAddResponse
|
||||
var err error
|
||||
@@ -1984,7 +1984,7 @@ func EtcdMemberAdd(obj *EmbdEtcd, peerURLs etcdtypes.URLs) (*etcd.MemberAddRespo
|
||||
// if there was an error. This is because it might have run without error, but
|
||||
// the member wasn't found, for example.
|
||||
func EtcdMemberRemove(obj *EmbdEtcd, mID uint64) (bool, error) {
|
||||
//obj.Connect(false) // TODO ?
|
||||
//obj.Connect(false) // TODO: ?
|
||||
ctx := context.Background()
|
||||
for {
|
||||
if obj.exiting { // the exit signal has been sent!
|
||||
@@ -2010,7 +2010,7 @@ func EtcdMemberRemove(obj *EmbdEtcd, mID uint64) (bool, error) {
|
||||
// The member ID's are the keys, because an empty names means unstarted!
|
||||
// TODO: consider queueing this through the main loop with CtxError(ctx, err)
|
||||
func EtcdMembers(obj *EmbdEtcd) (map[uint64]string, error) {
|
||||
//obj.Connect(false) // TODO ?
|
||||
//obj.Connect(false) // TODO: ?
|
||||
ctx := context.Background()
|
||||
var response *etcd.MemberListResponse
|
||||
var err error
|
||||
@@ -2041,7 +2041,7 @@ func EtcdMembers(obj *EmbdEtcd) (map[uint64]string, error) {
|
||||
|
||||
// EtcdLeader returns the current leader of the etcd server cluster
|
||||
func EtcdLeader(obj *EmbdEtcd) (string, error) {
|
||||
//obj.Connect(false) // TODO ?
|
||||
//obj.Connect(false) // TODO: ?
|
||||
var err error
|
||||
membersMap := make(map[uint64]string)
|
||||
if membersMap, err = EtcdMembers(obj); err != nil {
|
||||
|
||||
@@ -792,7 +792,7 @@ func (g *Graph) Worker(v *Vertex) error {
|
||||
// TODO: resources could have a separate exit channel to avoid this complexity!?
|
||||
case event := <-obj.Events():
|
||||
// NOTE: this code should match the similar Res code!
|
||||
//cuuid.SetConverged(false) // TODO ?
|
||||
//cuuid.SetConverged(false) // TODO: ?
|
||||
if exit, send := obj.ReadEvent(&event); exit {
|
||||
return nil // exit
|
||||
} else if send {
|
||||
|
||||
@@ -96,11 +96,11 @@ func (obj *RecWatcher) Init() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//func (obj *RecWatcher) Add(path string) error { // XXX implement me or not?
|
||||
//func (obj *RecWatcher) Add(path string) error { // XXX: implement me or not?
|
||||
//
|
||||
//}
|
||||
//
|
||||
//func (obj *RecWatcher) Remove(path string) error { // XXX implement me or not?
|
||||
//func (obj *RecWatcher) Remove(path string) error { // XXX: implement me or not?
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -209,7 +209,7 @@ func (obj *RecWatcher) Watch() error {
|
||||
}
|
||||
|
||||
} else {
|
||||
// TODO different watchers get each others events!
|
||||
// TODO: different watchers get each others events!
|
||||
// https://github.com/go-fsnotify/fsnotify/issues/95
|
||||
// this happened with two values such as:
|
||||
// event.Name: /tmp/mgmt/f3 and current: /tmp/mgmt/f2
|
||||
|
||||
@@ -99,7 +99,7 @@ func (obj *ExecRes) BufioChanScanner(scanner *bufio.Scanner) (chan string, chan
|
||||
ch <- scanner.Text() // blocks here ?
|
||||
if e := scanner.Err(); e != nil {
|
||||
errch <- e // send any misc errors we encounter
|
||||
//break // TODO ?
|
||||
//break // TODO: ?
|
||||
}
|
||||
}
|
||||
close(ch)
|
||||
@@ -236,8 +236,8 @@ func (obj *ExecRes) CheckApply(apply bool) (checkok bool, err error) {
|
||||
//} else if obj.IfCmd != "" && obj.WatchCmd != "" {
|
||||
|
||||
if obj.PollInt > 0 { // && obj.WatchCmd == ""
|
||||
// XXX have the Watch() command output onlyif poll events...
|
||||
// XXX we can optimize by saving those results for returning here
|
||||
// XXX: have the Watch() command output onlyif poll events...
|
||||
// XXX: we can optimize by saving those results for returning here
|
||||
// return XXX
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ func (obj *FileRes) fileCheckApply(apply bool, src io.ReadSeeker, dst string, sh
|
||||
// hash comparison (efficient because we can cache hash of content str)
|
||||
if sha256sum == "" { // cache is invalid
|
||||
hash := sha256.New()
|
||||
// TODO file existence test?
|
||||
// TODO: file existence test?
|
||||
if _, err := io.Copy(hash, src); err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ func (obj *MsgRes) isAllStateOK() bool {
|
||||
}
|
||||
|
||||
// JournalPriority converts a string description to a numeric priority.
|
||||
// XXX Have Validate() make sure it actually is one of these.
|
||||
// XXX: Have Validate() make sure it actually is one of these.
|
||||
func (obj *MsgRes) journalPriority() journal.Priority {
|
||||
switch obj.Priority {
|
||||
case "Emerg":
|
||||
|
||||
@@ -70,8 +70,8 @@ type AutoEdge interface {
|
||||
|
||||
// MetaParams is a struct will all params that apply to every resource.
|
||||
type MetaParams struct {
|
||||
AutoEdge bool `yaml:"autoedge"` // metaparam, should we generate auto edges? // XXX should default to true
|
||||
AutoGroup bool `yaml:"autogroup"` // metaparam, should we auto group? // XXX should default to true
|
||||
AutoEdge bool `yaml:"autoedge"` // metaparam, should we generate auto edges? // XXX: should default to true
|
||||
AutoGroup bool `yaml:"autogroup"` // metaparam, should we auto group? // XXX: should default to true
|
||||
Noop bool `yaml:"noop"`
|
||||
// NOTE: there are separate Watch and CheckApply retry and delay values,
|
||||
// but I've decided to use the same ones for both until there's a proper
|
||||
@@ -253,7 +253,7 @@ func (obj *BaseRes) DoSend(processChan chan event.Event, comment string) (bool,
|
||||
// }
|
||||
//case event := <-obj.events:
|
||||
// // NOTE: this code should match the similar code below!
|
||||
// //cuuid.SetConverged(false) // TODO ?
|
||||
// //cuuid.SetConverged(false) // TODO: ?
|
||||
// if exit, send := obj.ReadEvent(&event); exit {
|
||||
// return true, nil // exit, without error
|
||||
// } else if send {
|
||||
|
||||
@@ -145,7 +145,7 @@ func (obj *SvcRes) Watch(processChan chan event.Event) error {
|
||||
var notFound = (loadstate.Value == dbus.MakeVariant("not-found"))
|
||||
if notFound { // XXX: in the loop we'll handle changes better...
|
||||
log.Printf("Failed to find svc: %v", svc)
|
||||
invalid = true // XXX ?
|
||||
invalid = true // XXX: ?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ func (obj *SvcRes) Watch(processChan chan event.Event) error {
|
||||
|
||||
obj.SetState(ResStateWatching) // reset
|
||||
select {
|
||||
case <-buschan: // XXX wait for new units event to unstick
|
||||
case <-buschan: // XXX: wait for new units event to unstick
|
||||
cuuid.SetConverged(false)
|
||||
// loop so that we can see the changed invalid signal
|
||||
log.Printf("Svc[%v]->DaemonReload()", svc)
|
||||
@@ -299,7 +299,7 @@ func (obj *SvcRes) CheckApply(apply bool) (checkok bool, err error) {
|
||||
|
||||
var running = (activestate.Value == dbus.MakeVariant("active"))
|
||||
var stateOK = ((obj.State == "") || (obj.State == "running" && running) || (obj.State == "stopped" && !running))
|
||||
var startupOK = true // XXX DETECT AND SET
|
||||
var startupOK = true // XXX: DETECT AND SET
|
||||
|
||||
if stateOK && startupOK {
|
||||
return true, nil // we are in the correct state
|
||||
|
||||
@@ -8,4 +8,5 @@ for file in `find . -maxdepth 3 -type f -name '*.go' -not -path './old/*' -not -
|
||||
go vet "$file" && echo PASS || exit 1 # since it doesn't output an ok message on pass
|
||||
grep 'log.' "$file" | grep '\\n"' && echo 'no \n needed in log.Printf()' && exit 1 || echo PASS # no \n needed in log.Printf()
|
||||
grep 'case _ = <-' "$file" && echo 'case _ = <- can be simplified to: case <-' && exit 1 || echo PASS # this can be simplified
|
||||
grep -Ei "[\/]+[\/]+[ ]*+(FIXME[^:]|TODO[^:]|XXX[^:])" "$file" && echo 'Token is missing a colon' && exit 1 || echo PASS # tokens must end with a colon
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user