Python reference for OpenLMI client scripts

Service Module API

LMI service provider client library.

lmi.scripts.service.get_service(ns, service)[source]

Return lmi.shell.LMIInstance object matching the given service name.

Parameters:service (string) – Service name.
lmi.scripts.service.invoke_on_service(ns, method, service, description)[source]

Invoke parameter-less method on given service.

Parameters:
  • method (string) – Name of method of LMI_Service to invoke.
  • service (string or lmi.shell.LMIInstanceName) – Name of service or an instance to operate upon.
  • description (string) – Description of what has been done with service. This is used just for logging.
Returns:

Success flag.

Return type:

boolean

lmi.scripts.service.list_services(ns, kind='enabled')[source]

List services. Yields service instances.

Parameters:kind (string) –

What kind of services to list. Possible options are:

  • ‘enabled’ - list only enabled services
  • ‘disabled’ - list only disabled services
  • ‘oneshot’ - list only oneshot services
  • ‘all’ - list all services
Returns:Instances of LMI_Service.
Return type:generator over lmi.shell.LMIInstance.
lmi.scripts.service.reload_service(ns, service, force=False, just_try=False)[source]

Reload service.

Parameters:
  • service (string or lmi.shell.LMIInstanceName) – Service name or instance.
  • force (boolean) – Whether the service should be restarted if the reload can no be done.
  • just_try (boolean) – This applies only when force is True. If True, only the the running service will be restarted. Nothing is done for stopped service.
lmi.scripts.service.restart_service(ns, service, just_try=False)[source]

Restart service.

Parameters:
  • service (string or lmi.shell.LMIInstanceName) – Service name or instance.
  • just_try (boolean) – When False, the service will be started even if it is not running. Otherwise only running service will be restarted.
lmi.scripts.service.start_service(ns, service)[source]

Start service.

Parameters:service (string or lmi.shell.LMIInstanceName) – Service name.
lmi.scripts.service.stop_service(ns, service)[source]

Stop service.

Parameters:service (string or lmi.shell.LMIInstanceName) – Service name or instance.

Table Of Contents

Previous topic

Service library

Next topic

Software library

This Page