error with cache_path_pattern in config file #117

Closed
opened 2021-11-20 13:24:11 +00:00 by ungleich-gitea · 2 comments

Created by: 4nd3r

$ cdist config -C %N 127.0.0.1
INFO: [4060]: 127.0.0.1: Starting configuration run
INFO: [4060]: 127.0.0.1: Finished successful run in 2.02 seconds
$ grep cache_path_pattern .cdist.cfg 
cache_path_pattern = %N
$ cdist config 127.0.0.1
Traceback (most recent call last):
  File "/home/ander/Source/cdist/bin/../scripts/cdist", line 79, in <module>
    commandline()
  File "/home/ander/Source/cdist/bin/../scripts/cdist", line 38, in commandline
    parser, cfg = cdist.argparse.parse_and_configure(sys.argv[1:])
  File "/home/ander/Source/cdist/cdist/argparse.py", line 448, in parse_and_configure
    singleton=singleton)
  File "/home/ander/Source/cdist/cdist/configuration.py", line 40, in __call__
    cls.instance = super(Singleton, cls).__call__(*args, **kwargs)
  File "/home/ander/Source/cdist/cdist/configuration.py", line 355, in __init__
    self.config = self._get_config()
  File "/home/ander/Source/cdist/cdist/configuration.py", line 470, in _get_config
    config = self._read_config_file(self.config_files)
  File "/home/ander/Source/cdist/cdist/configuration.py", line 400, in _read_config_file
    val = config_parser[section][option]
  File "/usr/lib/python3.6/configparser.py", line 1234, in __getitem__
    return self._parser.get(self._name, key)
  File "/usr/lib/python3.6/configparser.py", line 800, in get
    d)
  File "/usr/lib/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%N'

or I'm doing it wrong?

*Created by: 4nd3r* ``` $ cdist config -C %N 127.0.0.1 INFO: [4060]: 127.0.0.1: Starting configuration run INFO: [4060]: 127.0.0.1: Finished successful run in 2.02 seconds $ grep cache_path_pattern .cdist.cfg cache_path_pattern = %N $ cdist config 127.0.0.1 Traceback (most recent call last): File "/home/ander/Source/cdist/bin/../scripts/cdist", line 79, in <module> commandline() File "/home/ander/Source/cdist/bin/../scripts/cdist", line 38, in commandline parser, cfg = cdist.argparse.parse_and_configure(sys.argv[1:]) File "/home/ander/Source/cdist/cdist/argparse.py", line 448, in parse_and_configure singleton=singleton) File "/home/ander/Source/cdist/cdist/configuration.py", line 40, in __call__ cls.instance = super(Singleton, cls).__call__(*args, **kwargs) File "/home/ander/Source/cdist/cdist/configuration.py", line 355, in __init__ self.config = self._get_config() File "/home/ander/Source/cdist/cdist/configuration.py", line 470, in _get_config config = self._read_config_file(self.config_files) File "/home/ander/Source/cdist/cdist/configuration.py", line 400, in _read_config_file val = config_parser[section][option] File "/usr/lib/python3.6/configparser.py", line 1234, in __getitem__ return self._parser.get(self._name, key) File "/usr/lib/python3.6/configparser.py", line 800, in get d) File "/usr/lib/python3.6/configparser.py", line 394, in before_get self._interpolate_some(parser, option, L, value, section, defaults, 1) File "/usr/lib/python3.6/configparser.py", line 444, in _interpolate_some "found: %r" % (rest,)) configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%N' ``` or I'm doing it wrong?
Author
Owner

Created by: 4nd3r

yes, fix'd. thank you!

*Created by: 4nd3r* yes, fix'd. thank you!
Author
Owner

Created by: darko-poljak

This is due to config parser interpolation where all the '%' interpolations are expanded.
5aa8dac80a fixes it.

@4nd3r Can you test it?

*Created by: darko-poljak* This is due to config parser interpolation where all the '%' interpolations are expanded. https://github.com/ungleich/cdist/commit/5aa8dac80a93b4158a713a7837f460042ecd11fe fixes it. @4nd3r Can you test it?
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#117
No description provided.