Bug 1336656 - needs a way to register system without channel assirned via /XMLRPC api
Summary: needs a way to register system without channel assirned via /XMLRPC api
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Registration
Version: 570
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 1141832
TreeView+ depends on / blocked
 
Reported: 2016-05-17 07:11 UTC by Jan Hutař
Modified: 2016-07-19 08:24 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-19 08:24:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2016-05-17 07:11:09 UTC
Description of problem:
When virt-who "registers" virtualization host (e.g. VMware ESX) to Satellite, by default it assigns RHEL6 channel (even if, say, MS Windows are running on the host).

To me, it looks like we do not have /XMLRPC api call to register system but do not assign a channel to it. normal user would use /rpc/api api to create activation key without channel assigned and then use that AK to register, but for virt-who it would be hard to use this approach as it currently uses only /XMLRPC api.


Version-Release number of selected component (if applicable):
5.7.0
spacewalk-backend-xmlrpc-2.3.3-39.el6sat.noarch


How reproducible:
always


Steps to Reproduce:
1. Found a way how to register system and do not assign it channel
   (so it does not consume channel entitlement) via /XMLRPC api


Actual results:
In /usr/share/rhn/server/handlers/xmlrpc/registration.py we have these 2 methods
(+ one commented out):

    def new_system(self, data):
        """
        This function expects at the INPUT a dictionary that has at least
        the following members: username, password, os_release, email
        If the username does not exist, it is created. If the username
        exists, then password is checked for a match.
        If all is well, we send back a server certificate.
        --
        Hash
        --
        Struct

        Starting with RHEL 5, the client will use activate_registration_number,
        activate_hardware_info, new_system_user_pass, and/or
        new_system_activation_key instead of this.

        In hosted, RHEL 4 and earlier will also call
        activate_registration_number
        """

    def new_system_user_pass(self, profile_name, os_release_name,
                             version, arch, username,
                             password, other):
        """ Registers a new system to an org specified by a username, password, and
            optionally an org id.

            New for RHEL 5.

            All args are strings except other.
            other is a dict with:
            * org_id - optional. Must be a string that contains the number. If it's
            not given, the default org is used.
            * reg_num - optional. It should be an EN. It will not be activated. It's
            used for automatic subscription to child channels and for deciding which
            service level to entitle the machine to (managment, provisioning, etc).
            If not given, the machine will only be registered to a base channel and
            entitled to the highest level possible.

            If a profile is created it will return a dict with:
            * system_id - the same xml as was previously returned
            * channels - a list of the channels (as strings) the system was
              subscribed to
            * failed_channels - a list of channels (as strings) that
              the system should have been subscribed to but couldn't be because they
              don't have the necessary entitlements available. Can contain all the
              channels including the base channel.
            * system_slots - a list of the system slots used (as strings).
            * failed_system_slots - a list of system slots (as strings) that they
              should have used but couldn't because there weren't available
              entitlements
            * universal_activation_key - a list of universal default activation keys
              (as strings) that were used while registering.
            Allowable slots are 'enterprise_entitled' (management), 'sw_mgr_entitled'
            (updates), 'monitoring_entitled' (monitoring add on to management), and
            provisioning_entitled (provisioning add on to management).
            The call will try to use the highest system slot available. An entry will
            be added to failed_system_slots for each one that is tried and fails and
            system_slots will contain the one that succeeded if any.
            Eg: Calling this on hosted with no reg num and only update entitlements
            will result in system_slots containing 'sw_mgr_entitled' and
            failed_system_slots containing 'enterprise_entitled'.

            If an error occurs which prevents the creation of a profile, a fault will
            be raised:
            TODO
        """

    # Registers a new system to an org specified by an activation key.
    #
    # New for RHEL 5.
    #
    # See documentation for new_system_user_pass. This behaves the same way
    # except it takes an activation key instead of username, password, and
    # maybe org id.
##    def new_system_activation_key(self, profile_name, os_release_name,
##                                  os_release_version, arch, activation_key, other):
##        return { 'system_id' : self.new_system({'profile_name' : profile_name,
##                                                'os_release' : os_release_version,
##                                                'release_name' : os_release_name,
##                                                'architecture' : arch,
##                                                'token' : activation_key,
##                                                }),
##                 'channels' : ['UNDER CONSTRUCTION'],
##                 'failed_channels' : ['UNDER CONSTRUCTION'],
##                 'system_slots' : ['UNDER CONSTRUCTION'],
##                 'failed_system_slots' : ['UNDER CONSTRUCTION'],
##                 }


Expected results:
Something like

    def new_system_user_pass_bare(self, profile_name, username, password, other):

Comment 1 Jan Hutař 2016-05-17 07:12:15 UTC
Please let me know if this does make sense and as this is a python code, I guess I can create pull request.

Comment 2 Radek Novacek 2016-07-19 08:24:09 UTC
I've already solved this by creating new channel (using /rpc/api) just for virt-who host registration, see bug #1141832.

Suggested changes are no longer necessary, closing as NOTABUG.


Note You need to log in before you can comment on or make changes to this bug.