Sha256: 3ea306fbba8df889721cb83a8bbf701f8118ac34b0e94d9f15fb8147776f02aa

Contents?: true

Size: 797 Bytes

Versions: 5

Compression:

Stored size: 797 Bytes

Contents

module Kakine
  class Director
    class << self
      def show_current_security_group
        puts Kakine::Builder.security_groups
      end

      def apply
        current_sgs = Kakine::Resource.get(:openstack).load_security_group
        new_sgs     = Kakine::Resource.get(:yaml).load_security_group
        new_sgs.each do |new_sg|
          if already_sg = Kakine::Builder.already_setup_security_group(new_sg, current_sgs)
            Kakine::Builder.convergence_security_group(new_sg, already_sg) if new_sg != already_sg
          else
            Kakine::Builder.first_create_security_group(new_sg)
          end
        end

        Kakine::Builder.clean_up_security_group(new_sgs, current_sgs)

        rescue Kakine::Error => e
          puts "[error] #{e}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kakine-0.6.2 lib/kakine/director.rb
kakine-0.6.1 lib/kakine/director.rb
kakine-0.6.0 lib/kakine/director.rb
kakine-0.5.0 lib/kakine/director.rb
kakine-0.4.0 lib/kakine/director.rb