Skip to content

Commit

Permalink
Add hidden trust command to alias existing trust commands
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Nov 11, 2022
1 parent c75b059 commit 92236c0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions cmd/podman/images/trust.go
Expand Up @@ -16,9 +16,21 @@ var (
Long: trustDescription,
RunE: validate.SubCommandExists,
}

trustxCmd = &cobra.Command{
Annotations: trustCmd.Annotations,
Use: trustCmd.Use,
Short: trustCmd.Short,
Long: trustCmd.Long,
RunE: trustCmd.RunE,
Hidden: true,
}
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: trustxCmd,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: trustCmd,
Parent: imageCmd,
Expand Down
4 changes: 4 additions & 0 deletions cmd/podman/images/trust_set.go
Expand Up @@ -32,6 +32,10 @@ var (
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: setTrustCommand,
Parent: trustxCmd,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: setTrustCommand,
Parent: trustCmd,
Expand Down
4 changes: 4 additions & 0 deletions cmd/podman/images/trust_show.go
Expand Up @@ -31,6 +31,10 @@ var (
)

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: showTrustCommand,
Parent: trustxCmd,
})
registry.Commands = append(registry.Commands, registry.CliCommand{
Command: showTrustCommand,
Parent: trustCmd,
Expand Down
4 changes: 2 additions & 2 deletions test/system/750-trust.bats
Expand Up @@ -15,8 +15,8 @@ load helpers
run_podman image trust show --policypath=$policypath
is "$output" ".*all *default *accept" "default policy should be accept"

run_podman image trust set --policypath=$policypath --type=reject default
run_podman image trust show --policypath=$policypath
run_podman trust set --policypath=$policypath --type=reject default
run_podman trust show --policypath=$policypath
is "$output" ".*all *default *reject" "default policy should be reject"

run_podman image trust set --policypath=$policypath --type=reject docker.io
Expand Down

0 comments on commit 92236c0

Please sign in to comment.