Class: Kitsune::Kit::Commands::SetupSwap

Inherits:
Thor
  • Object
show all
Defined in:
lib/kitsune/kit/commands/setup_swap.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/kitsune/kit/commands/setup_swap.rb', line 19

def create
  if Kitsune::Kit::Defaults.system[:disable_swap]
    say "⚠️ Swap setup is disabled via DISABLE_SWAP=true", :yellow
    return
  end

  filled_options = Kitsune::Kit::OptionsBuilder.build(
    options,
    required: [:server_ip],
    defaults: Kitsune::Kit::Defaults.system.merge(Kitsune::Kit::Defaults.ssh)
  )

  with_ssh_connection(filled_options) do |ssh|
    perform_setup(ssh, filled_options)
  end
end

#rollbackObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/kitsune/kit/commands/setup_swap.rb', line 37

def rollback
  filled_options = Kitsune::Kit::OptionsBuilder.build(
    options,
    required: [:server_ip],
    defaults: Kitsune::Kit::Defaults.system.merge(Kitsune::Kit::Defaults.ssh)
  )

  with_ssh_connection(filled_options) do |ssh|
    perform_rollback(ssh)
  end
end