class Bosh::Deployer::Registry
Constants
- RETRYABLE_HTTP_EXCEPTIONS
Attributes
cloud_plugin[R]
cloud_properties[R]
db_file[R]
logger[R]
password[R]
port[R]
registry_pid[R]
state[R]
user[R]
Public Class Methods
new(endpoint, cloud_plugin, cloud_properties, state, logger)
click to toggle source
# File lib/bosh/deployer/registry.rb, line 8 def initialize(endpoint, cloud_plugin, cloud_properties, state, logger) @cloud_properties = cloud_properties @state = state @logger = logger uri = URI.parse(endpoint) @user, @password = uri.userinfo.split(':', 2) @port = uri.port @cloud_plugin = cloud_plugin end
Public Instance Methods
start()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 19 def start write_configure Sequel.connect(connection_settings) do |db| migrate(db) instances = state.deployments['registry_instances'] db[:registry_instances].multi_insert(instances) if instances end unless has_bosh_registry? err "bosh-registry command not found - run 'gem install bosh-registry'" end cmd = "bosh-registry -c #{@registry_config.path}" @registry_pid = Process.spawn(cmd) watch_for_crash(cmd) wait_for_listen logger.info("bosh-registry is ready on port #{port}") ensure @registry_config.unlink if @registry_config end
stop()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 43 def stop kill_registry if registry_pid return unless db_file Sequel.connect(connection_settings) do |db| state.deployments['registry_instances'] = db[:registry_instances].map { |row| row } end ensure db_file.unlink if db_file end