Class: Bosh::Deployer::UiMessager

Inherits:
Object
  • Object
show all
Includes:
BoshExtensions
Defined in:
lib/bosh/deployer/ui_messager.rb

Defined Under Namespace

Classes: UnknownMessageName

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(messages, options = {}) ⇒ UiMessager

Returns a new instance of UiMessager.



20
21
22
23
# File 'lib/bosh/deployer/ui_messager.rb', line 20

def initialize(messages, options = {})
  @messages = messages
  @options = options
end

Class Method Details

.for_deployer(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/bosh/deployer/ui_messager.rb', line 9

def self.for_deployer(options = {})
  new(
    {
    update_stemcell_unknown: 'Will deploy because new stemcell fingerprint is unknown',
    update_stemcell_changed: 'Will deploy due to stemcell changes',
    update_config_changed:   'Will deploy due to configuration changes',
    update_no_changes:       'Will skip deploy due to no changes',
    },
    options)
end

Instance Method Details

#info(message_name) ⇒ Object

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bosh/deployer/ui_messager.rb', line 25

def info(message_name)

  raise ArgumentError, 'message_name must be a Symbol' unless message_name.is_a?(Symbol)

  message = @messages[message_name]
  if message
    say(message) unless @options[:silent]
  else
    raise UnknownMessageName, message_name
  end
end