Imported Debian patch 4.0.5-6~numeezy
This commit is contained in:
committed by
Mario Fetka
parent
c44de33144
commit
10dfc9587b
@@ -17,23 +17,25 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ipaserver.install.plugins import MIDDLE
|
||||
from ipaserver.install.plugins.baseupdate import PostUpdate
|
||||
from ipalib import api, errors
|
||||
from ipalib import Updater
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipa_log_manager import *
|
||||
|
||||
|
||||
class update_service_principalalias(Updater):
|
||||
class update_service_principalalias(PostUpdate):
|
||||
"""
|
||||
Update all services which do not have ipakrbprincipalalias attribute
|
||||
used for case-insensitive principal searches filled. This applies for
|
||||
all services created prior IPA 3.0.
|
||||
"""
|
||||
order = MIDDLE
|
||||
|
||||
def execute(self, **options):
|
||||
ldap = self.api.Backend.ldap2
|
||||
ldap = self.obj.backend
|
||||
|
||||
base_dn = DN(self.api.env.container_service, self.api.env.basedn)
|
||||
base_dn = DN(api.env.container_service, api.env.basedn)
|
||||
search_filter = ("(&(objectclass=krbprincipal)(objectclass=ipaservice)"
|
||||
"(!(objectclass=ipakrbprincipal)))")
|
||||
root_logger.debug("update_service_principalalias: search for affected "
|
||||
@@ -49,16 +51,16 @@ class update_service_principalalias(Updater):
|
||||
except errors.NotFound:
|
||||
root_logger.debug("update_service_principalalias: no service "
|
||||
"to update found")
|
||||
return False, []
|
||||
except errors.ExecutionError as e:
|
||||
return (False, False, [])
|
||||
except errors.ExecutionError, e:
|
||||
root_logger.error("update_service_principalalias: cannot "
|
||||
"retrieve list of affected services: %s", e)
|
||||
return False, []
|
||||
return (False, False, [])
|
||||
if not entries:
|
||||
# no entry was returned, rather break than continue cycling
|
||||
root_logger.debug("update_service_principalalias: no service "
|
||||
"was returned")
|
||||
return False, []
|
||||
return (False, False, [])
|
||||
root_logger.debug("update_service_principalalias: found %d "
|
||||
"services to update, truncated: %s",
|
||||
len(entries), truncated)
|
||||
@@ -72,7 +74,7 @@ class update_service_principalalias(Updater):
|
||||
ldap.update_entry(entry)
|
||||
except (errors.EmptyModlist, errors.NotFound):
|
||||
pass
|
||||
except errors.ExecutionError as e:
|
||||
except errors.ExecutionError, e:
|
||||
root_logger.debug("update_service_principalalias: cannot "
|
||||
"update service: %s", e)
|
||||
error = True
|
||||
@@ -81,12 +83,12 @@ class update_service_principalalias(Updater):
|
||||
# exit loop to avoid infinite cycles
|
||||
root_logger.error("update_service_principalalias: error(s)"
|
||||
"detected during service update")
|
||||
return False, []
|
||||
return (False, False, [])
|
||||
elif not truncated:
|
||||
# all affected entries updated, exit the loop
|
||||
root_logger.debug("update_service_principalalias: all affected"
|
||||
" services updated")
|
||||
return False, []
|
||||
return False, []
|
||||
return (False, False, [])
|
||||
return (False, False, [])
|
||||
|
||||
api.register(update_service_principalalias)
|
||||
|
||||
Reference in New Issue
Block a user