Class: SwarmClusterCliOpe::SyncConfigs::PostGres

Inherits:
BaseDatabase
  • Object
show all
Defined in:
lib/swarm_cluster_cli_ope/sync_configs/post_gres.rb

Direct Known Subclasses

Kubernetes::SyncConfigs::PostGres

Defined Under Namespace

Classes: EnvConfigs

Instance Attribute Summary

Attributes inherited from Base

#configs, #service

Instance Method Summary collapse

Methods inherited from BaseDatabase

#local, #remote, #resume

Methods inherited from Base

#initialize

Methods included from LoggerConcern

#logger

Constructor Details

This class inherits a constructor from SwarmClusterCliOpe::SyncConfigs::Base

Instance Method Details

#pullObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/swarm_cluster_cli_ope/sync_configs/post_gres.rb', line 5

def pull
  resume('pull')

  if yes?("Confermare il comando?[y,yes]")

    tmp_file = "/tmp/#{Time.now.to_i}.sql.gz"
    dump_cmd(remote, tmp_file)
    local.container.copy_in(tmp_file, tmp_file)

    # drop old db and recreate
    # if Gem::Version.new(local.database_version) <= Gem::Version.new("12")
    close_connections_and_drop_cmd(local)
    # else
    #   raise "DA ANALIZZARE QUANDO LA 13 disponibile....dropdb ha un force come parametro"
    # end

    create_cmd(local)

    restore_cmd(local, tmp_file)

  end
  true
end

#pushTrueClass, FalseClass

Returns:

  • (TrueClass, FalseClass)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/swarm_cluster_cli_ope/sync_configs/post_gres.rb', line 30

def push
  resume('PUSH')

  if yes?("ATTENZIONE !!!!!!PUSH!!!!! - Confermare il comando?[y,yes]")

    tmp_file = "/tmp/#{Time.now.to_i}.sql.gz"
    dump_cmd(local, tmp_file)
    remote.container.copy_in(tmp_file, tmp_file)

    close_connections_and_drop_cmd(remote)

    create_cmd(remote)

    restore_cmd(remote, tmp_file)

  end
  true
end