Sha256: 3db77d236340adad0875cbdda6a98fb052a7d170cfc7473489e84e2b3763fbd5

Contents?: true

Size: 950 Bytes

Versions: 10

Compression:

Stored size: 950 Bytes

Contents

module FogExtensions
  module Fogdocker
    module Server
      extend ActiveSupport::Concern

      include ActionView::Helpers::NumberHelper

      def state
        state_running ? 'Running' : 'Stopped'
      end

      # Last time a container was started
      # WARNING: this doesn't mean the container has been running since then.
      def started_at
        attributes['state_started_at']
      end

      def image_friendly_name
        attributes['config_image']
      end

      def command
        c = []
        c += entrypoint if entrypoint.present?
        c += cmd if cmd.present?
        c.join(' ')
      end

      def poweroff
        service.vm_action(:id => id, :action => :kill)
      end

      def reset
        poweroff
        start
      end

      def vm_description
        _('%{cores} cores and %{memory} memory') %
          { :cores => cpus, :memory => number_to_human_size(memory.to_i) }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_docker-5.0.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-4.1.1 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-4.1.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-4.0.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-3.2.1 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-3.2.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-3.1.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-3.0.0 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-2.1.1 app/models/concerns/fog_extensions/fogdocker/server.rb
foreman_docker-2.1.0 app/models/concerns/fog_extensions/fogdocker/server.rb