@@ -18,7 +18,6 @@ package argo
18
18
19
19
import (
20
20
"context"
21
- "errors"
22
21
"fmt"
23
22
"github.com/argoproj/argo-cd/v2/pkg/apiclient/account"
24
23
"github.com/devtron-labs/authenticator/client"
@@ -30,7 +29,6 @@ import (
30
29
"github.com/devtron-labs/devtron/pkg/deployment/gitOps/config"
31
30
"github.com/devtron-labs/devtron/pkg/module"
32
31
util2 "github.com/devtron-labs/devtron/util"
33
- "github.com/go-pg/pg"
34
32
"go.uber.org/zap"
35
33
"golang.org/x/crypto/bcrypt"
36
34
apiv1 "k8s.io/api/core/v1"
@@ -211,19 +209,15 @@ func (impl *ArgoUserServiceImpl) createNewArgoCdTokenForDevtron(username, passwo
211
209
212
210
// note: this function also called for no gitops case, where apps are installed via helm
213
211
func (impl * ArgoUserServiceImpl ) GetLatestDevtronArgoCdUserToken () (string , error ) {
214
-
215
- moduleInfo , err := impl .moduleService .GetModuleInfo (module .ModuleNameArgoCd )
216
- if err != nil && ! errors .Is (err , pg .ErrNoRows ) {
212
+ gitOpsConfigurationStatus , err := impl .gitOpsConfigReadService .IsGitOpsConfigured ()
213
+ if err != nil {
217
214
impl .logger .Errorw ("error while checking if gitOps is configured" , "err" , err )
218
215
return "" , err
219
216
}
220
- if moduleInfo == nil {
221
- return "" , errors .New ("argocd module not installed" )
222
- }
223
- if moduleInfo .Status != connection .ModuleStatusInstalled {
217
+ if ! gitOpsConfigurationStatus .IsGitOpsConfigured {
218
+ //here acd token only required in context for argo cd calls
224
219
return "" , nil
225
220
}
226
-
227
221
k8sClient , err := impl .k8sUtil .GetClientForInCluster ()
228
222
if err != nil {
229
223
impl .logger .Errorw ("error in getting k8s client for default cluster" , "err" , err )
0 commit comments