backend/server/handlers/xmlrpc/registration.py | 98 -----------
backend/server/rhnUser.py | 96 ----------
client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py | 13 -
client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py | 39 ----
client/rhel/rhn-client-tools/src/up2date_client/tui.py | 27 ---
client/solaris/rhnclient/rhn/client/rhnReg.py | 2
client/solaris/rhnclient/rhnreg_ks.py | 2
7 files changed, 8 insertions(+), 269 deletions(-)
New commits:
commit 280dee0e0949b89ff1d29f71a37cdb71cd2d5766
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:37:35 2012 +0200
__save() is dead
since user.save() removal
diff --git a/backend/server/rhnUser.py b/backend/server/rhnUser.py
index 7a92315..8434893 100644
--- a/backend/server/rhnUser.py
+++ b/backend/server/rhnUser.py
@@ -218,86 +218,6 @@ class User:
log_error("SET_INFO: Unknown info `%s' = `%s'" % (name,
value))
return 0
- def __save(self):
- """ Save this record in the database. """
- is_admin = 0
- if not self.customer.real:
- # an org does not exist... create one
- create_new_org = rhnSQL.Procedure("create_new_org")
- ret = create_new_org(
- self.customer["name"],
- self.customer["password"],
- None, None, "B",
- rhnSQL.types.NUMBER(),
- rhnSQL.types.NUMBER(),
- rhnSQL.types.NUMBER(),
- )
- org_id, adm_grp_id, app_grp_id = ret[-3:]
- # We want to make sure we set the group limits right
- tbl = rhnSQL.Row("rhnUserGroup", "id")
- # Set the default admin limits to Null
- tbl.load(adm_grp_id)
- # bz:210230: this value should default to Null
- tbl.save()
- # Set the default applicats limit to 0
- tbl.load(app_grp_id)
- tbl["max_members"] = 0
- tbl.save()
- # reload the customer table
- self.customer.load(org_id)
- # and finally, we put this one in the admin group
- grp_id = adm_grp_id
- is_admin = 1
-
- # save the contact
- if self.contact.real:
- if not self.contact["org_id"]:
- raise rhnException("Undefined org_id for existing user entry",
- self.contact.data)
- userid = self.contact["id"]
- self.contact.save()
- else:
- userid = self.getid()
- self.contact["org_id"] = org_id
- # if not admin, obfuscate the password
- # (and leave the old_password set)
- if not is_admin: # we only do this for new users.
- log_debug(5, "Obfuscating user password")
- user_pwd = self.contact["password"]
- crypt_pwd = crypt.crypt(user_pwd, str(userid)[-2:])
- self.contact["password"] = crypt_pwd
- self.contact.create(userid)
- # rhnUserInfo
- h = rhnSQL.prepare("insert into rhnUserInfo (user_id) "
- "values (:user_id)")
- h.execute(user_id=userid)
- # now add this user to the admin/applicant group for his org
- create_ugm = rhnSQL.Procedure("rhn_user.add_to_usergroup")
- # grp_id is the admin or the applicant, depending on whether we
- # just created the org or not
- create_ugm(userid, grp_id)
- # and now reload this data
- self.contact.load(userid)
-
- # do the same for the other structures indexed by web_user_id
- # personal info
- if self.info.real: self.info.save()
- else: self.info.create(userid)
- # contact permissions
- if self.perms.real: self.perms.save()
- else: self.perms.create(userid)
-
- # And now save the site information
- if self.site.real:
- siteid = self.site["id"]
- self.site.save()
- else:
- siteid = rhnSQL.Sequence("web_user_site_info_id_seq")()
- self.site["web_user_id"] = userid
- self.site.create(siteid)
-
- return 0
-
def get_roles(self):
user_id = self.getid()
commit b55d726f16d52e52570dfec28c0db125c4e9539b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:35:30 2012 +0200
removing dead user.save()
user information can't be modified from backend XMLRPC
diff --git a/backend/server/rhnUser.py b/backend/server/rhnUser.py
index d347f91..7a92315 100644
--- a/backend/server/rhnUser.py
+++ b/backend/server/rhnUser.py
@@ -312,22 +312,6 @@ class User:
""")
h.execute(user_id=user_id)
return map(lambda x: x['role'], h.fetchall_dict() or [])
-
- def save(self):
- """ This is a wrapper for the above class that allows us to
rollback
- any changes in case we don't succeed completely.
- """
- log_debug(3, self.username)
- rhnSQL.commit()
- try:
- self.__save()
- except:
- rhnSQL.rollback()
- # shoot the exception up the chain
- raise
- else:
- rhnSQL.commit()
- return 0
def reload(self, user_id):
""" Reload the current data from the SQL database using the given
id """
commit 8d84c16561f018699d146fe016c64c46c9408179
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:32:19 2012 +0200
removed unsed __save_user*() functions
updateContactInfo() was the only place where they was called
diff --git a/backend/server/handlers/xmlrpc/registration.py
b/backend/server/handlers/xmlrpc/registration.py
index be1eeb2..84dda3e 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -1048,18 +1048,6 @@ class Registration(rhnHandler):
self.auth_system(system_id)
return 0
- def __save_user(self, user):
- """ Moved the saving of the user out to a common method
- so that we can save to the db in a satellite.
-
- It is called from the update_contact_info.
- """
- self.__save_user_db(user)
-
- def __save_user_db(self, user):
- """ Saves the user to the database. """
- user.save()
-
def update_contact_info(self, username, password, info={}):
""" this API call is no longer used """
log_debug(5, username, info)
commit 5c076945093c2d598b56f2c076a3317361cf9c93
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:29:40 2012 +0200
update_contact_info is not called from client for a long time
let's preserve just stub for compatibility
diff --git a/backend/server/handlers/xmlrpc/registration.py
b/backend/server/handlers/xmlrpc/registration.py
index 6ac5bba..be1eeb2 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -1061,8 +1061,8 @@ class Registration(rhnHandler):
user.save()
def update_contact_info(self, username, password, info={}):
+ """ this API call is no longer used """
log_debug(5, username, info)
- contact_info = info.copy()
username, password = str(username), str(password)
user = rhnUser.search(username)
if user is None:
@@ -1073,42 +1073,6 @@ class Registration(rhnHandler):
log_error("User password check failed", username)
raise rhnFault(2)
- import states
- import country
- val = contact_info.get('state')
- if val and states.states_to_abbr.has_key(val):
- contact_info['state'] = states.states_to_abbr[val]
- val = contact_info.get('country')
- if val:
- if (country.t9_countries.has_key(val) or
- val in country.t9_countries.values()):
- raise rhnFault(30, _("Not a valid Country: %s") %
- val)
- if country.country_to_iso.has_key(val):
- contact_info['country'] = country.country_to_iso[val]
- elif val not in country.country_to_iso.values():
- # Invalid country, assume US
- contact_info['country'] = 'US'
-
- contact_perm_keys = ["contact_phone", "contact_mail",
- "contact_email", "contact_fax", ]
- for k in contact_perm_keys:
- val = contact_info.get(k)
- if val is not None:
- log_debug(6, "Contact", k, val)
- user.set_contact_perm(k, val)
-
- info_keys = ["first_name", "last_name", "company",
"phone",
- "fax", "title", "position",
- "city", "zip", "address1",
"address2", "country", "state", ]
- for k in info_keys:
- val = contact_info.get(k)
- if val is not None:
- log_debug(6, "Info", k, val)
- user.set_info(k, val)
-
- # save the user either to the database or the UserService
- self.__save_user(user)
return 0
def update_transactions(self, system_id, timestamp, transactions_hash):
commit 6845781e3a00a253d504fcff0c440850886df55a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:26:22 2012 +0200
removed dead registerProduct() and updateContactInfo()
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 590bd07..64e6c38 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -457,15 +457,6 @@ def registerSystem2(username = None, password = None,
rawDict=info)
return result
-
-def registerProduct(systemId, productInfo):
- s = rhnserver.RhnServer()
- s.registration.register_product(systemId, productInfo)
-
-def updateContactInfo(username, password, productInfo):
- s = rhnserver.RhnServer()
- s.registration.update_contact_info(username, password, productInfo)
-
def server_supports_eus():
return cfg["supportsEUS"]
commit b36d3ab7a227e8380d050fd030eab6e97d685009
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:23:42 2012 +0200
removed dead code
system is always 'alreadyRegistered' in rhnreg.registerSystem2()
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
index 40f0a3e..867c9b6 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
@@ -902,32 +902,6 @@ class SendingWindow:
# include the info from the oeminfo file as well
self.oemInfo = rhnreg.getOemInfo()
- # dont send if already registered, do send if they have oemInfo
- if ( not self.tui.alreadyRegistered ) or ( len(self.oemInfo)):
- # send product registration information
- if rhnreg.cfg['supportsUpdateContactInfo']:
- try:
- rhnreg.updateContactInfo(self.tui.userName, self.tui.password,
self.tui.productInfo)
- except up2dateErrors.CommunicationError, e:
- FatalErrorWindow(self.screen, _("Problem registering personal
information:\n") + e.errmsg)
- except:
- print sys.exc_info()
- print sys.exc_type
-
- FatalErrorWindow(self.screen,
- _("Problem registering personal
information"))
-
- else:
- try:
- rhnreg.registerProduct(systemId, self.tui.productInfo)
- except up2dateErrors.CommunicationError, e:
- FatalErrorWindow(self.screen,
- _("Problem registering personal
information:\n") +
- e.errmsg)
- except:
- log.log_exception(*sys.exc_info())
- FatalErrorWindow(self.screen, _("Problem registering personal
information"))
-
self.setScale(2, 4)
# maybe upload hardware profile
commit ddf73f5781a13004a27fc7accd6bbd2b94627de3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:17:16 2012 +0200
removed unused argument oemInfo
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index d3b4166..590bd07 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -458,7 +458,7 @@ def registerSystem2(username = None, password = None,
return result
-def registerProduct(systemId, productInfo, oemInfo={}):
+def registerProduct(systemId, productInfo):
s = rhnserver.RhnServer()
s.registration.register_product(systemId, productInfo)
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
index 8e2aca2..40f0a3e 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
@@ -919,7 +919,7 @@ class SendingWindow:
else:
try:
- rhnreg.registerProduct(systemId,
self.tui.productInfo,self.tui.oemInfo)
+ rhnreg.registerProduct(systemId, self.tui.productInfo)
except up2dateErrors.CommunicationError, e:
FatalErrorWindow(self.screen,
_("Problem registering personal
information:\n") +
diff --git a/client/solaris/rhnclient/rhn/client/rhnReg.py
b/client/solaris/rhnclient/rhn/client/rhnReg.py
index eaa44a7..d4c14af 100755
--- a/client/solaris/rhnclient/rhn/client/rhnReg.py
+++ b/client/solaris/rhnclient/rhn/client/rhnReg.py
@@ -328,7 +328,7 @@ def registerSystem(username = None, password = None,
return ret
-def registerProduct(systemId, productInfo, oemInfo={}):
+def registerProduct(systemId, productInfo):
s = rpcServer.getServer()
try:
diff --git a/client/solaris/rhnclient/rhnreg_ks.py
b/client/solaris/rhnclient/rhnreg_ks.py
index 7fbb966..0429524 100755
--- a/client/solaris/rhnclient/rhnreg_ks.py
+++ b/client/solaris/rhnclient/rhnreg_ks.py
@@ -330,7 +330,7 @@ def main(arglist=[]):
# rhnReg.sendPackages(systemId, packageList)
if contactinfo:
- rhnReg.registerProduct(systemId, contactinfo, oemInfo)
+ rhnReg.registerProduct(systemId, contactinfo)
if not norhnsd:
rhnReg.startRhnsd()
commit 5d58d4cbc2c1bb26ae9c539ae5b65e0986c486f6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 14:15:01 2012 +0200
calling registerProduct() once is enough
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
index 86d79e1..8e2aca2 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
@@ -918,7 +918,6 @@ class SendingWindow:
_("Problem registering personal
information"))
else:
- rhnreg.registerProduct(systemId, self.tui.productInfo,self.tui.oemInfo)
try:
rhnreg.registerProduct(systemId,
self.tui.productInfo,self.tui.oemInfo)
except up2dateErrors.CommunicationError, e:
commit 2af5ac342557d4d0b2b7fd114fedc5ee212a1f8f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 13:53:45 2012 +0200
removed dead function updatePackages()
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 4e76326..d3b4166 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -539,10 +539,6 @@ def getServerType(serverUrl=None):
return 'satellite'
-def updatePackages(systemId):
- s = rhnserver.RhnServer()
- s.registration.add_packages(systemId, pkgUtils.getInstalledPackageList())
-
class ActivationResult:
ACTIVATED_NOW = 0
ALREADY_USED = 1
commit ab29378b8a26d699409a07678c31c1bc7913be61
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 13:36:22 2012 +0200
simplified __updateContactInfo() and __registerProduct()
since previous commit newAccount is always False
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index 9a3b8d6..193e266 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -829,9 +829,9 @@ class CreateProfilePage:
return True
global productInfo # Contains the user's info (name, e-mail, etc)
if cfg['supportsUpdateContactInfo']:
- ret = self.__updateContactInfo(False, productInfo, username, password, pwin)
+ ret = self.__updateContactInfo(productInfo, username, password, pwin)
else:
- ret = self.__registerProduct(False, productInfo, pwin)
+ ret = self.__registerProduct(productInfo, pwin)
if ret:
return ret
pwin.setProgress(3, 6)
@@ -913,36 +913,10 @@ class CreateProfilePage:
return False
- def __updateContactInfo(self, newAccount, productInfo, uname, password, pwin):
- try:
- if newAccount:
- rhnreg.updateContactInfo(uname, password, productInfo)
- except up2dateErrors.CommunicationError, e:
- pwin.hide()
- self.fatalError(_("Problem registering personal information:\n") +
e.errmsg)
- return True # fatalError in firstboot will return to here
- except:
- setArrowCursor()
- pwin.hide()
- errorWindow(_("Problem registering personal information"))
- return True
+ def __updateContactInfo(self, productInfo, uname, password, pwin):
return False
- def __registerProduct(self, newAccount, productInfo, pwin):
- try:
- if newAccount:
- # incorporate the info from the oemInfoFile as well
- oemInfo = rhnreg.getOemInfo()
- rhnreg.registerProduct(self.systemId, productInfo, oemInfo)
- except up2dateErrors.CommunicationError, e:
- pwin.hide()
- self.fatalError(_("Problem registering personal information:\n") +
e.errmsg)
- return True # fatalError in firstboot will return to here
- except:
- setArrowCursor()
- pwin.hide()
- errorWindow(_("Problem registering personal information"))
- return True
+ def __registerProduct(self, productInfo, pwin):
return False
commit afc76f289cffd3e632a21cb911bcbe3422a3c4c7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 13:31:32 2012 +0200
variable newAccount is unused
since 4d40989f63844b4bd2af01666781e167c6e6fdab
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
index d3059fd..9a3b8d6 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnregGui.py
@@ -82,7 +82,6 @@ gladefile = "/usr/share/rhn/up2date_client/rh_register.glade"
# we need to carry these values between screen, so stash at module scope
username = None
password = None
-newAccount = None # Should be assigned True or False
productInfo = None
hw_activation_code = None
serverType = None
@@ -453,8 +452,6 @@ class LoginPage:
username = self.loginUname.get_text()
password = self.loginPw.get_text()
- global newAccount
- newAccount = False
# validate / check user name
if self.loginUname.get_text() == "":
# we assume someone else creates this method...
@@ -760,7 +757,7 @@ class CreateProfilePage:
pwin = progress.Progress()
pwin.setLabel(_("Sending your profile information to Red Hat Network.
Please wait."))
self.systemId = None
- global newAccount, username, password, hw_activation_code, \
+ global username, password, hw_activation_code, \
_hasBaseChannelAndUpdates, chosen_channel
other = {}
if hw_activation_code:
@@ -832,9 +829,9 @@ class CreateProfilePage:
return True
global productInfo # Contains the user's info (name, e-mail, etc)
if cfg['supportsUpdateContactInfo']:
- ret = self.__updateContactInfo(newAccount, productInfo, username, password,
pwin)
+ ret = self.__updateContactInfo(False, productInfo, username, password, pwin)
else:
- ret = self.__registerProduct(newAccount, productInfo, pwin)
+ ret = self.__registerProduct(False, productInfo, pwin)
if ret:
return ret
pwin.setProgress(3, 6)
commit f8467e068df0f998714f824da322a8e8747e61a1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jul 30 13:14:22 2012 +0200
removed unaccessible code
diff --git a/backend/server/handlers/xmlrpc/registration.py
b/backend/server/handlers/xmlrpc/registration.py
index 0c8f0b5..6ac5bba 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -1048,54 +1048,6 @@ class Registration(rhnHandler):
self.auth_system(system_id)
return 0
- # we're updating the user records, so we need to load the user object
- self.load_user = 1
- server = self.auth_system(system_id)
- log_debug(1, self.server_id)
- user = server.user
- # XXX: test that this user is an admin for the server
- # raise rhnFault(4, "This username does not have administrator
rights")
- import states
- import country
- for k in product.keys():
- # argh, the blimey scurge of null fax numbers!
- if product[k] == None or product[k] == '':
- continue
- # now assign everything into the right place
- if k in ["reg_num"]: # we'll deal with it later
- continue
- if k == 'state':
- if states.states_to_abbr.has_key(product[k]):
- product[k] = states.states_to_abbr[product[k]]
- if k == 'country':
- invalid_codes = country.t9_countries.values() + \
- country.t9_countries.keys()
- if product[k] in invalid_codes:
- log_error("Invalid country", product[k])
- raise rhnFault(30, _("Not a valid Country: %s")
- % product[k])
- if country.country_to_iso.has_key(product[k]):
- product[k] = country.country_to_iso[product[k]]
- elif product[k] in country.country_to_iso.values():
- pass
- else: # bad user! bad!
- if not product[k] in invalid_codes:
- product[k] = 'US'
- # contact permissions
- if k in ["contact_phone", "contact_mail",
- "contact_email", "contact_fax"]:
- user.set_contact_perm(k, product[k])
- # other personal info
- if k in ["first_name", "last_name", "company",
"phone",
- "fax", "title", "position"]:
- user.set_info(k, product[k])
- # address information
- if k in ["city", "zip", "address1",
"address2", "country", "state"]:
- user.set_info(k, product[k])
-
- user.save()
- return 0
-
def __save_user(self, user):
""" Moved the saving of the user out to a common method
so that we can save to the db in a satellite.