diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-05-24 22:56:26 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-05-24 22:56:26 +0200 |
| commit | 4ba2e4cc2aa0e272c1b8429db914f568cb636791 (patch) | |
| tree | 6f60eeb625f63143a241bee144e74fe01e492cf1 | |
| parent | d9dacc11fcfb222ab38db2c6b16d07126cf47e5d (diff) | |
| -rwxr-xr-x | cdist | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -1081,13 +1081,21 @@ class Tree: with TreeDirectory(self): return self.cscript[function](self.target, *args, **kwargs) - def vaguely_call(self, function, **kwargs): - values = [] + def vaguely_call(self, function, **potential_args): + args = [] + kwargs = {} for arg in inspect.getfullargspec(self.cscript[function]).args: - if arg not in kwargs: - raise Error('Requested argument %s not provided' % arg) - values.append(kwargs[arg]) - return self.call(function, values) + if arg == 'target': + # This gets added in call() + continue + if arg not in potential_args: + raise Error('Requested argument %s for %s not provided' % (arg, function)) + args.append(potential_args[arg]) + for arg in inspect.getfullargspec(self.cscript[function]).kwonlyargs: + if arg not in potential_args: + raise Error('Requested argument %s for %s not provided' % (arg, function)) + kwargs[arg] = potential_args[arg] + return self.call(function, *args, **kwargs) def add_defaults(self, options): """Add the defaults from self into a dict options and returns a new dict""" |
