class Chef::Resource::HabitatSup

Public Instance Methods

exec_start_options() click to toggle source
# File lib/chef/resource/habitat/habitat_sup.rb, line 301
def exec_start_options
  # Populate exec_start_options which will pass to 'hab sup run' for platforms if use_toml_config is not 'true'
  unless use_toml_config
    opts = []
    opts << "--permanent-peer" if new_resource.permanent_peer
    opts << "--listen-ctl #{new_resource.listen_ctl}" if new_resource.listen_ctl
    opts << "--listen-gossip #{new_resource.listen_gossip}" if new_resource.listen_gossip
    opts << "--listen-http #{new_resource.listen_http}" if new_resource.listen_http
    opts << "--org #{new_resource.org}" unless new_resource.org == "default"
    opts.push(*new_resource.peer.map { |b| "--peer #{b}" }) if new_resource.peer
    opts << "--ring #{new_resource.ring}" if new_resource.ring
    opts << "--auto-update" if new_resource.auto_update
    opts << "--update-condition #{new_resource.update_condition}" if new_resource.update_condition
    opts << "--health-check-interval #{new_resource.health_check_interval}" if new_resource.health_check_interval
    opts << "--event-stream-application #{new_resource.event_stream_application}" if new_resource.event_stream_application
    opts << "--event-stream-environment #{new_resource.event_stream_environment}" if new_resource.event_stream_environment
    opts << "--event-stream-site #{new_resource.event_stream_site}" if new_resource.event_stream_site
    opts << "--event-stream-url #{new_resource.event_stream_url}" if new_resource.event_stream_url
    opts << "--event-stream-token #{new_resource.event_stream_token}" if new_resource.event_stream_token
    opts << "--event-stream-server-certificate #{new_resource.event_stream_cert}" if new_resource.event_stream_cert
    opts << "--keep-latest-packages #{new_resource.keep_latest}" if new_resource.keep_latest
    opts.join(" ")
  end
end
peer_list_with_port() click to toggle source

validate that peers have been passed with a port # for toml file

# File lib/chef/resource/habitat/habitat_sup.rb, line 282
def peer_list_with_port
  if new_resource.peer
    peer_list = []
    new_resource.peer.each do |p|
      peer_list << if !/.*:.*/.match?(p)
                     p + ":9632"
                   else
                     p
                   end
    end
    peer_list
  end
end
use_toml_config() click to toggle source

Specify whether toml configuration should be used in place of service arguments.

# File lib/chef/resource/habitat/habitat_sup.rb, line 297
def use_toml_config
  new_resource.toml_config
end