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

function_call: service_control_stop($name, $extras) not working #86

Open
e2m32 opened this issue Jan 5, 2023 · 0 comments
Open

function_call: service_control_stop($name, $extras) not working #86

e2m32 opened this issue Jan 5, 2023 · 0 comments

Comments

@e2m32
Copy link

e2m32 commented Jan 5, 2023

Love this api. Thank you for your work. Been using it with HomeAssistant for a while and have a new use case I'd like to implement.

I am attempting to stop a vpn client. I have enabled function_call for my user and have uncommented the service_control_stop in the "pfsense_function_calls.txt" file on my pfsense box. When I execute the following python code I get a success response, but the client is still running:

stop_openvpn = json.dumps(
            FauxapiLib.function_call({
            'function': 'service_control_stop',
            'args': ['openvpn', 'array(vpnmode => client, id => 3)']
            }
           ))
print(stop_openvpn)

print statement:

{"callid": "63b6541d8ee0a", "action": "function_call", "message": "ok", "data": {"return": "openvpn has been stopped."}}

I tried this call from the pfsense UI for executing php and the client service is properly stopped:

include('service-utils.inc');service_control_stop(openvpn, array(vpnmode => client, id => 3));

Is there something else I need to do to make this work?

I tried adding "service-utils.inc" to the "pfsense_function_calls.txt" file, but that made no difference:

#
# Entries in this file without any function definition are available to be 
# included but none of the functions within them are available to be accessed 
# via FauxAPI function_call()
# 
globals.inc
util.inc
xmlparse.inc
notices.inc
config.lib.inc
system.inc
service-utils.inc

I am running version 1.4.

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

1 participant