Package backend :: Package server :: Package handlers :: Package xmlrpc :: Module registration :: Class Registration
[hide private]
[frames] | no frames]

Class Registration

source code


encapsulate functions that we will provide for the outside world

Instance Methods [hide private]
 
__init__(self) source code
 
reserve_user(self, username, password)
Get an username and a password and create a record for this user.
source code
 
new_user(self, username, password, email=None, org_id=None, org_password=None)
Finish off creating the user.
source code
 
validate_system_input(self, data)
check the input data
source code
 
validate_system_user(self, username, password) source code
 
create_system(self, user, profile_name, release_version, architecture, data)
Create a system based on the input parameters.
source code
 
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.
source code
 
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.
source code
 
get_possible_orgs(self, username, password)
Gets all the orgs that a user belongs to.
source code
 
activate_registration_number(self, username, password, key, other)
Entitle a particular org using an entitlement number.
source code
 
__findAssetTag(self, vendor, hardware_info)
Given some hardware information, we try to find the asset tag or serial number.
source code
 
__transform_vendor_to_const(self, vendor) source code
 
activate_hardware_info(self, username, password, hardware_info, other)
Given some hardware-based criteria per-vendor, try giving entitlements.
source code
 
attempt_eol_mailing(self, user, server) source code
 
send_serial(self, system_id, number, vendor=None)
Receive a vendor serial number from the client and tag it to the server.
source code
 
upgrade_version(self, system_id, newver)
Upgrade a certificate's version to a different release.
source code
 
add_packages(self, system_id, packages)
Add one or more package to the server profile.
source code
 
delete_packages(self, system_id, packages)
Delete one or more packages from the server profile
source code
 
delta_packages(self, system_id, packages) source code
 
virt_notify(self, system_id, actions)
This function fields virtualization-related notifications from the client and delegates them out to the appropriate downstream handlers.
source code
 
update_packages(self, system_id, packages)
This function will update the package list associated with a server to be exactly the list of packages passed on the argument list
source code
 
_normalize_packages(self, system_id, packages, allow_none=0)
the function checks if list of packages is well formated and also converts packages from old list of lists (extended_profile >= 2) to new list of dicts (extended_profile = 2)
source code
 
__add_hw_profile_no_auth(self, server, hwlist)
Insert a new profile for the server, but do not authenticate
source code
 
add_hw_profile(self, system_id, hwlist)
Insert a new profile for the server
source code
 
refresh_hw_profile(self, system_id, hwlist)
Recreate the server HW profile
source code
 
welcome_message(self, lang=None)
returns string of welcome message
source code
 
privacy_statement(self, lang=None)
returns string of privacy statement
source code
 
register_product(self, system_id, product, oeminfo={})
register a product and record the data sent with the registration
source code
 
update_contact_info(self, username, password, info={})
this API call is no longer used
source code
 
update_transactions(self, system_id, timestamp, transactions_hash)
Updates the RPM transactions
source code
 
anonymous(self, release=None, arch=None)
To reduce the number of tracebacks
source code
 
finish_message(self, system_id)
Presents the client with a message to display Returns: (returnCode, titleText, messageText) titleText is the window's title, messageText is the message displayed in that window by the client
source code
 
_get_dispatchers(self) source code
 
register_osad(self, system_id, args={}) source code
 
register_osad_jid(self, system_id, args={}) source code
 
available_eus_channels(self, username, password, arch, version, release, other=None)
Given a server arch, redhat-release version, and redhat-release release returns the eligible channels for that system based on the entitlements in the org specified by username/password
source code
 
remaining_subscriptions(self, username, password, arch, release)
This is an obsoleted API call used in old RHEL5 clients to determine if they should show the "activate a subscription" page.
source code
 
update_systemid(self, system_id)
update_systemid: update client server and certificate In case the calling system is not using a certificate with a SHA-256 checksum, update its secret and issue it a new client certificate.
source code

Inherited from spacewalk.server.rhnHandler.rhnHandler: auth_system

Inherited from spacewalk.common.RPC_Base.RPC_Base: get_function

Class Variables [hide private]
  _query_get_dispatchers = <spacewalk.server.rhnSQL.sql_base.Sta...
Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: spacewalk.common.RPC_Base.RPC_Base.__init__

reserve_user(self, username, password)

source code 

Get an username and a password and create a record for this user. Eventually mark it as such. Additionaly this method is used to verify login and password in early stage of rhn_register.

Returns true value if user is reserved, otherwise fault is raised.

