Class: ConfCtl::Cli::Swpins::Base

Inherits:
Command
  • Object
show all
Includes:
Utils
Defined in:
lib/confctl/cli/swpins/base.rb

Instance Attribute Summary

Attributes inherited from Command

#args, #gopts, #opts

Instance Method Summary collapse

Methods included from Utils

#channel_list, #cluster_name_list, #each_channel, #each_channel_spec, #each_cluster_name, #each_cluster_name_spec, #spec_set_msg, #spec_update_msg

Methods inherited from Command

#ask_action, #ask_confirmation, #ask_confirmation!, #initialize, #require_args!, run, #run_method, #use_color?, #use_pager?

Constructor Details

This class inherits a constructor from ConfCtl::Cli::Command

Instance Method Details

#reconfigureObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/confctl/cli/swpins/base.rb', line 14

def reconfigure
  each_channel('*') do |chan|
    if chan.valid?
      puts "Reconfiguring channel #{chan.name}"
      chan.save
    else
      puts "Channel #{chan.name} needs update"
      chan.specs.each do |name, s|
        puts "  update #{name}" unless s.valid?
      end
    end
  end

  each_cluster_name('*') do |cn|
    if cn.valid?
      puts "Reconfiguring machine #{cn.name}"
      cn.save
    else
      puts "Machine #{cn.name} needs update"
      cn.specs.each do |name, s|
        puts "  update #{name}" unless s.valid?
      end
    end
  end
end

#updateObject



8
9
10
11
12
# File 'lib/confctl/cli/swpins/base.rb', line 8

def update
  run_command(Swpins::Core, :update)
  run_command(Swpins::Channel, :update)
  run_command(Swpins::Cluster, :update)
end