module Bosh::Deployer
Constants
- Config
- VERSION
Public Instance Methods
connection_settings()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 132 def connection_settings { 'adapter' => 'sqlite', 'database' => db_file.path } end
has_bosh_registry?(path = ENV.to_hash['PATH'])
click to toggle source
# File lib/bosh/deployer/registry.rb, line 95 def has_bosh_registry?(path = ENV.to_hash['PATH']) path.split(File::PATH_SEPARATOR).each do |dir| return true if File.exist?(File.join(dir, 'bosh-registry')) end false end
kill_registry()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 139 def kill_registry Process.kill('INT', @registry_pid) Process.waitpid2(@registry_pid) rescue Errno::ESRCH logger.debug('registry already stopped') end
migrate(db)
click to toggle source
# File lib/bosh/deployer/registry.rb, line 102 def migrate(db) db.create_table :registry_instances do primary_key :id column :instance_id, :text, unique: true, null: false column :settings, :text, null: false end end
wait_for_listen()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 85 def wait_for_listen http_client = HTTPClient.new Bosh::Common.retryable(on: RETRYABLE_HTTP_EXCEPTIONS, sleep: 0.5, tries: 300) do http_client.head("http://127.0.0.1:#{port}") end rescue Bosh::Common::RetryCountExceeded => e err "Cannot access bosh-registry: #{e.message}" end
write_configure()
click to toggle source
# File lib/bosh/deployer/registry.rb, line 110 def write_configure @db_file = Tempfile.new('bosh_registry_db') registry_config = { 'logfile' => './bosh-registry.log', 'http' => { 'port' => port, 'user' => user, 'password' => password }, 'db' => connection_settings, 'cloud' => { 'plugin' => cloud_plugin, cloud_plugin => cloud_properties } } @registry_config = Tempfile.new('bosh_registry_yml') @registry_config.write(Psych.dump(registry_config)) @registry_config.close end