new_user(self, username, password, email=None, org_id=None, org_password=None)

source code 

Finish off creating the user.

The user has to exist (must be already reserved), the password must match and we set the e-mail address if one is given

Return true if success

create_system(self, user, profile_name, release_version, architecture, data)

source code 

Create a system based on the input parameters.

Return dict containing a server object for now.
Called by new_system (< rhel5)
      and new_system_user_pass | new_system_activation_key (>= rhel5)

new_system(self, data)

source code 

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

new_system_user_pass(self, profile_name, os_release_name, version, arch, username, password, other)

source code 
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.

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.
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.

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

get_possible_orgs(self, username, password)

source code 
Gets all the orgs that a user belongs to.
In the OCS-future, users may belong to more than one org.

New for RHEL 5.

Returns a dict like:
{
    'orgs': {'19': 'Engineering', '4009': 'Finance'},
    'default_org': '19'
}
'orgs' must have at least one pair and 'default_org' must exist and point
to something in 'orgs'.

TODO Pick fault number for this and document it here
Fault:
* Bad credentials

activate_registration_number(self, username, password, key, other)

source code 
Entitle a particular org using an entitlement number.

New for RHEL 5.

username, password, and key are strings.
other is a dict with:
* org_id - optional. If it's not given, the user's default org is used.

Returns a dict:
{
    'status_code': <status code>,
    'registration_number': 'EN for this system'
    'channels' : channels,
    'system_slots' : system_slots
}
'status_code' must be 0 for "we just activated the key" or 1 for "this
key was already activated."
'registration_number' will be the EN corresponding to this activation. If
we activated an EN we'll get the same thing back. If we activate an OEM
number (eg asset tag) and maybe a pre-rhel 5 subscription number, we'll
get back the EN that was generated from it.
'channels' is a dict of the channel susbscriptions that the key activated
the key/value pairs are label (string) / quantity (int)
'system_slots' is a dict of the system slots that the key activated
the key/value pairs are label (string) / quantity (int)

TODO Assign fault values and document them here
Faults:
* Invalid key (600)
* Bad credentials (?) - covers bad username and password, bad org id, and
user not in specified org

__findAssetTag(self, vendor, hardware_info)

source code 

Given some hardware information, we try to find the asset tag or serial number.

See activate_hardware_info below for the structure of the hardware_info

activate_hardware_info(self, username, password, hardware_info, other)

source code 

Given some hardware-based criteria per-vendor, try giving entitlements.

New for RHEL 5.

Mostly the same stuff as activate_registration_number.
hardware_info is a dict of stuff we get from hal from
Computer -> system.* and smbios.*. For example:
{
    'system.product': '2687D8U ThinkPad T43',
    'system.vendor': 'IBM',
    'smbios.chassis.type': 'Notebook',
    ...
}

virt_notify(self, system_id, actions)

source code 

This function fields virtualization-related notifications from the client and delegates them out to the appropriate downstream handlers. The 'actions' argument is formatted as follows:

actions = [ ( timestamp, event, target, properties ), ... ]

register_product(self, system_id, product, oeminfo={})

source code 
register a product and record the data sent with the registration

bretm:  hasn't registered a product or recorded anything since 2001, near
  as I can tell what it actually appears to be responsible for is
  protecting us against people registering systems from t7/t9
  countries

  actual use of registration numbers has been moved into the
  server_class.__save stuff

finish_message(self, system_id)

source code 
Presents the client with a message to display
Returns:
(returnCode, titleText, messageText)
titleText is the window's title, messageText is the message displayed in
that window by the client

if returnCode is 1, the client
  will show the message in a window with the
  title of titleText, and allow the user to
  continue.
if returnCode is -1, the client
  will show the message in a window with the
  title of titleText, and not allow the user
  to continue
if returnCode is 0, no message
  screen will be shown.

available_eus_channels(self, username, password, arch, version, release, other=None)

source code 

Given a server arch, redhat-release version, and redhat-release release
returns the eligible channels for that system based on the entitlements
in the org specified by username/password

Returns a dict of the available channels in the format:
{'default_channel' : 'channel_label',
 'receiving_updates' : ['channel_label1', 'channel_label2'],
 'channels' : {'channel_label1' : 'channel_name1',
 'channel_lable2' : 'channel_name2'}
}


Class Variable Details [hide private]

_query_get_dispatchers

Value:
<spacewalk.server.rhnSQL.sql_base.Statement instance at 13998081113646\
4; statement=
        select jabber_id from rhnPushDispatcher