Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
networkmanager: Call out unparseable team configuration
Closes #4571
Reviewed-by: Stef Walter <stefw@redhat.com>
  • Loading branch information
mvollmer authored and stefwalter committed Aug 11, 2016
1 parent bf57b9c commit e6bed74
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions pkg/networkmanager/interfaces.js
Expand Up @@ -624,7 +624,7 @@ function NetworkManagerModel() {
return JSON.parse(str);
}
catch (e) {
return { };
return null;
}
}

Expand Down Expand Up @@ -2284,10 +2284,14 @@ PageNetworkInterface.prototype = {

var config = settings.team.config;

if (config.runner)
parts.push(choice_title(team_runner_choices, config.runner.name, config.runner.name));
if (config.link_watch && config.link_watch.name != "ethtool")
parts.push(choice_title(team_watch_choices, config.link_watch.name, config.link_watch.name));
if (config === null)
parts.push(_("Broken configuration"));
else {
if (config.runner)
parts.push(choice_title(team_runner_choices, config.runner.name, config.runner.name));
if (config.link_watch && config.link_watch.name != "ethtool")
parts.push(choice_title(team_watch_choices, config.link_watch.name, config.link_watch.name));
}

if (parts.length > 0)
rows.push(parts.join (", "));
Expand All @@ -2312,6 +2316,13 @@ PageNetworkInterface.prototype = {
master_settings.team.config.runner.name == "lacp"))
return null;

var config = settings.team_port.config;

if (config === null)
parts.push(_("Broken configuration"));

if (parts.length > 0)
rows.push(parts.join (", "));
return render_settings_row(_("Team Port"), rows, configure_team_port_settings);
}

Expand Down Expand Up @@ -3199,6 +3210,8 @@ PageNetworkTeamSettings.prototype = {
var runner_btn, balancer_btn, watch_btn;
var interval_input, target_input, updelay_input, downdelay_input;

if (!config)
settings.team.config = config = { };
if (!config.runner)
config.runner = { };
if (!config.runner.name)
Expand Down Expand Up @@ -3351,6 +3364,9 @@ PageNetworkTeamPortSettings.prototype = {

var ab_prio_input, ab_sticky_input, lacp_prio_input, lacp_key_input;

if (!config)
settings.team_port.config = config = { };

function change() {
// XXX - handle parse errors
if (master_config.runner.name == "activebackup") {
Expand Down

0 comments on commit e6bed74

Please sign in to comment.