Class: RefreshVaultToken

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/refresh_vault_token.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.retry_attemptsObject



8
9
10
# File 'app/jobs/refresh_vault_token.rb', line 8

def self.retry_attempts
  SETTINGS&.[](:foreman_vault)&.[](:refresh_token_retry_attempts) || 3
end

.retry_waitObject



4
5
6
# File 'app/jobs/refresh_vault_token.rb', line 4

def self.retry_wait
  (SETTINGS&.[](:foreman_vault)&.[](:refresh_token_retry_wait) || 5).minutes
end

Instance Method Details

#humanized_nameObject



25
26
27
# File 'app/jobs/refresh_vault_token.rb', line 25

def humanized_name
  _('Refresh Vault token')
end

#perform(vault_connection_id) ⇒ Object



16
17
18
19
# File 'app/jobs/refresh_vault_token.rb', line 16

def perform(vault_connection_id)
  vault_connection = VaultConnection.with_valid_token.find(vault_connection_id)
  vault_connection.try(:renew_token!)
end