metwork-framework / mfdata

metwork/mfdata module
http://metwork-framework.org/
BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

[switch_rules:alwaystrue] with multiple steps - Questions #348

Closed dearith closed 4 years ago

dearith commented 4 years ago

I'm trying to use [switch_rules:alwaystrue] in my foo plugin with multiple steps : main and other

My config.ini (according to the documentation with multiple steps) [switch_rules:alwaystrue] *=main, other

With this configuration, switch fails : Bad syntax

2020-10-29T10:26:51.214605Z    [ERROR] (switch/rules#13532) bad action [other] for section [switch_rules_foo:alwaystrue] and pattern: * {path=/home/dearith10/metwork/mfdata/tmp/config_auto/plugin_switch_rules.ini}
Traceback (most recent call last):
  File "/opt/metwork-mfext-1.0/opt/python3/bin/switch_step", line 11, in <module>
    sys.exit(main())
  File "/opt/metwork-mfext-1.0/opt/python3/lib/python3.7/site-packages/acquisition/switch_step.py", line 110, in main
    x.run()
  File "/opt/metwork-mfext-1.0/opt/python3/lib/python3.7/site-packages/acquisition/step.py", line 526, in run
    self._init()
  File "/opt/metwork-mfext-1.0/opt/python3/lib/python3.7/site-packages/acquisition/switch_step.py", line 35, in _init
    r, self.args.switch_section_prefix)
  File "/opt/metwork-mfext-1.0/opt/python3/lib/python3.7/site-packages/acquisition/switch_rules.py", line 305, in read
    raise BadSyntax()
acquisition.switch_rules.BadSyntax

The plugin_switch_rules.ini :

# GENERATED FILE

# <CONTRIBUTION OF foo PLUGIN>

[switch_rules_foo:alwaystrue]
* = foo/main, other
# </CONTRIBUTION OF foo PLUGIN>

# <CONTRIBUTION OF ungzip PLUGIN>

[switch_rules_ungzip:fnmatch:latest.guess_file_type.main.system_magic]
gzip compressed data* = ungzip/main
# </CONTRIBUTION OF ungzip PLUGIN>

Now, if I set my switch rules like this:

[switch_rules:alwaystrue]
*=foo/main, foo/other

It works,

Is it an issue or am I wrong ? What is the correct way to configure rules with mutiple steps ?

thefab commented 4 years ago

ok, great @dearith! this is a bug with multiple targets steps when not adding explicitly the plugin name!

let's fix it!