Skip to content

Commit

Permalink
Fix handling of endpoint directory deletion
Browse files Browse the repository at this point in the history
The on_dir_delete method needs to handle keyword args, as that's how
the dispatcher will actually call it.

Change-Id: I7e17f59a964c67f61332e977f83bf30f442b1fe0
Closes-Bug: #1540524
  • Loading branch information
Neil Jerram authored and Neil Jerram committed Feb 1, 2016
1 parent b7ff0e8 commit b085fb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions networking_calico/agent/dhcp_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ def _on_snapshot_loaded(self, etcd_snapshot_response):
self.suppress_on_ports_changed = False
self.on_ports_changed()

def on_dir_delete(self, response, *args):
def on_dir_delete(self, response, *args, **kwargs):
"""Called if an endpoint parent directory is deleted from etcd."""
LOG.warning("Unexpected directory deletion from etcd; triggering" +
" resync; %s %s", response, args)
" resync; %s %s %s", response, args, kwargs)

# Unexpected, so handle by doing a resync.
# Handle by doing a resync.
self.resync_after_current_poll = True


Expand Down
6 changes: 3 additions & 3 deletions networking_calico/tests/test_dhcp_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ def etcd_client_read(key, **kwargs):

# Notify deletion of one of that endpoint's parent directories.
agent.etcd.on_dir_delete(None,
'hostname-ignored',
'openstack',
'workload-id-ignored')
hostname='hostname-ignored',
orchestrator='openstack',
workload_id='workload-id-ignored')
self.assertTrue(agent.etcd.resync_after_current_poll)

@mock.patch.object(EtcdWatcher, 'loop')
Expand Down

0 comments on commit b085fb0

Please sign in to comment.