UPSTREAM: 62196: Remove need for server connections for dry-run create
@@ -315,6 +315,7 @@ func RunCreateSubcommand(f cmdutil.Factory, cmd *cobra.Command, out io.Writer, o
return err
}
mapper, typer := f.Object()
+ if !options.DryRun {
gvks, _, err := typer.ObjectKinds(obj)
if err != nil {
return err
@@ -342,7 +343,6 @@ func RunCreateSubcommand(f cmdutil.Factory, cmd *cobra.Command, out io.Writer, o
}
obj = info.Object
- if !options.DryRun {
obj, err = resource.NewHelper(client, mapping).Create(namespace, false, info.Object)
if err != nil {
return err
@@ -354,7 +354,7 @@ func RunCreateSubcommand(f cmdutil.Factory, cmd *cobra.Command, out io.Writer, o
}
if useShortOutput := options.OutputFormat == "name"; useShortOutput || len(options.OutputFormat) == 0 {
- cmdutil.PrintSuccess(useShortOutput, out, info.Object, options.DryRun, "created")
+ cmdutil.PrintSuccess(useShortOutput, out, obj, options.DryRun, "created")
return nil
}
