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

[sabakan] improve sabactl machines get #239

Merged
merged 8 commits into from
Mar 2, 2022
Merged

Conversation

yamatcha
Copy link
Contributor

@yamatcha yamatcha commented Feb 10, 2022

Signed-off-by: yamatcha soju-yamashita@cybozu.co.jp

@yamatcha yamatcha self-assigned this Feb 10, 2022
@yamatcha yamatcha changed the title implement without,simpleoutput,some racks [WIP] [sabakan] improve sabactl machines get Feb 10, 2022
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
@yamatcha yamatcha changed the title [WIP] [sabakan] improve sabactl machines get [sabakan] improve sabactl machines get Feb 14, 2022
@yamatcha yamatcha marked this pull request as ready for review February 14, 2022 04:53
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
@zoetrope
Copy link
Member

Please add test cases.
https://github.com/cybozu-go/sabakan/blob/main/e2e/sabactl_test.go

Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
@@ -152,8 +153,10 @@ func (mi *machinesIndex) query(q sabakan.Query) []string {

res := make(map[string]struct{})

for _, serial := range mi.Rack[q.Rack()] {
res[serial] = struct{}{}
for _, rack := range strings.Split(q.Rack(), ",") {
Copy link
Member

Choose a reason for hiding this comment

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

Why can we only specify multiple racks?
We want to specify other options as well.

The original issue is just an example of a rack.

pkg/sabactl/cmd/machines.go Outdated Show resolved Hide resolved
@@ -258,8 +258,9 @@ RETRY:
func (d *driver) machineQuery(ctx context.Context, q sabakan.Query) ([]*sabakan.Machine, error) {
var serials []string

qRemovedWithout := q.RemoveWithout()
Copy link
Member

Choose a reason for hiding this comment

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

I could not read the intent of this code.
Does "without" mean the same as "empty"?

Copy link
Member

Choose a reason for hiding this comment

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

I understood.
But I think this code is not readable.
Please rewrite this code or add a comment.

pkg/sabactl/cmd/machines.go Show resolved Hide resolved
query.go Show resolved Hide resolved
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
@kmdkuk
Copy link
Contributor

kmdkuk commented Feb 18, 2022

I checked for now!
I thought it was good, except for the part that already pointed out about option names and the ability to specify multiple values.
👍

Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Signed-off-by: yamatcha <soju-yamashita@cybozu.co.jp>
Copy link
Member

@zoetrope zoetrope left a comment

Choose a reason for hiding this comment

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

LGTM

@yamatcha yamatcha merged commit 02a3784 into main Mar 2, 2022
@yamatcha yamatcha deleted the improve-sabactl-machines-get branch March 2, 2022 01:15
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.

None yet

4 participants