Created
October 3, 2013 16:07
-
-
Save ncdc/6812363 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def with_gear_rotation(options={}, &block) | |
local_gear_env = ::OpenShift::Runtime::Utils::Environ.for_gear(@container_dir) | |
proxy_cart = options[:proxy_cart] = @cartridge_model.web_proxy | |
gears = [] | |
if proxy_cart | |
if options[:all] | |
gears = gear_registry.entries[:web].values | |
elsif options[:gears] | |
gears = gear_registry.entries[:web].select { |k,v| options[:gears].include?(k) }.values | |
else | |
# it's possible the gear registry hasn't been populated yet (scale-up that adds a new proxy cart) | |
# so if gear_registry.entries[:web] is nil, just use [uuid] instead | |
gears = [gear_registry.entries[:web][uuid]] rescue [uuid] | |
end | |
else | |
gears = [uuid] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment