@@ -40,25 +40,34 @@ type ServerServiceImpl struct {
4040 serverDataStore * serverDataStore.ServerDataStore
4141 serverEnvConfig * serverEnvConfig.ServerEnvConfig
4242 helmAppService client.HelmAppService
43- // no need to inject serverCacheService, but not generating in wire_gen (not triggering cache work in constructor) if not injecting. hence injecting
44- serverCacheService ServerCacheService
4543}
4644
4745func NewServerServiceImpl (logger * zap.SugaredLogger , serverActionAuditLogRepository ServerActionAuditLogRepository ,
48- serverDataStore * serverDataStore.ServerDataStore , serverEnvConfig * serverEnvConfig.ServerEnvConfig , helmAppService client.HelmAppService , serverCacheService ServerCacheService ) * ServerServiceImpl {
46+ serverDataStore * serverDataStore.ServerDataStore , serverEnvConfig * serverEnvConfig.ServerEnvConfig , helmAppService client.HelmAppService ) * ServerServiceImpl {
4947 return & ServerServiceImpl {
5048 logger : logger ,
5149 serverActionAuditLogRepository : serverActionAuditLogRepository ,
5250 serverDataStore : serverDataStore ,
5351 serverEnvConfig : serverEnvConfig ,
5452 helmAppService : helmAppService ,
55- serverCacheService : serverCacheService ,
5653 }
5754}
5855
5956func (impl ServerServiceImpl ) GetServerInfo () (* serverBean.ServerInfoDto , error ) {
6057 impl .logger .Debug ("getting server info" )
6158
59+ serverInfoDto := & serverBean.ServerInfoDto {
60+ CurrentVersion : impl .serverDataStore .CurrentVersion ,
61+ ReleaseName : impl .serverEnvConfig .DevtronHelmReleaseName ,
62+ Status : serverBean .ServerStatusUnknown ,
63+ InstallationType : impl .serverEnvConfig .DevtronInstallationType ,
64+ }
65+
66+ // if installation type is not OSS helm, then return (do not calculate server status)
67+ if serverInfoDto .InstallationType != serverBean .DevtronInstallationTypeOssHelm {
68+ return serverInfoDto , nil
69+ }
70+
6271 // fetch status of devtron helm app
6372 devtronHelmAppIdentifier := impl .helmAppService .GetDevtronHelmAppIdentifier ()
6473 devtronAppDetail , err := impl .helmAppService .GetApplicationDetail (context .Background (), devtronHelmAppIdentifier )
@@ -90,21 +99,15 @@ func (impl ServerServiceImpl) GetServerInfo() (*serverBean.ServerInfoDto, error)
9099 }
91100 }
92101
93- serverInfoDto := & serverBean.ServerInfoDto {
94- CurrentVersion : impl .serverDataStore .CurrentVersion ,
95- ReleaseName : impl .serverEnvConfig .DevtronHelmReleaseName ,
96- Status : serverStatus ,
97- CanUpdateServer : impl .serverEnvConfig .CanServerUpdate ,
98- }
99-
102+ serverInfoDto .Status = serverStatus
100103 return serverInfoDto , nil
101104}
102105
103106func (impl ServerServiceImpl ) HandleServerAction (userId int32 , serverActionRequest * serverBean.ServerActionRequestDto ) (* serverBean.ActionResponse , error ) {
104107 impl .logger .Debugw ("handling server action request" , "userId" , userId , "payload" , serverActionRequest )
105108
106109 // check if can update server
107- if ! impl .serverEnvConfig .CanServerUpdate {
110+ if impl .serverEnvConfig .DevtronInstallationType != serverBean . DevtronInstallationTypeOssHelm {
108111 return nil , errors .New ("server up-gradation is not allowed" )
109112 }
110113
0 commit comments