Skip to content

Commit

Permalink
refactor: addressed more of Lenny's code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: preethi-satishcandra <[email protected]>
  • Loading branch information
presatish committed Sep 27, 2023
1 parent 46e3189 commit d28be27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 6 additions & 6 deletions as-controller-board-status/functions/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,24 +269,24 @@ func (boardStatus *CheckBoardStatus) SendCommand(lc logger.LoggingClient, action

switch actionName {
case http.MethodPut:
lc.Infof("executing %s action", actionName)
lc.Infof("Issuing SET command '%s' for device '%s'", commandName, deviceName)
lc.Debugf("executing %s action", actionName)
lc.Debugf("Issuing SET command '%s' for device '%s'", commandName, deviceName)

response, err := boardStatus.CommandClient.IssueSetCommandByName(context.Background(), deviceName, commandName, settings)
if err != nil {
return fmt.Errorf("failed to issue '%s' set command to '%s' device: %s", commandName, deviceName, err.Error())
}

lc.Infof("response status: %d", response.StatusCode)
lc.Debugf("response status: %d", response.StatusCode)

case http.MethodGet:
lc.Infof("executing %s action", actionName)
lc.Infof("Issuing GET command '%s' for device '%s'", commandName, deviceName)
lc.Debugf("executing %s action", actionName)
lc.Debugf("Issuing GET command '%s' for device '%s'", commandName, deviceName)
response, err := boardStatus.CommandClient.IssueGetCommandByName(context.Background(), deviceName, commandName, false, true)
if err != nil {
return fmt.Errorf("failed to issue '%s' get command to '%s' device: %s", commandName, deviceName, err.Error())
}
lc.Infof("response status: %d", response.StatusCode)
lc.Debugf("response status: %d", response.StatusCode)

default:
return errors.New("Invalid action requested: " + actionName)
Expand Down
5 changes: 5 additions & 0 deletions as-controller-board-status/res/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Clients:
Host: localhost
Port: 59860

core-command:
Protocol: "http"
Host: "localhost"
Port: 59882

MessageBus:
Optional:
ClientId: as-controller-board-status
Expand Down

0 comments on commit d28be27

Please sign in to comment.