Skip to content

Commit

Permalink
Merge pull request #1631 from jrha/nmstate_schema
Browse files Browse the repository at this point in the history
ncm-network: Throw error if commands used with nmstate
  • Loading branch information
jrha authored Sep 15, 2023
2 parents 705b3bd + d57c7f7 commit d6ece90
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ncm-network/src/main/pan/components/network/core-schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ type structure_route = {
"command" ? string with !match(SELF, '[;]')
} with {
if (exists(SELF['command'])) {
if (length(SELF) != 1)
error("Cannot use command and any of the other attributes as route");
module = value('/software/components/network/ncm-module', '');
if (module == 'nmstate') error("Command routes are not supported by the nmstate backend");
if (length(SELF) != 1) error("Cannot use command and any of the other attributes as route");
} else {
if (!exists(SELF['address']))
error("Address is mandatory for route (in absence of command)");
Expand Down Expand Up @@ -80,8 +81,9 @@ type structure_rule = {
"command" ? string with !match(SELF, '[;]')
} with {
if (exists(SELF['command'])) {
if (length(SELF) != 1)
error("Cannot use command and any of the other attributes as rule");
module = value('/software/components/network/ncm-module', '');
if (module == 'nmstate') error("Command routes are not supported by the nmstate backend");
if (length(SELF) != 1) error("Cannot use command and any of the other attributes as rule");
} else {
if (!exists(SELF['to']) && !exists(SELF['from'])) {
error("Rule requires selector to or from (or use command)");
Expand Down

0 comments on commit d6ece90

Please sign in to comment.