Sha256: 44e2ddc65881a98a6185aa00556fddf191e474f2de43707ee1de4af987983e32

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

require "log4r"

module VagrantPlugins
  module ManagedServers
    module Action
      class TrackServerDeploymentStart
        def initialize(app, _env)
          @app    = app
          @logger = Log4r::Logger.new("vagrant_managed_servers::action::track_server_deployment_start")
        end

        def call(env)
          machine = env[:machine]
          env[:start_times] ||= {}
          env[:start_times][machine.name] = Time.now
          track_deployment_start(machine, env[:ui])
          @app.call(env)
        end

        def track_deployment_start(machine, ui)
          host = machine.config.orchestrate.tracker_host
          return unless host
          @logger.debug("Tracking deployment server start to #{host}.")
          id = VagrantPlugins::Orchestrate::DEPLOYMENT_ID
          server = {
            deployment_id: id,
            hostname: machine.provider_config.server
          }
          DeploymentTrackerClient::DefaultApi.post_server(id, server)
        rescue => ex
          ui.warn("There was an error notifying deployment tracker of server start. See error log for details.")
          ui.warn(ex.message)
          @logger.warn("Error tracking deployment server start for deployment #{id}")
          @logger.warn(ex)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vagrant-orchestrate-0.8.0 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.8.0.pre.3 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.8.0.pre.2 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.8.0.pre.1 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.2 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.1 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0.pre.5 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0.pre.3 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0.pre.2 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0.pre.1 lib/vagrant-managed-servers/action/track_server_deployment_start.rb
vagrant-orchestrate-0.7.0.pre lib/vagrant-managed-servers/action/track_server_deployment_start.rb