Description of problem: Seems that subscription-manager fails to register a system if the associated Organization has multiple environments. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Create a new Org 2. Add a new environment named Base, linked to Locker 3. Add new environment named Test, also linked to Locker 4. Associate the admin user with this Organization 5. In the client, register it with subscription-manager register --force --username=admin --password=****** Actual results: Right now the output I get from the command above is "displayMessage", but looking at katello's production.log I found: Traceback: Started POST "/katello//api/consumers/" for 10.16.120.146 at Thu Dec 08 15:11:54 -0500 2011 Processing by Api::SystemsController#create as JSON Parameters: {"facts"=>{"dmi.bios.relase_date"=>"01/01/2007", "net.interface.lo.ipaddr"=>"127.0.0.1", "network.hostname"=>"client-og-1.usersys.redhat.com", "cpu.hypervisor_vendor"=>"KVM", "system.entitlements_valid"=>false, "dmi.memory.type"=>"RAM", "dmi.bios.address"=>"0xe8000", "net.interface.eth2.broadcast"=>"10.16.120.255", "dmi.bios.runtime_size"=>"96 KB", "distribution.id"=>"Santiago", "dmi.memory.maximum_capacity"=>"3 GB", "dmi.chassis.asset_tag"=>"Not Specified", "dmi.memory.bank_locator"=>"Not Specified", "cpu.virtualization_type"=>"full", "dmi.system.wake-up_type"=>"Power Switch", "dmi.chassis.boot-up_state"=>"Safe", "distribution.name"=>"Red Hat Enterprise Linux Server", "cpu.thread(s)_per_core"=>"1", "dmi.chassis.manufacturer"=>"Red Hat", "dmi.bios.bios_revision"=>"1.0", "dmi.chassis.version"=>"Not Specified", "distribution.version"=>"6.1", "uname.version"=>"#1 SMP Tue May 10 15:42:40 EDT 2011", "net.interface.lo.hwaddr"=>"00:00:00:00:00:00", "dmi.memory.error_correction_type"=>"Multi-bit ECC", "dmi.bios.vendor"=>"Seabios", "dmi.memory.locator"=>"DIMM 0", "dmi.system.manufacturer"=>"Red Hat", "net.interface.eth2.hwaddr"=>"52:54:00:fc:ba:e4", "dmi.chassis.serial_number"=>"Not Specified", "dmi.bios.rom_size"=>"64 KB", "cpu.stepping"=>"3", "uname.release"=>"2.6.32-131.0.15.el6.x86_64", "dmi.system.uuid"=>"cde1a796-c280-08fe-fd33-083cca9c8db7", "dmi.memory.array_handle"=>"0x1000", "cpu.cpu_op-mode(s)"=>"32-bit, 64-bit", "dmi.memory.data_width"=>"64 bit", "memory.swaptotal"=>"4128760", "net.interface.lo.broadcast"=>"0.0.0.0", "dmi.chassis.lock"=>"Not Present", "cpu.cpu_mhz"=>"2133.266", "dmi.memory.speed"=>" (ns)", "net.interface.eth2.ipaddr"=>"10.16.120.146", "uname.machine"=>"x86_64", "dmi.memory.form_factor"=>"DIMM", "dmi.memory.total_width"=>"64 bit", "cpu.l1d_cache"=>"32K", "virt.is_guest"=>true, "cpu.cpu(s)"=>"2", "net.interface.lo.netmask"=>"255.0.0.0", "dmi.memory.error_information_handle"=>"Not Provided", "net.interface.eth2.netmask"=>"255.255.255.0", "cpu.architecture"=>"x86_64", "cpu.vendor_id"=>"GenuineIntel", "dmi.processor.upgrade"=>"Other", "dmi.system.sku_number"=>"Not Specified", "cpu.bogomips"=>"4266.53", "dmi.memory.location"=>"Other", "dmi.chassis.thermal_state"=>"Safe", "cpu.l2_cache"=>"4096K", "dmi.system.serial_number"=>"Not Specified", "cpu.cpu_socket(s)"=>"2", "dmi.processor.voltage"=>" ", "uname.sysname"=>"Linux", "dmi.system.family"=>"Red Hat Enterprise Linux", "cpu.model"=>"13", "uname.nodename"=>"client-og-1.usersys.redhat.com", "dmi.processor.version"=>"Not Specified", "dmi.chassis.power_supply_state"=>"Safe", "dmi.memory.use"=>"System Memory", "dmi.system.version"=>"RHEL 6.1.0 PC", "memory.memtotal"=>"3090048", "cpu.on-line_cpu(s)_list"=>"0,1", "dmi.system.status"=>"No errors detected", "dmi.bios.version"=>"0.5.1", "cpu.numa_node(s)"=>"1", "dmi.chassis.security_status"=>"Unknown", "virt.host_type"=>"kvm", "cpu.l1i_cache"=>"32K", "dmi.system.product_name"=>"KVM", "dmi.chassis.type"=>"Other", "dmi.processor.type"=>"Central Processor", "dmi.processor.socket_designation"=>"CPU 1", "cpu.byte_order"=>"Little Endian", "dmi.processor.status"=>"Populated:Enabled", "cpu.numa_node0_cpu(s)"=>"0,1", "cpu.core(s)_per_socket"=>"1", "dmi.memory.size"=>"3072 MB", "network.ipaddr"=>"127.0.0.1", "dmi.processor.family"=>"Other", "cpu.cpu_family"=>"6"}, "name"=>"client-og-1.usersys.redhat.com", "type"=>"system"} *** ERROR: Organization NY Data Server has more than one environment. Please specify target environment for system registration. (400) *** REQUEST URL: /katello/api/consumers HttpErrors::BadRequest: Organization NY Data Server has more than one environment. Please specify target environment for system registration. /usr/share/katello/app/controllers/api/systems_controller.rb:183:in `find_only_environment' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:453:in `_run__2061323016__process_action__1623385099__callbacks' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:221:in `_conditional_callback_around_2231' /usr/share/katello/lib/util/threadsession.rb:79:in `thread_locals' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:220:in `_conditional_callback_around_2231' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:441:in `_run__2061323016__process_action__1623385099__callbacks' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `send' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `send' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:94:in `run_callbacks' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/callbacks.rb:17:in `process_action' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rescue.rb:17:in `process_action' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:30:in `process_action' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/instrumentation.rb:29:in `process_action' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:138:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_controller/metal.rb:178:in `action' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:62:in `dispatch' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:27:in `call' /usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:150:in `call' /usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:93:in `recognize' /usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:89:in `optimized_each' /usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/code_generation.rb:92:in `recognize' /usr/lib/ruby/gems/1.8/gems/rack-mount-0.7.1/lib/rack/mount/route_set.rb:141:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/routing/route_set.rb:493:in `call' /usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:35:in `call' /usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:34:in `catch' /usr/lib/ruby/gems/1.8/gems/warden-1.0.3/lib/warden/manager.rb:34:in `call' /usr/lib/ruby/gems/1.8/gems/sass-3.1.7/lib/sass/../sass/plugin/rack.rb:54:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/head.rb:14:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/methodoverride.rb:24:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/params_parser.rb:21:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/flash.rb:182:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/cookies.rb:302:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:32:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:12:in `cache' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/query_cache.rb:31:in `call' /usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:46:in `call' /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:416:in `_run_call_callbacks' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/callbacks.rb:44:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/sendfile.rb:102:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/remote_ip.rb:48:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/rack/logger.rb:13:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/runtime.rb:17:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/lock.rb:34:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/middleware/static.rb:30:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:168:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `send' /usr/lib/ruby/gems/1.8/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:52:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `each' /usr/lib/ruby/gems/1.8/gems/rack-1.3.0/lib/rack/urlmap.rb:46:in `call' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:84:in `pre_process' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data' /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine' /usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/server.rb:159:in `start' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in `start' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!' /usr/lib/ruby/gems/1.8/gems/thin-1.2.11/bin/thin:6 /usr/share/katello/script/thin:59:in `load' /usr/share/katello/script/thin:59 Completed 400 Bad Request in 22ms (Views: 1.7ms | ActiveRecord: 2.7ms) Expected results: Additional info:
commit f5384c97649530829140ea3567b9ac0267239f66 Merge: db2a027 a0c0230 Author: Tom McKay <thomasmckay> Date: Fri Dec 9 09:22:04 2011 -0500 The cause of this error was due to the user's default org/env was not being used. To reproduce, simply omit the --org and --environment arguments when using subscription-manager to register.
Still broken when the org has multiple environments.
commit a1f7cba138dcaa1636a1ab07616194e39e3dc876 Author: Tom McKay <thomasmckay> Date: Fri Dec 16 09:32:53 2011 -0500 Bug 761710 - Registration fails if Organization has multiple environments https://bugzilla.redhat.com/show_bug.cgi?id=761710 + Comment from code... # Some subscription-managers will call /users/$user/owners to retrieve the orgs that a user belongs to. # Then, If there is just one org, that will be passed to the POST /api/consumers as the owner. To handle # this scenario, if the org passed in matches the user's default org, use the default env. If not use # the single env of the org or throw an error if more than one.
# VERIFIED Following cases are checked: 1. for a user_org1 is assigned the default org: org1 (has one env. only) 2. for a user_org1 there is no default org 3. for a user_org1 there is providing the org=org1 (but there is getting created one more env.) results: 1. providing no --org & --environment options works. System get registered to the org1 and its default env (let's say: Base) 2. without providing env and org options fails: --> You have not set a default organization and environment on the user user_org1. So providing --org=org1 option works (as org1 still have one "default" env and its beeing used) 3. creating another env: Test brings the command to fail (subscription-manager register --username user_org1 --password <masked> --org=org1) --> Organization org1 has more than one environment. Please specify target environment for system registration. So providing --environment=Base does the thing. checked against: katello-0.1.174-2.el6.noarch katello-cli-0.1.35-1.el6.noarch pulp-0.0.256-1.el6.noarch candlepin-0.5.8-1.el6.noarch subscription-manager-0.98.3-1.el6.x86_64