Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule not found by description when omitting filter #3

Closed
TFWol opened this issue Feb 7, 2023 · 3 comments
Closed

Rule not found by description when omitting filter #3

TFWol opened this issue Feb 7, 2023 · 3 comments

Comments

@TFWol
Copy link

TFWol commented Feb 7, 2023

Example:

Does not work
php -q fwrule_toggle.php -d 'test rule' toggle
Result: no matching rules found

Works
php -q fwrule_toggle.php -d 'test rule' filter toggle

@luckman212
Copy link
Owner

Not a bug, just a quirk of the syntax because I'm not using a "real" arg parser. If you want to explicitly specify an action (toggle, or enable etc) then you must specify nat or filter as positional param 3. Technically you could pass an empty arg '' as well, like this:

php -q fwrule_toggle.php -d 'test rule' '' toggle

If you just want to toggle, you can omit everything after the rule description, since toggle is the default action:

php -q fwrule_toggle.php -d 'test rule'

I might try to improve the parser in the future, but for now I don't have much time to work on this.

@luckman212 luckman212 changed the title [Bug] Rule not found by description when ommiting filter Rule not found by description when omitting filter Feb 8, 2023
@TFWol
Copy link
Author

TFWol commented Feb 8, 2023

No problem. I just put in an Issue since it didn't seem to work as the readme suggested, so I wanted to let you know.
I had explicitly specified the filter when I saw it wasn't working.

Really like the script you've made since it isn't all that invasive.
Too bad pfSense doesn't give us a native API.

@luckman212
Copy link
Owner

Thanks. I updated the README to clarify. Closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants