Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hypershift-agent-automation cli application #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dharaneeshvrd
Copy link
Contributor

No description provided.

@ppc64le-cloud-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dharaneeshvrd

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mkumatag
Copy link
Member

mkumatag commented Oct 5, 2023

/cc @Karthik-K-N @AbhishekMundada

Copy link

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very well structured and organized. Amazing.

bin/

env.sh
.hypershift*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing new line.


return c, nil
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function comments would help in better understanding about functionality.

lparIDCommand := fmt.Sprintf("lshwres -m %s -r virtualio --rsubtype scsi --filter \"lpar_names=%s\"", host, lparName)
out, _, err := util.ExecuteRemoteCommand(hmc.SSHClient, lparIDCommand)
if err != nil {
return "", fmt.Errorf("error executing command to retrieve lpar_id %v", err)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it would be helpful if we can log the actual command which failed to get executed.

}
for _, item := range strings.Split(out, ",") {
if strings.Contains(item, "lpar_id") {
return strings.Split(item, "=")[1], nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the format of id wont change but how about checking length of Split list before indexing.

}
}

return "", fmt.Errorf("not able to retrieve lpar_id command, output: %s", out)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "", fmt.Errorf("not able to retrieve lpar_id command, output: %s", out)
return "", fmt.Errorf("not able to retrieve lpar_id, output: %s", out)

return "", err
}

volumeList := volumeListPage.GetBody().(map[string][]interface{})["volumes"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


func (c Client) RestartAgents(agents []Agent) error {
for _, agent := range agents {
//time.Sleep(time.Minute * 2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

}

args = []string{"get", "hc", c.Name, "-n", c.Namespace}
_, e, err = util.ExecuteCommand("oc", args)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it guaranteed that oc will be available in PATH or its mentioned in prereq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants