Improve dry-run error messages for clarity

This commit is contained in:
carlory
2025-09-15 09:56:13 +08:00
parent 97cd1c2408
commit 5dac4ee169
4 changed files with 4 additions and 4 deletions

View File

@@ -355,7 +355,7 @@ func newInitData(cmd *cobra.Command, args []string, initOptions *initOptions, ou
dryRunDir := ""
if initOptions.dryRun || cfg.DryRun {
if dryRunDir, err = kubeadmconstants.GetDryRunDir(kubeadmconstants.EnvVarInitDryRunDir, "kubeadm-init-dryrun", klog.Warningf); err != nil {
return nil, errors.Wrap(err, "could not create a temporary directory")
return nil, errors.Wrap(err, "could not create a temporary directory on dryrun")
}
}

View File

@@ -467,7 +467,7 @@ func newJoinData(cmd *cobra.Command, args []string, opt *joinOptions, out io.Wri
dryRunDir := ""
if opt.dryRun || cfg.DryRun {
if dryRunDir, err = kubeadmconstants.GetDryRunDir(kubeadmconstants.EnvVarJoinDryRunDir, "kubeadm-join-dryrun", klog.Warningf); err != nil {
return nil, errors.Wrap(err, "could not create a temporary directory")
return nil, errors.Wrap(err, "could not create a temporary directory on dryrun")
}
}

View File

@@ -200,7 +200,7 @@ func newApplyData(cmd *cobra.Command, args []string, applyFlags *applyFlags) (*a
dryRunDir := ""
if *dryRun {
if dryRunDir, err = constants.GetDryRunDir(constants.EnvVarUpgradeDryRunDir, "kubeadm-upgrade-apply-dryrun", klog.Warningf); err != nil {
return nil, errors.Wrap(err, "could not create a temporary directory")
return nil, errors.Wrap(err, "could not create a temporary directory on dryrun")
}
}

View File

@@ -196,7 +196,7 @@ func newNodeData(cmd *cobra.Command, nodeOptions *nodeOptions, out io.Writer) (*
dryRunDir := ""
if *dryRun {
if dryRunDir, err = constants.GetDryRunDir(constants.EnvVarUpgradeDryRunDir, "kubeadm-upgrade-node-dryrun", klog.Warningf); err != nil {
return nil, errors.Wrap(err, "couldn't create a temporary directory")
return nil, errors.Wrap(err, "couldn't create a temporary directory on dryrun")
}
}