Class: Berta::CommandExecutor

Inherits:
Object
  • Object
show all
Defined in:
lib/berta/command_executor.rb

Overview

Class for executing main berta commands

Class Method Summary collapse

Class 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
# File 'lib/berta/command_executor.rb', line 8

def self.cleanup
  service = Berta::Service.new(Berta::Settings['opennebula']['secret'],
                               Berta::Settings['opennebula']['endpoint'])
  vms = service.running_vms
  Berta::ExpirationManager.new.update_expirations(vms)
  Berta::NotificationManager.new(service).notify_users(vms)
rescue Berta::Errors::BackendError => e
  logger.error e.message
end