ca/config.go
Function ParseJoinToken
has 6 return statements (exceeds 4 allowed). Open
Open
func ParseJoinToken(token string) (*ParsedJoinToken, error) {
split := strings.Split(token, "-")
numParts := len(split)
// v1 has 4, v2 has 5
Function updateRootThenUpdateCert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func updateRootThenUpdateCert(ctx context.Context, s *SecurityConfig, connBroker *connectionbroker.Broker, rootPaths CertPaths, failedCert *x509.Certificate) (*tls.Certificate, *IssuerInfo, error) {
Method SecurityConfig.updateTLSCredentials
has 5 return statements (exceeds 4 allowed). Open
Open
func (s *SecurityConfig) updateTLSCredentials(certificate *tls.Certificate, issuerInfo *IssuerInfo) error {
certs := []tls.Certificate{*certificate}
clientConfig, err := NewClientTLSConfig(certs, s.rootCA.Pool, ManagerRole)
if err != nil {
return errors.Wrap(err, "failed to create a new client config using the new root CA")
Function DownloadRootCA
has 5 return statements (exceeds 4 allowed). Open
Open
func DownloadRootCA(ctx context.Context, paths CertPaths, token string, connBroker *connectionbroker.Broker) (RootCA, error) {
var rootCA RootCA
// Get a digest for the optional CA hash string that we've been provided
// If we were provided a non-empty string, and it is an invalid hash, return
// otherwise, allow the invalid digest through.
Function updateRootThenUpdateCert
has 5 return statements (exceeds 4 allowed). Open
Open
func updateRootThenUpdateCert(ctx context.Context, s *SecurityConfig, connBroker *connectionbroker.Broker, rootPaths CertPaths, failedCert *x509.Certificate) (*tls.Certificate, *IssuerInfo, error) {
if len(failedCert.Subject.OrganizationalUnit) == 0 || failedCert.Subject.OrganizationalUnit[0] != WorkerRole {
return nil, nil, errors.New("cannot update root CA since this is not a worker")
}
// try downloading a new root CA if it's an unknown authority issue, in case there was a root rotation completion