From 6b9c5f7659ab665c89b25975777625ec785ada9b Mon Sep 17 00:00:00 2001
From: Alex Barchiesi <alex.barchiesi@garr.it>
Date: Fri, 20 Jul 2018 20:29:41 +0200
Subject: [PATCH] Upgrade to 18.05.

---
 hooks/keystone_context.py |  6 +++---
 hooks/keystone_hooks.py   |  1 -
 hooks/keystone_utils.py   | 32 --------------------------------
 3 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/hooks/keystone_context.py b/hooks/keystone_context.py
index 698c73b7..febdd85f 100644
--- a/hooks/keystone_context.py
+++ b/hooks/keystone_context.py
@@ -418,9 +418,9 @@ class TokenFlushContext(context.OSContextGenerator):
 class IdpFetchContext(context.OSContextGenerator):
 
     def __call__(self):
-        from keystone_utils import (get_api_suffix,
-            api_port, endpoint_url, resolve_address, ADMIN,
-        )
+        from keystone_utils import (get_api_suffix, api_port, endpoint_url,
+                                    resolve_address, ADMIN
+                                    )
         ctxt = {
             'enable_saml2': config('enable-saml2'),
             'remote_ids_fetch': is_elected_leader(DC_RESOURCE_NAME) and
diff --git a/hooks/keystone_hooks.py b/hooks/keystone_hooks.py
index 3e531eee..b5386523 100755
--- a/hooks/keystone_hooks.py
+++ b/hooks/keystone_hooks.py
@@ -91,7 +91,6 @@ from keystone_utils import (
     is_db_ready,
     is_db_initialised,
     filter_null,
-    ensure_permissions,
     is_service_present,
     delete_service_entry,
     assess_status,
diff --git a/hooks/keystone_utils.py b/hooks/keystone_utils.py
index f248ab40..a0eee312 100644
--- a/hooks/keystone_utils.py
+++ b/hooks/keystone_utils.py
@@ -1328,38 +1328,6 @@ def is_password_changed(username, passwd):
     return (_passwd is None or passwd != _passwd)
 
 
-def ensure_permissions(path, user=None, group=None, perms=None, recurse=False,
-                       maxdepth=50):
-    """Set chownand chmod for path
-
-    Note that -1 for uid or gid result in no change.
-    """
-    if user:
-        uid = pwd.getpwnam(user).pw_uid
-    else:
-        uid = -1
-
-    if group:
-        gid = grp.getgrnam(group).gr_gid
-    else:
-        gid = -1
-
-    os.chown(path, uid, gid)
-
-    if perms:
-        os.chmod(path, perms)
-
-    if recurse:
-        if not maxdepth:
-            log("Max recursion depth reached - skipping further recursion")
-            return
-
-        paths = glob.glob("%s/*" % (path))
-        for path in paths:
-            ensure_permissions(path, user=user, group=group, perms=perms,
-                               recurse=recurse, maxdepth=maxdepth - 1)
-
-
 def relation_list(rid):
     cmd = [
         'relation-list',
-- 
GitLab