Skip to content

Commit

Permalink
Issue 6254 - Enabling replication for a sub suffix crashes browser (#…
Browse files Browse the repository at this point in the history
…6255)

Bug Description: Web Console: Enabling replication for a sub-suffix causes
TypeError: this.props.data.nsds5replicabinddn is not iterable.

Fix Description: Make sure that loadSuffixTree is run for subsuffixes, too.
Set defaults if data is absent.

Fixes: #6254

Reviewed by: @progier389 (Thanks!)
  • Loading branch information
droideck authored Jul 10, 2024
1 parent eb7e57d commit a3d3521
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/cockpit/389-console/src/lib/replication/replConfig.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class ReplConfig extends React.Component {
saveBtnDisabled: true,
isExpanded: false,
// Config Settings
nsds5replicabinddn: this.props.data.nsds5replicabinddn,
nsds5replicabinddngroup: this.props.data.nsds5replicabinddngroup,
nsds5replicabinddn: this.props.data?.nsds5replicabinddn || [],
nsds5replicabinddngroup: this.props.data?.nsds5replicabinddngroup || "",
nsds5replicabinddngroupcheckinterval: Number(this.props.data.nsds5replicabinddngroupcheckinterval) === 0 ? -1 : Number(this.props.data.nsds5replicabinddngroupcheckinterval),
nsds5replicareleasetimeout: Number(this.props.data.nsds5replicareleasetimeout),
nsds5replicapurgedelay: Number(this.props.data.nsds5replicapurgedelay) === 0 ? 604800 : Number(this.props.data.nsds5replicapurgedelay),
Expand All @@ -52,8 +52,8 @@ export class ReplConfig extends React.Component {
nsds5replicabackoffmax: Number(this.props.data.nsds5replicabackoffmax) === 0 ? 300 : Number(this.props.data.nsds5replicabackoffmax),
nsds5replicakeepaliveupdateinterval: Number(this.props.data.nsds5replicakeepaliveupdateinterval) === 0 ? 3600 : Number(this.props.data.nsds5replicakeepaliveupdateinterval),
// Original settings
_nsds5replicabinddn: this.props.data.nsds5replicabinddn,
_nsds5replicabinddngroup: this.props.data.nsds5replicabinddngroup,
_nsds5replicabinddn: this.props.data?.nsds5replicabinddn || [],
_nsds5replicabinddngroup: this.props.data?.nsds5replicabinddngroup || "",
_nsds5replicabinddngroupcheckinterval: Number(this.props.data.nsds5replicabinddngroupcheckinterval) === 0 ? -1 : Number(this.props.data.nsds5replicabinddngroupcheckinterval),
_nsds5replicareleasetimeout: this.props.data.nsds5replicareleasetimeout,
_nsds5replicapurgedelay: Number(this.props.data.nsds5replicapurgedelay) === 0 ? 604800 : Number(this.props.data.nsds5replicapurgedelay),
Expand Down
9 changes: 6 additions & 3 deletions src/cockpit/389-console/src/replication.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,11 @@ export class Replication extends React.Component {
}
if (treeBranch[sub].children.length === 0) {
delete treeBranch[sub].children;
} else {
this.processBranch(treeBranch[sub].children);
}
this.processBranch(treeBranch[sub].children);
// Load replication data for this suffix
this.loadReplSuffix(treeBranch[sub].id);
}
}

Expand Down Expand Up @@ -528,7 +531,7 @@ export class Replication extends React.Component {
nsds5flags: config.attrs.nsds5flags[0],
nsds5replicatype: config.attrs.nsds5replicatype[0],
nsds5replicaid: 'nsds5replicaid' in config.attrs ? config.attrs.nsds5replicaid[0] : "",
nsds5replicabinddn: 'nsds5replicabinddn' in config.attrs ? config.attrs.nsds5replicabinddn : "",
nsds5replicabinddn: 'nsds5replicabinddn' in config.attrs ? config.attrs.nsds5replicabinddn : [],
nsds5replicabinddngroup: 'nsds5replicabinddngroup' in config.attrs ? config.attrs.nsds5replicabinddngroup[0] : "",
nsds5replicabinddngroupcheckinterval: 'nsds5replicabinddngroupcheckinterval' in config.attrs ? config.attrs.nsds5replicabinddngroupcheckinterval[0] : "",
nsds5replicareleasetimeout: 'nsds5replicareleasetimeout' in config.attrs ? config.attrs.nsds5replicareleasetimeout[0] : "",
Expand Down Expand Up @@ -671,7 +674,7 @@ export class Replication extends React.Component {
nsds5flags: config.attrs.nsds5flags[0],
nsds5replicatype: config.attrs.nsds5replicatype[0],
nsds5replicaid: 'nsds5replicaid' in config.attrs ? config.attrs.nsds5replicaid[0] : "",
nsds5replicabinddn: 'nsds5replicabinddn' in config.attrs ? config.attrs.nsds5replicabinddn : "",
nsds5replicabinddn: 'nsds5replicabinddn' in config.attrs ? config.attrs.nsds5replicabinddn : [],
nsds5replicabinddngroup: 'nsds5replicabinddngroup' in config.attrs ? config.attrs.nsds5replicabinddngroup[0] : "",
nsds5replicabinddngroupcheckinterval: 'nsds5replicabinddngroupcheckinterval' in config.attrs ? config.attrs.nsds5replicabinddngroupcheckinterval[0] : "",
nsds5replicareleasetimeout: 'nsds5replicareleasetimeout' in config.attrs ? config.attrs.nsds5replicareleasetimeout[0] : "",
Expand Down

0 comments on commit a3d3521

Please sign in to comment.