class SwarmClusterCliOpe::Kubernetes::Configuration
Public Instance Methods
context()
click to toggle source
In kubernetes abbiamo il context, il context può essere ricevuto o dalla configurazione oppure dal current_context di kubelet @return [String]
# File lib/swarm_cluster_cli_ope/kubernetes/configuration.rb, line 15 def context context = merged_configurations.dig(:connections_maps,:context) || nil if context.nil? cmd = ShellCommandExecution.new(['kubectl config current-context']) context = cmd.execute.raw_result[:stdout] unless yes? "Attenzione, non era presente il contesto nelle configurazioni, usiamo quello attualmente in uso: #{context}, proseguiamo lo stesso?[y,yes]" exit end end context end
get_syncro(name)
click to toggle source
Funzione per la restituzione della classe di sincro corretta
# File lib/swarm_cluster_cli_ope/kubernetes/configuration.rb, line 45 def get_syncro(name) case name when 'sqlite3' SyncConfigs::Sqlite3 when 'rsync' SyncConfigs::Rsync when 'mysql' SyncConfigs::Mysql when 'pg' SyncConfigs::PostGres else logger.error { "CONFIGURAIONE NON PREVISTA in K8S: #{name}" } nil end end
save_base_cfgs()
click to toggle source
Salva le configurazioni base in HOME
Calls superclass method
SwarmClusterCliOpe::BaseConfiguration#save_base_cfgs
# File lib/swarm_cluster_cli_ope/kubernetes/configuration.rb, line 32 def save_base_cfgs super do |obj| obj.merge({connections_maps: {context: context}}) end end
shell()
click to toggle source
# File lib/swarm_cluster_cli_ope/kubernetes/configuration.rb, line 5 def shell @_shell = Thor::Shell::Basic.new end
Private Instance Methods
evaluate_correct_command_usage(configuration)
click to toggle source
# File lib/swarm_cluster_cli_ope/kubernetes/configuration.rb, line 63 def evaluate_correct_command_usage(configuration) unless configuration[:connections_maps].keys.include?(:context) puts "ATTENZIONE, I COMANDI NON DEVONO ESSERE LANCIATI DAL SUB COMANDO K8S" exit end end