AdaptEntrypoint rewrites the entrypoint command if the capability is present.
(ctx *gcp.Context, cmd []string, scriptCmd []string)
| 604 | |
| 605 | // EntrypointAdapterCapability is the capability key for the EntrypointAdapter. |
| 606 | const EntrypointAdapterCapability = "python.EntrypointAdapter" |
| 607 | |
| 608 | // entrypointAdapter is an interface for rewriting the entrypoint command. |
| 609 | type entrypointAdapter interface { |
| 610 | adapt(cmd []string, scriptCmd []string) ([]string, error) |
| 611 | } |
| 612 | |
| 613 | // AdaptEntrypoint rewrites the entrypoint command if the capability is present. |
| 614 | func AdaptEntrypoint(ctx *gcp.Context, cmd []string, scriptCmd []string) ([]string, error) { |
| 615 | if cap := ctx.Capability(EntrypointAdapterCapability); cap != nil { |
| 616 | a, ok := cap.(entrypointAdapter) |
| 617 | if !ok { |
| 618 | return nil, gcp.InternalErrorf("capability %q does not implement entrypointAdapter interface", EntrypointAdapterCapability) |