-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
[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 |
f0ec62b
to
959323e
Compare
959323e
to
6d29e9b
Compare
6d29e9b
to
db78caa
Compare
There was a problem hiding this 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* |
There was a problem hiding this comment.
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 | ||
} | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use ExtractVolume() https://pkg.go.dev/github.com/gophercloud/gophercloud/openstack/blockstorage/v1/volumes#ExtractVolumes, Instead of typecasting
|
||
func (c Client) RestartAgents(agents []Agent) error { | ||
for _, agent := range agents { | ||
//time.Sleep(time.Minute * 2) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
No description provided.