Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly close IPC connections #52495

Merged
merged 20 commits into from
Apr 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions salt/beacons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ def list_beacons(self,
beacons = self._get_beacons(include_pillar, include_opts)

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': beacons},
tag='/salt/minion/minion_beacons_list_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': beacons},
tag='/salt/minion/minion_beacons_list_complete')

return True

Expand All @@ -247,9 +247,9 @@ def list_available_beacons(self):
for _beacon in self.beacons if '.beacon' in _beacon]

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': _beacons},
tag='/salt/minion/minion_beacons_list_available_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': _beacons},
tag='/salt/minion/minion_beacons_list_available_complete')

return True

Expand All @@ -270,11 +270,11 @@ def validate_beacon(self, name, beacon_data):
valid = True

# Fire the complete event back along with the list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True,
'vcomment': vcomment,
'valid': valid},
tag='/salt/minion/minion_beacon_validation_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True,
'vcomment': vcomment,
'valid': valid},
tag='/salt/minion/minion_beacon_validation_complete')

return True

Expand All @@ -300,10 +300,10 @@ def add_beacon(self, name, beacon_data):
self.opts['beacons'].update(data)

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_add_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_add_complete')

return True

Expand All @@ -326,10 +326,10 @@ def modify_beacon(self, name, beacon_data):
self.opts['beacons'].update(data)

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_modify_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_modify_complete')
return True

def delete_beacon(self, name):
Expand All @@ -350,10 +350,10 @@ def delete_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_delete_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_delete_complete')

return True

Expand All @@ -365,9 +365,9 @@ def enable_beacons(self):
self.opts['beacons']['enabled'] = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_enabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_enabled_complete')

return True

Expand All @@ -379,9 +379,9 @@ def disable_beacons(self):
self.opts['beacons']['enabled'] = False

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_disabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': True, 'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacons_disabled_complete')

return True

Expand All @@ -400,10 +400,10 @@ def enable_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_enabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_enabled_complete')

return True

Expand All @@ -422,10 +422,10 @@ def disable_beacon(self, name):
complete = True

# Fire the complete event back along with updated list of beacons
evt = salt.utils.event.get_event('minion', opts=self.opts)
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_disabled_complete')
with salt.utils.event.get_event('minion', opts=self.opts) as evt:
evt.fire_event({'complete': complete, 'comment': comment,
'beacons': self.opts['beacons']},
tag='/salt/minion/minion_beacon_disabled_complete')

return True

Expand Down
Loading