Page MenuHomeVyOS Platform

ConfigError formatting issue
Open, Requires assessmentPublicBUG

Description

Currently ConfigError is called everywhere as such:

raise ConfigError((
                f'static-host-mapping "{host}" address "{hostprops["address"]}"'
                f'already used in another static-host-mapping'))

This results in output looking like:

static-host-mapping "test2" address "10.0.10.100"already used in another static-host-mapping

[[system static-host-mapping]] failed

Given that there's a lot of code with the first pattern, the extra space probably needs to be inserted in the ConfigError object.

Details

Difficulty level
Easy (less than an hour)
Version
1.3
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

kroy created this task.Jun 27 2020, 3:26 AM
kroy updated the task description. (Show Details)
kroy updated the task description. (Show Details)
jjakob added a subscriber: jjakob.Jun 27 2020, 6:59 AM

No, the string concatenation is done by Python (these are not multiple arguments but one argument) so there's nothing ConfigError can do. It's simply a mistake (typo) on my part.

The reason I do it this way is to comply with the 80-column limit. Any strings separated by whitespace will be transparently concatenated by Python to one string, it requires adding extra braces around the multi-line string.