Method: Volume.create

Defined in:
lib/mkit/app/model/volume.rb

.create(service, volume) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mkit/app/model/volume.rb', line 9

def self.create(service, volume)
      case volume
      when /^docker:\/\//
        ctype = MKIt::CType::DOCKER_STORAGE
        paths = volume[9..].split(':')
        # vname="#{service.name}.#{service.application.name}.#{paths[0]}"
        vname = paths[0]
      when /^\//
        ctype = MKIt::CType::LOCAL_STORAGE
        paths = volume.split(':')
        vname = paths[0]
      end
      Volume.new(
        service: service,
        name: vname,
        path: paths[1],
        ctype: ctype
      )
end