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
11
12
# File 'lib/docker-provider/config.rb', line 6

def initialize
  @image      = nil
  @cmd        = UNSET_VALUE
  @ports      = []
  @privileged = UNSET_VALUE
  @volumes    = []
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

#privilegedObject

Returns the value of attribute privileged.



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

def privileged
  @privileged
end

#volumesObject

Returns the value of attribute volumes.



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

def volumes
  @volumes
end

Instance Method Details

#finalize!Object



14
15
16
17
# File 'lib/docker-provider/config.rb', line 14

def finalize!
  @cmd        = [] if @cmd == UNSET_VALUE
  @privileged = false if @privileged == UNSET_VALUE
end

#validate(machine) ⇒ Object



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

def validate(machine)
  errors = _detected_errors

  # 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