class Algo::Runner::Apply::ServiceUpdator
Public Class Methods
new(srv_spec, options)
click to toggle source
# File lib/algo/runner/apply.rb, line 38 def initialize srv_spec, options @srv_spec = srv_spec @options = options end
update(srv_spec, dryrun=false)
click to toggle source
# File lib/algo/runner/apply.rb, line 58 def self.update srv_spec, dryrun=false new(srv_spec, {dryrun: dryrun}).update end
Public Instance Methods
update()
click to toggle source
# File lib/algo/runner/apply.rb, line 43 def update begin srv = Algo::Docker::Service.find(@srv_spec['Name']) if srv.raw_spec == @srv_spec puts "service: #{@srv_spec['Name']}, status: ok" return end srv.update @srv_spec unless dryrun? puts "service: #{@srv_spec['Name']}, status: changed" rescue Algo::Docker::Error::NotFoundError Algo::Docker::Service.create(@srv_spec) unless dryrun? puts "service: #{@srv_spec['Name']}, status: created" end end
Private Instance Methods
dryrun?()
click to toggle source
# File lib/algo/runner/apply.rb, line 64 def dryrun? @options[:dryrun] end