diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/config_mgmt.py | 2 | ||||
| -rw-r--r-- | python/vyos/nat.py | 6 | ||||
| -rw-r--r-- | python/vyos/qos/base.py | 11 | ||||
| -rw-r--r-- | python/vyos/utils/io.py | 2 | 
4 files changed, 15 insertions, 6 deletions
| diff --git a/python/vyos/config_mgmt.py b/python/vyos/config_mgmt.py index fc51d781c..70b6ea203 100644 --- a/python/vyos/config_mgmt.py +++ b/python/vyos/config_mgmt.py @@ -283,6 +283,8 @@ Proceed ?'''          rollback_ct = self._get_config_tree_revision(rev)          try:              load(rollback_ct, switch='explicit') +            print('Rollback diff has been applied.') +            print('Use "compare" to review the changes or "commit" to apply them.')          except LoadConfigError as e:              raise ConfigMgmtError(e) from e diff --git a/python/vyos/nat.py b/python/vyos/nat.py index 2ada29add..e54548788 100644 --- a/python/vyos/nat.py +++ b/python/vyos/nat.py @@ -300,12 +300,12 @@ def parse_nat_static_rule(rule_conf, rule_id, nat_type):      output.append('counter') -    if translation_str: -        output.append(translation_str) -      if 'log' in rule_conf:          output.append(f'log prefix "[{log_prefix}{log_suffix}]"') +    if translation_str: +        output.append(translation_str) +      output.append(f'comment "{log_prefix}"')      return " ".join(output) diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py index 87927ba9d..98e486e42 100644 --- a/python/vyos/qos/base.py +++ b/python/vyos/qos/base.py @@ -247,9 +247,15 @@ class QoSBase:                  filter_cmd_base += ' protocol all'                  if 'match' in cls_config: -                    is_filtered = False +                    has_filter = False                      for index, (match, match_config) in enumerate(cls_config['match'].items(), start=1):                          filter_cmd = filter_cmd_base +                        if not has_filter: +                            for key in ['mark', 'vif', 'ip', 'ipv6']: +                                if key in match_config: +                                    has_filter = True +                                    break +                          if self.qostype == 'shaper' and 'prio ' not in filter_cmd:                              filter_cmd += f' prio {index}'                          if 'mark' in match_config: @@ -332,13 +338,12 @@ class QoSBase:                                  cls = int(cls)                                  filter_cmd += f' flowid {self._parent:x}:{cls:x}'                                  self._cmd(filter_cmd) -                                is_filtered = True                      vlan_expression = "match.*.vif"                      match_vlan = jmespath.search(vlan_expression, cls_config)                      if any(tmp in ['exceed', 'bandwidth', 'burst'] for tmp in cls_config) \ -                        and is_filtered: +                        and has_filter:                          # For "vif" "basic match" is used instead of "action police" T5961                          if not match_vlan:                              filter_cmd += f' action police' diff --git a/python/vyos/utils/io.py b/python/vyos/utils/io.py index a8c430f28..205210b66 100644 --- a/python/vyos/utils/io.py +++ b/python/vyos/utils/io.py @@ -72,6 +72,8 @@ def ask_yes_no(question, default=False) -> bool:                  stdout.write("Please respond with yes/y or no/n\n")          except EOFError:              stdout.write("\nPlease respond with yes/y or no/n\n") +        except KeyboardInterrupt: +            return False  def is_interactive():      """Try to determine if the routine was called from an interactive shell.""" | 
