Forum Discussion
Ionut_Turturic1
Mar 05, 2010Historic F5 Account
System.Services.set_service not working with HTTPD
Any idea why the System.Services.set_service has absolutely no effect with SERVICE_HTTPD ? No exception is thrown, no error messages in logs.
It does work for mostly all other services!
action = pc.System.Services.typefactory.\
create('System.Services.ServiceAction').\
SERVICE_ACTION_REINIT
service = pc.System.Services.typefactory.\
create('System.Services.ServiceType').\
SERVICE_HTTPD
print pc.System.Services.set_service([service], action)
Where pc is an instance of pycontrol2.BIGIP.
Thanks.
5 Replies
- L4L7_53191
Nimbostratus
I haven't had time to test this, but for sure you're missing some kwargs in your set_service call - it expects two: services and service_action. Your call should look something like:pc.System.Services.set_service(services=[service], service_action=action)
Also note that it's asynchronous: the call may return before the actual job is done.
-Matt - Ionut_Turturic1Historic F5 AccountThe kwargs would only improve readability in this case.
I was expecting something similar to ntpd in ltm log:Mar 5 09:44:05 local/bp6800-121 notice logger: /usr/local/www/iControl/iControlPortal.cgi ==> /usr/bin/bigstart reinit ntpd
Probably access to httpd has been blocked in the iControl service because it's not a bright idea to *stop* apache which serves the iControl queries. But why block the reload (or reinit) action ?! Also there's no error, exception to let me know what is happening. - L4L7_53191
Nimbostratus
Sure enough. I see the exact same behavior. This works:s.set_service(services=[svc.SERVICE_NOKIASNMPD],service_action=action.SERVICE_ACTION_RESTART) producing: local/bigip1 notice logger: /usr/local/www/iControl/iControlPortal.cgi ==> /usr/bin/bigstart restart nokiasnmpd
This doesn't:s.set_service(services=[svc.SERVICE_HTTPD],service_action=action.SERVICE_ACTION_RESTART)
So this looks like an iControl bug. I'll open a case.
-Matt - I'm looking through the sources and it seems that any request for START, STOP, REINIT, AND RESTART for SERVICE_HTTPD is silently ignored. This should probably thrown an exception to let you know that it didn't work. I can understand the reasoning for disabling it though as a restart or reinit will break the current iControl request and the call will return a transport error.
In case you are interested, here's the code block with the developers commentfor (unsigned int i = 0; i < services.size(); i++) { // we will silently ignore request to start/stop/reinit/restart httpd // since that would be BAD ! if (services[ i ] == System::Services::SERVICE_HTTPD && (action == System::Services::SERVICE_ACTION_START || action == System::Services::SERVICE_ACTION_STOP || action == System::Services::SERVICE_ACTION_REINIT || action == System::Services::SERVICE_ACTION_RESTART)) { continue; } ... }
I guess the "since that would be BAD !" is the fact that it will break the current iControl request B-).
-Joe - L4L7_53191
Nimbostratus
Thanks Joe. Still seems a bit odd we can't restart at the very least but at least we know.
-Matt
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
