mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
use genexpr & list comp in minionswarm test
This commit is contained in:
parent
e4b52f8bf2
commit
c7ff123a0f
1 changed files with 3 additions and 6 deletions
|
@ -146,14 +146,11 @@ class Swarm(object):
|
|||
path = os.path.join(dpath, 'minion')
|
||||
|
||||
if self.opts['keep']:
|
||||
ignore = set()
|
||||
keep = self.opts['keep'].split(',')
|
||||
modpath = os.path.join(os.path.dirname(salt.__file__), 'modules')
|
||||
for fn_ in os.listdir(modpath):
|
||||
if fn_.split('.')[0] in keep:
|
||||
continue
|
||||
ignore.add(fn_.split('.')[0])
|
||||
data['disable_modules'] = list(ignore)
|
||||
fn_prefixes = (fn_.partition('.')[0] for fn_ in os.listdir(modpath))
|
||||
ignore = [fn_prefix for fn_prefix in fn_prefixes if fn_prefix not in keep]
|
||||
data['disable_modules'] = ignore
|
||||
|
||||
with open(path, 'w+') as fp_:
|
||||
yaml.dump(data, fp_)
|
||||
|
|
Loading…
Add table
Reference in a new issue