Merge "Add include_disabled parameter to service_get_all_by_binary"
This commit is contained in:
@@ -141,9 +141,13 @@ def service_get_all_by_topic(context, topic):
|
||||
return IMPL.service_get_all_by_topic(context, topic)
|
||||
|
||||
|
||||
def service_get_all_by_binary(context, binary):
|
||||
"""Get all services for a given binary."""
|
||||
return IMPL.service_get_all_by_binary(context, binary)
|
||||
def service_get_all_by_binary(context, binary, include_disabled=False):
|
||||
"""Get services for a given binary.
|
||||
|
||||
Includes disabled services if 'include_disabled' parameter is True
|
||||
"""
|
||||
return IMPL.service_get_all_by_binary(context, binary,
|
||||
include_disabled=include_disabled)
|
||||
|
||||
|
||||
def service_get_all_by_host(context, host):
|
||||
|
||||
@@ -545,11 +545,12 @@ def service_get_by_host_and_topic(context, host, topic):
|
||||
|
||||
|
||||
@pick_context_manager_reader
|
||||
def service_get_all_by_binary(context, binary):
|
||||
return model_query(context, models.Service, read_deleted="no").\
|
||||
filter_by(disabled=False).\
|
||||
filter_by(binary=binary).\
|
||||
all()
|
||||
def service_get_all_by_binary(context, binary, include_disabled=False):
|
||||
query = model_query(context, models.Service, read_deleted="no").\
|
||||
filter_by(binary=binary)
|
||||
if not include_disabled:
|
||||
query = query.filter_by(disabled=False)
|
||||
return query.all()
|
||||
|
||||
|
||||
@pick_context_manager_reader
|
||||
|
||||
Reference in New Issue
Block a user