Skip to content

Commit

Permalink
Bug 2056962: For non-SCC intra-cluster migrations, don't allow target…
Browse files Browse the repository at this point in the history
… namespace to equal source namespace (migtools#1439)

Co-authored-by: Ian Bolton <ibolton@redhat.com>
  • Loading branch information
mturley and ibolton336 committed Jun 16, 2022
1 parent 9e00597 commit a0e80a3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,19 @@ const WizardFormik: React.FunctionComponent<IWizardFormikProps> = ({
(editedNSName === ns.oldName && editedNSNameID !== ns.id)
);
});
const hasUnchangedIntraClusterNs =
values?.sourceCluster === values?.targetCluster &&
values.migrationType.value !== 'scc' &&
values?.currentTargetNamespaceName?.name === values?.currentTargetNamespaceName?.srcName;

const targetNamespaceNameError = utils.testTargetName(
values?.currentTargetNamespaceName?.name
);
if (targetNamespaceNameError !== '') {
errors.currentTargetNamespaceName = targetNamespaceNameError;
} else if (hasUnchangedIntraClusterNs) {
errors.currentTargetNamespaceName =
'Target namespace name cannot be the same as source namespace name. Enter a unique name for this target namespace.';
} else if (hasDuplicateMapping) {
errors.currentTargetNamespaceName =
'A mapped target namespace with that name already exists. Enter a unique name for this target namespace.';
Expand Down

0 comments on commit a0e80a3

Please sign in to comment.