Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Conversation

chungers
Copy link
Contributor

The command pkg used, Cobra.Command, only executes the first PersistentPreRunE function, searching from the bottom up the command tree (from leaf subcommands up to the root).

This creates a problem where for commands like infrakit manager inspect, only the PersistentPreRunE of the manager subcommand is executed, leaving the top level one (where the log level is set) not run at all. As a result, for deeply nested commands, --log doesn't have any effects.

This PR adds a convenient function upTree that is called by the leaf PersistetPreRunE to recurse up the tree and then executing some function in top-to-bottom order. This is probably better than patching/forking the library, and not calling the helper function just follows standard Cobra command behavior.

Signed-off-by: David Chung david.chung@docker.com

…g log level

Signed-off-by: David Chung <david.chung@docker.com>
@codecov-io
Copy link

Current coverage is 65.40% (diff: 100%)

Merging #372 into master will decrease coverage by 0.04%

@@             master       #372   diff @@
==========================================
  Files            47         47          
  Lines          2307       2307          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           1510       1509     -1   
- Misses          627        628     +1   
  Partials        170        170          

Powered by Codecov. Last update 93f6892...9c55e2b

@chungers chungers merged commit 9d6641d into docker-archive:master Jan 26, 2017
@chungers chungers modified the milestone: v0.3 Jan 31, 2017
chungers pushed a commit to chungers/infrakit that referenced this pull request Sep 30, 2017
Implement token distribution using Azure Tables (docker-archive#372)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants