Class: Porkadot::Cmd::Etcd::Cli
- Inherits:
-
SubCommandBase
- Object
- Thor
- SubCommandBase
- Porkadot::Cmd::Etcd::Cli
- Includes:
- Utils
- Defined in:
- lib/porkadot/cmd/etcd.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Utils
Methods inherited from SubCommandBase
Class Method Details
.subcommand_prefix ⇒ Object
63 64 65 |
# File 'lib/porkadot/cmd/etcd.rb', line 63 def self.subcommand_prefix 'etcd' end |
Instance Method Details
#all ⇒ Object
8 9 10 |
# File 'lib/porkadot/cmd/etcd.rb', line 8 def all "Use restore or backup sub commands." end |
#backup ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/porkadot/cmd/etcd.rb', line 15 def backup require 'date' filename = "etcd-#{DateTime.now.to_s}.db" path = File.join([:path], filename) logger.info "Backing up etcd data to #{path}" kubelets = Porkadot::Install::KubeletList.new(self.config) kubelets.backup_etcd host: [:node], path: path "" end |
#restore ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/porkadot/cmd/etcd.rb', line 47 def restore invoke :stop, [], path = Dir.glob(File.join([:path], "etcd-*.db")).sort.reverse[0] unless path return "No backup data found...: #{[:path]}" end logger.info "Restore etcd from #{path}" kubelets = Porkadot::Install::KubeletList.new(self.config) kubelets.restore_etcd path: path invoke :start, [], "" end |
#start ⇒ Object
29 30 31 32 33 34 |
# File 'lib/porkadot/cmd/etcd.rb', line 29 def start logger.info "Start etcd" kubelets = Porkadot::Install::KubeletList.new(self.config) kubelets.start_etcd hosts: [:node] "" end |
#stop ⇒ Object
38 39 40 41 42 43 |
# File 'lib/porkadot/cmd/etcd.rb', line 38 def stop logger.info "Start etcd" kubelets = Porkadot::Install::KubeletList.new(self.config) kubelets.stop_etcd hosts: [:node] "" end |