Class: VagrantPlugins::DockerProvider::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/docker-provider/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



6
7
8
9
10
# File 'lib/docker-provider/config.rb', line 6

def initialize
  @image = UNSET_VALUE
  @cmd   = UNSET_VALUE
  @ports = UNSET_VALUE
end

Instance Attribute Details

#cmdObject

Returns the value of attribute cmd.



4
5
6
# File 'lib/docker-provider/config.rb', line 4

def cmd
  @cmd
end

#imageObject

Returns the value of attribute image.



4
5
6
# File 'lib/docker-provider/config.rb', line 4

def image
  @image
end

#portsObject

Returns the value of attribute ports.



4
5
6
# File 'lib/docker-provider/config.rb', line 4

def ports
  @ports
end

Instance Method Details

#finalize!Object



12
13
14
15
# File 'lib/docker-provider/config.rb', line 12

def finalize!
  @ports = [] if @ports == UNSET_VALUE
  @cmd   = [] if @cmd == UNSET_VALUE
end

#validate(machine) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/docker-provider/config.rb', line 17

def validate(machine)
  errors = _detected_errors

  errors << I18n.t("docker_provider.errors.config.image_not_set") if @image == UNSET_VALUE
  # TODO: Detect if base image has a CMD / ENTRYPOINT set before erroring out
  errors << I18n.t("docker_provider.errors.config.cmd_not_set")   if @cmd == UNSET_VALUE

  { "docker-provider" => errors }
end