MCPcopy
hub / github.com/kptdev/kpt / RunE

Method RunE

commands/applycmd.go:63–78  ·  view source on GitHub ↗

RunE runs the ResourceGroup CRD installation as a pre-step if an environment variable exists. Then the wrapped ApplyRunner is invoked. Returns an error if one happened. Swallows the "AlreadyExists" error for CRD installation.

(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

61// invoked. Returns an error if one happened. Swallows the
62// "AlreadyExists" error for CRD installation.
63func (w *ApplyRunnerWrapper) RunE(cmd *cobra.Command, args []string) error {
64 if _, exists := os.LookupEnv(resourceGroupEnv); exists {
65 klog.V(4).Infoln("wrapper applyRunner detected environment variable")
66 err := live.ApplyResourceGroupCRD(w.provider.Factory())
67 if err != nil && !apierrors.IsAlreadyExists(err) {
68 return err
69 }
70 }
71 klog.V(4).Infoln("wrapper applyRunner run...")
72 if w.Command().Flag(flagutils.InventoryPolicyFlag).Value.String() == flagutils.InventoryPolicyStrict {
73 w.applyRunner.PreProcess = func(inv inventory.InventoryInfo, strategy common.DryRunStrategy) (inventory.InventoryPolicy, error) {
74 return preprocess.PreProcess(w.provider, inv, strategy)
75 }
76 }
77 return w.applyRunner.RunE(cmd, args)
78}

Callers

nothing calls this directly

Calls 5

CommandMethod · 0.95
ApplyResourceGroupCRDFunction · 0.92
PreProcessFunction · 0.92
FactoryMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected