Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
calling configdpRun from API controller with more than one parameter
« previous
next »
Print
Pages: [
1
]
Author
Topic: calling configdpRun from API controller with more than one parameter (Read 3047 times)
mihak
Jr. Member
Posts: 70
Karma: 5
calling configdpRun from API controller with more than one parameter
«
on:
May 20, 2021, 08:47:07 pm »
I hit a curious obstacle and before I implement a workaround, I wanted to check here if I am missing something.
1. I have a fully functioning configd action defined as:
[get]
command:/usr/local/bin/python3 <path>/script.py
parameters: %s %s
type:script_output
I can call that action with
configctl <service> get parm1 parm2
- and it will grab both parameters as expected
2. I have an API controller defined that calls the configd action:
class OnlineController extends ApiControllerBase
{
public function getAction($id='', $verb='')
{
return (new Backend())->configdpRun("<service> get", $id, $verb);
}
}
Except I cannot pass the second parameter to configdpRun; passing only one parameter works, passing two parameters makes API controller to throw a GUID error instead executing the configd action.
Is this a known limitation? The line above works fine if I pass a single (compounded) parameter like this:
return (new Backend())->configdpRun("<service> get", $id.' '.$verb);
- and then split it within my Python code.
But before I do that, I thought I ask here - am I doing something wrong?
«
Last Edit: May 20, 2021, 08:55:30 pm by mihak
»
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
calling configdpRun from API controller with more than one parameter