30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/kitsune/kit/commands/setup_user.rb', line 30
def rollback
filled_options = Kitsune::Kit::OptionsBuilder.build(
options,
required: [:server_ip],
defaults: Kitsune::Kit::Defaults.ssh
)
server = filled_options[:server_ip]
port = filled_options[:ssh_port]
key = File.expand_path(filled_options[:ssh_key_path])
begin
with_ssh_connection(true, filled_options) do |ssh|
perform_rollback_config(ssh)
end
rescue StandardError => e
say "⚠️ Skipping SSH config restore: #{e.message}", :yellow
end
say "🔑 Reconnecting as root@#{server}:#{port}", :green
Net::SSH.start(server, 'root', port: port, keys: [key], non_interactive: true) do |ssh|
perform_rollback_cleanup(ssh)
end
say "✅ Rollback completed", :green
end
|