fix the filter field name typo when get db object

Change-Id: I993887fb1e79cc4f7f3f4b227bb68b6670efd1c0
This commit is contained in:
xiaodongwang 2014-09-04 21:44:54 -07:00
parent cee2172cce
commit 62d00e60e6
2 changed files with 13 additions and 10 deletions

View File

@ -1350,7 +1350,8 @@ def get_clusterhost_state(
):
"""Get clusterhost state info."""
return utils.get_db_object(
session, models.ClusterHost, id=clusterhost_id
session, models.ClusterHost,
clusterhost_id=clusterhost_id
).state_dict()
@ -1365,8 +1366,9 @@ def get_clusterhost_self_state(
):
"""Get clusterhost state info."""
return utils.get_db_object(
session, models.ClusterHostState, id=clusterhost_id
)
session, models.ClusterHost,
clusterhost_id=clusterhost_id
).state
@utils.supported_filters(
@ -1402,7 +1404,8 @@ def update_clusterhost_state(
):
"""Update a clusterhost state."""
clusterhost = utils.get_db_object(
session, models.ClusterHost, id=clusterhost_id
session, models.ClusterHost,
clusterhost_id=clusterhost_id
)
utils.update_db_object(session, clusterhost.state, **kwargs)
return clusterhost.state_dict()
@ -1481,12 +1484,12 @@ def get_clusterhost_log_history(
)
@database.run_in_session()
@utils.wrap_to_dict(RESP_CLUSTERHOST_LOG_FIELDS)
def update_host_log_history(
def update_cluster_host_log_history(
session, updater, cluster_id, host_id, filename, **kwargs
):
"""Update a host log history."""
cluster_host_log_history = utils.get_db_object(
session, models.ClusterHostLogHistory,
session, models.HostLogHistory,
cluster_id=cluster_id, host_id=host_id, filename=filename
)
return utils.update_db_object(session, cluster_host_log_history, **kwargs)

View File

@ -607,7 +607,7 @@ def get_switchmachine(
"""get field dict of a switch machine."""
return utils.get_db_object(
session, models.SwitchMachine,
exception_when_missing, id=switch_machine_id
exception_when_missing, switch_machine_id=switch_machine_id
)
@ -661,7 +661,7 @@ def update_switchmachine(session, updater, switch_machine_id, **kwargs):
"""Update switch machine."""
switch_machine = utils.get_db_object(
session, models.SwitchMachine,
id=switch_machine_id
switch_machine_id=switch_machine_id
)
return update_switch_machine_internal(
session, switch_machine,
@ -711,7 +711,7 @@ def patch_switchmachine(session, updater, switch_machine_id, **kwargs):
"""Patch switch machine."""
switch_machine = utils.get_db_object(
session, models.SwitchMachine,
id=switch_machine_id
switch_machine_id=switch_machine_id
)
return update_switch_machine_internal(
session, switch_machine,
@ -744,7 +744,7 @@ def del_switchmachine(session, deleter, switch_machine_id, **kwargs):
"""Delete switch machines."""
switch_machine = utils.get_db_object(
session, models.SwitchMachine,
id=switch_machine_id
switch_machine_id=switch_machine_id
)
return utils.del_db_object(session, switch_machine)