From 62d00e60e6723c5ea2284a8652697b80971bc39b Mon Sep 17 00:00:00 2001 From: xiaodongwang Date: Thu, 4 Sep 2014 21:44:54 -0700 Subject: [PATCH] fix the filter field name typo when get db object Change-Id: I993887fb1e79cc4f7f3f4b227bb68b6670efd1c0 --- compass/db/api/cluster.py | 15 +++++++++------ compass/db/api/switch.py | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/compass/db/api/cluster.py b/compass/db/api/cluster.py index f7c14a13..8ecbf7a0 100644 --- a/compass/db/api/cluster.py +++ b/compass/db/api/cluster.py @@ -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) diff --git a/compass/db/api/switch.py b/compass/db/api/switch.py index a3ea2fd0..75d1450b 100644 --- a/compass/db/api/switch.py +++ b/compass/db/api/switch.py @@ -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)