Sha256: 8cd08137c9a6ef4fac7f765a3549790b2c7f0fb8ba673ffc1923b10855d0041e
Contents?: true
Size: 1.1 KB
Versions: 16
Compression:
Stored size: 1.1 KB
Contents
require 'mkit/ctypes' require 'mkit/app/helpers/docker_helper' require 'fileutils' class Volume < ActiveRecord::Base belongs_to :service before_destroy :clean_up 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 def deploy create_volume end def create_volume case self.ctype when MKIt::CType::DOCKER_STORAGE MKIt::DockerHelper.create_volume(self.name) when MKIt::CType::LOCAL_STORAGE # nop end end def delete_volume case self.ctype when MKIt::CType::DOCKER_STORAGE MKIt::DockerHelper.delete_volume(self.name) end end def clean_up # nop end end
Version data entries
16 entries across 16 versions & 1 rubygems