I ran across this doing the gear size change in sprint 2.0.7 and gear name change in 2.0.8. We'll likely have scalable apps on prod for the next migration. The method of app.gear provides access to the first gear object of an application which should be fine for non-scalable apps. The following will work on both non-scalable and scalable apps. Access all the gears for an app: users = CloudUser.find_all(nil) users.each do |user| user.applications.each do |app| app.group_instances.each do |gi| gi.gears.each do |gear| # Do something with gear end end end end An example for the migrate-mongo script: users = $coll.find() users.each do |user| user["apps"].each do |app| app["group_instances"].each do |gi| gi['gears'].each do |gear| # Do something with gear end end end end
I know move is also broken with multiple gears.
Change is in place for migrate-2.0.10
Verified this bug with migrate-2.0.10, and PASS. # ./misc/maintenance/bin/migrate-2.0.10 Getting all RHLogins... RHLogins.length: 1 Gathering gears for user: jialiu with uuid: 677aecc95a5842b3be4bdbe1d908e7a7 ##################################################### Gear Counts Per Thread: [6] ##################################################### Writing 6 gears for node ip-10-118-62-130 to file /tmp/rhc/migration/migrate_ip-10-118-62-130 Migrating gears on node ip-10-118-62-130 Migrating app 'racktest' gear 'racktest' with uuid 'f3b6852be0a845999644667bc9af2a81' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'f3b6852be0a845999644667bc9af2a81' --app-name 'racktest' Migrating app 'myapp' gear 'myapp' with uuid 'fdce01211cb04c1289c6ab1962f765ad' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'fdce01211cb04c1289c6ab1962f765ad' --app-name 'myapp' Migrating app 'myapp' gear 'db3f446eae' with uuid 'db3f446eaec2416188f985eb2ce054a6' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'db3f446eaec2416188f985eb2ce054a6' --app-name 'myapp' Migrating app 'pytest' gear 'd110691aa3' with uuid 'd110691aa38d4899b6f0f73bd57e5c55' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'd110691aa38d4899b6f0f73bd57e5c55' --app-name 'pytest' Migrating app 'pytest' gear 'd78ff4395c' with uuid 'd78ff4395cc24713b36e9813475aac63' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear 'd78ff4395cc24713b36e9813475aac63' --app-name 'pytest' Migrating app 'pytest' gear 'pytest' with uuid '6eb29d43851a477fa4eaadf065bd85ff' on node 'ip-10-118-62-130' for user: jialiu Migrating gear on node with: ./misc/maintenance/bin/migrate-2.0.10 --rhlogin 'jialiu' --migrate-gear '6eb29d43851a477fa4eaadf065bd85ff' --app-name 'pytest' ##################################################### Summary: # of users: 1 # of gears: 6 # of failures: 0 Gear counts per thread: [6] Total execution time: 34s #####################################################