Skip to content

Commit

Permalink
fix: status builder lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki committed Apr 11, 2022
1 parent d46ab5f commit 919f3a5
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions pkg/cmd/status/statusBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,26 @@ func (c *statusClient) BuildStatus(services []string) (status *serviceStatus, er
status = &serviceStatus{}

if stringInSlice(servicespec.KafkaServiceName, services) {
kafkaResponse, err := contextutil.GetKafkaForServiceConfig(c.serviceConfig, factory)
if err != nil {
return status, err
}
kafkaStatus, err := c.getKafkaStatus(kafkaResponse)
if err != nil {
return status, err
kafkaResponse, err1 := contextutil.GetKafkaForServiceConfig(c.serviceConfig, factory)
if err1 != nil {
return status, err1
}
kafkaStatus := c.getKafkaStatus(kafkaResponse)
status.Kafka = kafkaStatus
}

if stringInSlice(servicespec.ServiceRegistryServiceName, services) {
registryResponse, err := contextutil.GetRegistryForServiceConfig(c.serviceConfig, factory)
if err != nil {
return status, err
}
registry, newErr := c.getRegistryStatus(registryResponse)
if newErr != nil {
return status, newErr
registryResponse, err1 := contextutil.GetRegistryForServiceConfig(c.serviceConfig, factory)
if err1 != nil {
return status, err1
}
registry := c.getRegistryStatus(registryResponse)
status.Registry = registry
}
return status, err
}

func (c *statusClient) getKafkaStatus(kafkaResponse *kafkamgmtclient.KafkaRequest) (status *kafkaStatus, err error) {
func (c *statusClient) getKafkaStatus(kafkaResponse *kafkamgmtclient.KafkaRequest) (status *kafkaStatus) {
status = &kafkaStatus{
ID: kafkaResponse.GetId(),
Name: kafkaResponse.GetName(),
Expand All @@ -111,18 +105,18 @@ func (c *statusClient) getKafkaStatus(kafkaResponse *kafkamgmtclient.KafkaReques
status.FailedReason = kafkaResponse.GetFailedReason()
}

return status, err
return status
}

func (c *statusClient) getRegistryStatus(registry *registrymgmtclient.Registry) (status *registryStatus, err error) {
func (c *statusClient) getRegistryStatus(registry *registrymgmtclient.Registry) (status *registryStatus) {
status = &registryStatus{
ID: registry.GetId(),
Name: registry.GetName(),
RegistryUrl: registry.GetRegistryUrl(),
Status: string(registry.GetStatus()),
}

return status, err
return status
}

// Print prints the status information of all set services
Expand Down

0 comments on commit 919f3a5

Please sign in to comment.