Skip to content

Add the format option to the docker stack ls command#31557

Merged
thaJeztah merged 1 commit intomoby:masterfrom
boaz0:add_stack_ls
Apr 27, 2017
Merged

Add the format option to the docker stack ls command#31557
thaJeztah merged 1 commit intomoby:masterfrom
boaz0:add_stack_ls

Conversation

@boaz0
Copy link
Contributor

@boaz0 boaz0 commented Mar 5, 2017

- What I did
Add the format option to the docker-stack-ls command
related to #30431

- How I did it

  • Add the format option to the cli/command/stack/ls.go
  • Create cli/command/formatter/stack.go
  • Move stack.stack to api.types.Stack
  • Add unit tests

- How to verify it
TESTDIRS='cli/command/formatter/' TESTFLAGS='-test.run ^TestStack*' hack/make.sh test-unit

@AkihiroSuda AkihiroSuda added status/1-design-review status/failing-ci Indicates that the PR in its current state fails the test suite and removed status/0-triage labels Mar 6, 2017
Copy link
Member

Choose a reason for hiding this comment

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

MarshalJSON is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@vdemeester
Copy link
Member

Move stack.stack to api.types.Stack

This ain't right, at that point stack are only a client thing (a cli thing even) and thus, shouldn't be in the api package as it is not (yet) part of the API.

Otherwise, design LGTM for me 👍

@boaz0
Copy link
Contributor Author

boaz0 commented Mar 6, 2017

@vdemeester thanks for the feedback.
I guess I will move it from api/types to cli/command/formatter.
Does that make sense?

@vdemeester
Copy link
Member

hum, tricky, maybe ? /cc @dnephin

@boaz0
Copy link
Contributor Author

boaz0 commented Mar 6, 2017

Added documentation

@dnephin
Copy link
Member

dnephin commented Mar 6, 2017

Design LGTM

@yongtang yongtang removed the status/failing-ci Indicates that the PR in its current state fails the test suite label Mar 6, 2017
Copy link
Contributor

Choose a reason for hiding this comment

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

Are both the additional lines intentionally added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. I will remove those two. Thanks for noticing!
👍

Copy link
Member

Choose a reason for hiding this comment

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

stacks output -> stacks

Copy link
Member

Choose a reason for hiding this comment

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

not docker network 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😱 what the hell is wrong with me.
Thank you for noticing.

Copy link
Member

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

LGTM 🐮
/cc @thaJeztah for docs-review

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

left some minor notes, but LGTM once addressed

Copy link
Member

Choose a reason for hiding this comment

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

s/networks/stacks/

Copy link
Member

Choose a reason for hiding this comment

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

s/options/option/

Copy link
Member

Choose a reason for hiding this comment

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

Can you change "will either output" to "either outputs" ?

@boaz0
Copy link
Contributor Author

boaz0 commented Mar 28, 2017

That's odd. There is a compilation error:

11:47:00 ---> Making bundle: dynbinary (in bundles/17.05.0-dev/dynbinary)
11:47:00 Building: bundles/17.05.0-dev/dynbinary-client/docker-17.05.0-dev
11:47:11 # github.com/docker/docker/cli/command/stack
11:47:11 cli/command/stack/list.go:4: imported and not used: "fmt"

It says that in cli/command/stack/list.go the fmt package is imported but isn't used but that's not true because on line 77 fmt.Errorf is called.

return nil, fmt.Errorf("cannot get label %s for service %s", convert.LabelNamespace, service.ID)

@vdemeester
Copy link
Member

@ripcurld0 I think you should rebase your code against master 👼 Guess something has been merged that uses pkg/errors instead of fmt for errors, I guess this is what make the build fail.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this change?
Also, it would be better to replace whitespace sequence to a single whitespace before comparison

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to change it because the tabwriter in formatter/formatter.go is different from the one that was used in stack/list.go.

Yep, that sounds like a good idea! I will do that 👍

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@thaJeztah thaJeztah merged commit 6559aba into moby:master Apr 27, 2017
@thaJeztah thaJeztah added this to the 17.06 milestone Apr 27, 2017
@thaJeztah
Copy link
Member

/cc @albers @sdurrheimer

@boaz0 boaz0 deleted the add_stack_ls branch October 6, 2017 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants