Fix comment and misc code issues
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
(cherry picked from commit 8c3d0b93d6)
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
@@ -14,9 +14,8 @@ import (
|
||||
|
||||
type inspectOptions struct {
|
||||
remotes []string
|
||||
/* FIXME(n4ss): this is consistent with `docker service inspect` but we should provide
|
||||
* a `--format` flag too. (format and pretty-print should be exclusive)
|
||||
*/
|
||||
// FIXME(n4ss): this is consistent with `docker service inspect` but we should provide
|
||||
// a `--format` flag too. (format and pretty-print should be exclusive)
|
||||
prettyPrint bool
|
||||
}
|
||||
|
||||
@@ -41,7 +40,7 @@ func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||
|
||||
func runInspect(dockerCli command.Cli, opts inspectOptions) error {
|
||||
if opts.prettyPrint {
|
||||
var err error = nil
|
||||
var err error
|
||||
|
||||
for index, remote := range opts.remotes {
|
||||
if err = prettyPrintTrustInfo(dockerCli, remote); err != nil {
|
||||
@@ -49,7 +48,7 @@ func runInspect(dockerCli command.Cli, opts inspectOptions) error {
|
||||
}
|
||||
|
||||
// Additional separator between the inspection output of each image
|
||||
if index < len(opts.remotes) - 1 {
|
||||
if index < len(opts.remotes)-1 {
|
||||
fmt.Fprint(dockerCli.Out(), "\n\n")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/theupdateframework/notary/tuf/data"
|
||||
)
|
||||
|
||||
/* TODO(n4ss): remove common tests with the regular inspect command */
|
||||
// TODO(n4ss): remove common tests with the regular inspect command
|
||||
|
||||
type fakeClient struct {
|
||||
dockerClient.Client
|
||||
@@ -98,7 +98,7 @@ func TestTrustInspectPrettyCommandEmptyNotaryRepoErrors(t *testing.T) {
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
assert.NoError(t, cmd.Execute())
|
||||
assert.Contains(t, cli.OutBuffer().String(), "No signatures for reg/img:unsigned-tag")
|
||||
assert.Contains(t, cli.OutBuffer().String(), "Administrative keys for reg/img:")
|
||||
assert.Contains(t, cli.OutBuffer().String(), "Administrative keys for reg/img")
|
||||
|
||||
cli = test.NewFakeCli(&fakeClient{})
|
||||
cli.SetNotaryClient(getEmptyTargetsNotaryRepository)
|
||||
@@ -108,7 +108,7 @@ func TestTrustInspectPrettyCommandEmptyNotaryRepoErrors(t *testing.T) {
|
||||
cmd.SetOutput(ioutil.Discard)
|
||||
assert.NoError(t, cmd.Execute())
|
||||
assert.Contains(t, cli.OutBuffer().String(), "No signatures for reg/img")
|
||||
assert.Contains(t, cli.OutBuffer().String(), "Administrative keys for reg/img:")
|
||||
assert.Contains(t, cli.OutBuffer().String(), "Administrative keys for reg/img")
|
||||
}
|
||||
|
||||
func TestTrustInspectPrettyCommandFullRepoWithoutSigners(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user