Skip to content

Instantly share code, notes, and snippets.

@ncdc
Created October 3, 2013 16:07
Show Gist options
  • Save ncdc/6812363 to your computer and use it in GitHub Desktop.
Save ncdc/6812363 to your computer and use it in GitHub Desktop.
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