Class: Kakine::Director
- Inherits:
-
Object
- Object
- Kakine::Director
- Defined in:
- lib/kakine/director.rb
Class Method Summary collapse
Class Method Details
.apply ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kakine/director.rb', line 8 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 |
.convert(format, output = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/kakine/director.rb', line 25 def convert(format, output = nil) sgs = Kakine::Resource.get(:yaml).load_security_group file = output ? open(output, 'w') : $stdout.dup begin exporter = Kakine::Exporter.get(format).new(file) exporter.export(sgs) ensure file.close end end |
.show_current_security_group ⇒ Object
4 5 6 |
# File 'lib/kakine/director.rb', line 4 def show_current_security_group puts Kakine::Builder.security_groups end |