Sha256: f191e094295dce8883fcc8f98f45773d75f3d135294b2bb38ea3450fb4a39026

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

require 'confctl/cli/command'
require 'confctl/cli/swpins/utils'

module ConfCtl::Cli
  class Swpins::Base < Command
    include Swpins::Utils

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

    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
confctl-2.0.0 lib/confctl/cli/swpins/base.rb
confctl-1.0.0 lib/confctl/cli/swpins/base.rb