From e15f9f9d90d338113a6a26ac4937cea839992857 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Fri, 16 Jun 2017 09:10:08 +0200 Subject: [PATCH] agent: rename agent var --- agent/acl.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/agent/acl.go b/agent/acl.go index 01007a37c8..871488b62f 100644 --- a/agent/acl.go +++ b/agent/acl.go @@ -143,13 +143,13 @@ func (m *aclManager) isDisabled() bool { // lookupACL attempts to locate the compiled policy associated with the given // token. The agent may be used to perform RPC calls to the servers to fetch // policies that aren't in the cache. -func (m *aclManager) lookupACL(agent *Agent, id string) (acl.ACL, error) { +func (m *aclManager) lookupACL(a *Agent, id string) (acl.ACL, error) { // Handle some special cases for the ID. if len(id) == 0 { id = anonymousToken } else if acl.RootACL(id) != nil { return nil, errors.New(rootDenied) - } else if m.master != nil && id == agent.config.ACLAgentMasterToken { + } else if m.master != nil && id == a.config.ACLAgentMasterToken { return m.master, nil } @@ -167,25 +167,25 @@ func (m *aclManager) lookupACL(agent *Agent, id string) (acl.ACL, error) { // At this point we might have a stale cached ACL, or none at all, so // try to contact the servers. args := structs.ACLPolicyRequest{ - Datacenter: agent.config.ACLDatacenter, + Datacenter: a.config.ACLDatacenter, ACL: id, } if cached != nil { args.ETag = cached.ETag } var reply structs.ACLPolicy - err := agent.RPC(agent.getEndpoint("ACL")+".GetPolicy", &args, &reply) + err := a.RPC(a.getEndpoint("ACL")+".GetPolicy", &args, &reply) if err != nil { if strings.Contains(err.Error(), aclDisabled) { - agent.logger.Printf("[DEBUG] agent: ACLs disabled on servers, will check again after %s", agent.config.ACLDisabledTTL) + a.logger.Printf("[DEBUG] agent: ACLs disabled on servers, will check again after %s", a.config.ACLDisabledTTL) m.disabledLock.Lock() - m.disabled = time.Now().Add(agent.config.ACLDisabledTTL) + m.disabled = time.Now().Add(a.config.ACLDisabledTTL) m.disabledLock.Unlock() return nil, nil } else if strings.Contains(err.Error(), aclNotFound) { return nil, errors.New(aclNotFound) } else { - agent.logger.Printf("[DEBUG] agent: Failed to get policy for ACL from servers: %v", err) + a.logger.Printf("[DEBUG] agent: Failed to get policy for ACL from servers: %v", err) if m.down != nil { return m.down, nil } else if cached != nil { @@ -204,7 +204,7 @@ func (m *aclManager) lookupACL(agent *Agent, id string) (acl.ACL, error) { } else { parent := acl.RootACL(reply.Parent) if parent == nil { - parent, err = m.lookupACL(agent, reply.Parent) + parent, err = m.lookupACL(a, reply.Parent) if err != nil { return nil, err }