Sha256: 281488c7cdc991e9e4ff2dc69dadf8dbe6816d4c014acb356b2291b0cf1f1278

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

class Chef
  class Recipe
    # Return which instance is to have redis installed on it
    # This is determind as follows:
    #   1. A utility prefixed with 'resque'
    #   2. A solo
    # Returns array of hash of instance data, including { "id" => "i-123456", }
    def resque_instances
      @resque_instances ||= node[:engineyard][:environment][:instances].find do |x|
        x[:role] == "solo" || node[:instance_role] == "eylocal" || 
                        (node[:role] == "util" && node[:name] =~ /^(resque)/)
      end
    end
    
    # Does this instance run resque?
    def resque_instance?
      node[:instance_role] == "solo" || node[:instance_role] == "eylocal" || 
              (node[:instance_role] == "util" && node[:name] =~ /^(resque)/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eycloud-recipe-resque-1.1.1 libraries/find_resque_instances.rb
eycloud-recipe-resque-1.1.0 libraries/find_resque_instances.rb