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

Add hidden trust command to alias existing trust commands #16463

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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