module SwarmClusterCliOpe::StackSyncConcern

Public Instance Methods

stacksync(direction) click to toggle source
# File lib/swarm_cluster_cli_ope/stack_sync_concern.rb, line 96
def stacksync(direction)
  direction = case direction
              when 'push'
                :push
              when 'pull'
                :pull
              else
                raise "ONLY [push|pull] action accepted"
              end

  if direction == :push
    unless yes? "ATTENZIONE STAI FACENDO PUSH, proseguire????[y,yes]"
      exit "OK, CIAO"
    end
  end

  cfgs.env(options[:environment]) do |cfgs|
    sync_cfgs = cfgs.sync_configurations
    if sync_cfgs.empty?
      say "Attenzione, configurazioni di sincronizzazione vuoto. Leggere la documentazione"
    else
      sync_cfgs.each do |sync|
        say "----------->>>>>>"
        say "[ #{sync.class.name} ]"
        sync.send(direction)
        say "COMPLETE"
        say "<<<<<<-----------"
      end
    end
  end
end