Class: Berta::CommandExecutor
- Inherits:
-
Object
- Object
- Berta::CommandExecutor
- Defined in:
- lib/berta/command_executor.rb
Overview
Class for executing main berta commands
Instance Method Summary collapse
-
#cleanup ⇒ Object
Function that performs clean up operation.
Instance Method Details
#cleanup ⇒ Object
Function that performs clean up operation. Connects to opennebula database, runs expiration update process and notifies users about upcoming expirations.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/berta/command_executor.rb', line 8 def cleanup service = Berta::Service.new(Berta::Settings['opennebula']['secret'], Berta::Settings['opennebula']['endpoint']) vms = service.running_vms users = service.users groups = service.groups vms.each(&:update) users.each { |user| user.notify(service.user_vms(user)) } groups.each { |group| group.notify(service.group_vms(group)) } rescue Berta::Errors::BackendError => e logger.error e. end |