Module: Bcome::FogHelper
- Included in:
- Stack::Environment
- Defined in:
- lib/helpers/fog_helper.rb
Instance Method Summary collapse
- #credentials_key ⇒ Object
- #ec2_tags ⇒ Object
- #filter_by_tags(instances) ⇒ Object
- #fog_client ⇒ Object
- #instance_matches_tags?(instance) ⇒ Boolean
- #servers ⇒ Object
- #unfiltered_servers ⇒ Object
Instance Method Details
#credentials_key ⇒ Object
3 4 5 |
# File 'lib/helpers/fog_helper.rb', line 3 def credentials_key network_lookup[:credentials_key] end |
#ec2_tags ⇒ Object
15 16 17 |
# File 'lib/helpers/fog_helper.rb', line 15 def network_lookup[:ec2_tag_filter] end |
#filter_by_tags(instances) ⇒ Object
34 35 36 |
# File 'lib/helpers/fog_helper.rb', line 34 def (instances) return instances.select{|instance| (instance)} end |
#fog_client ⇒ Object
7 8 9 |
# File 'lib/helpers/fog_helper.rb', line 7 def fog_client @fog_client ||= get_fog_client end |
#instance_matches_tags?(instance) ⇒ Boolean
38 39 40 41 |
# File 'lib/helpers/fog_helper.rb', line 38 def (instance) = instance. return .select{|key, value| [key.to_s] == value }.size == .keys.size end |
#servers ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/helpers/fog_helper.rb', line 19 def servers all = unfiltered_servers = ? (all) : all custom_filter_method = @meta_data[:network_lookup][:custom_post_process_filter_method] if custom_filter_method filter = ::Bcome::Filter::Ec2Filter.new(, self) raise "Custome filter method #{custom_filter_method} is missing. Make sure you've added it".failure unless filter.respond_to?(custom_filter_method.to_sym) return filter.send(custom_filter_method.to_sym) else return end end |
#unfiltered_servers ⇒ Object
11 12 13 |
# File 'lib/helpers/fog_helper.rb', line 11 def unfiltered_servers @unfiltered_servers ||= fog_client.servers.all(network_lookup[:ec2_server_lookup_filters]) end |