osi-dump 0.1.3.3.2.4__py3-none-any.whl → 0.1.3.3.2.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- osi_dump/importer/role_assignment/openstack_role_assignment_importer.py +26 -10
- {osi_dump-0.1.3.3.2.4.dist-info → osi_dump-0.1.3.3.2.6.dist-info}/METADATA +1 -1
- {osi_dump-0.1.3.3.2.4.dist-info → osi_dump-0.1.3.3.2.6.dist-info}/RECORD +6 -6
- {osi_dump-0.1.3.3.2.4.dist-info → osi_dump-0.1.3.3.2.6.dist-info}/WHEEL +0 -0
- {osi_dump-0.1.3.3.2.4.dist-info → osi_dump-0.1.3.3.2.6.dist-info}/entry_points.txt +0 -0
- {osi_dump-0.1.3.3.2.4.dist-info → osi_dump-0.1.3.3.2.6.dist-info}/top_level.txt +0 -0
@@ -16,6 +16,10 @@ logger = logging.getLogger(__name__)
|
|
16
16
|
|
17
17
|
|
18
18
|
class OpenStackRoleAssignmentImporter(RoleAssignmentImporter):
|
19
|
+
user_names = {}
|
20
|
+
role_names = {}
|
21
|
+
|
22
|
+
|
19
23
|
def __init__(self, connection: Connection):
|
20
24
|
self.connection = connection
|
21
25
|
|
@@ -34,9 +38,9 @@ class OpenStackRoleAssignmentImporter(RoleAssignmentImporter):
|
|
34
38
|
)
|
35
39
|
|
36
40
|
try:
|
37
|
-
osrole_assignments =
|
38
|
-
|
39
|
-
|
41
|
+
osrole_assignments: list[OSRoleAssignment] = list(
|
42
|
+
self.connection.identity.role_assignments()
|
43
|
+
)
|
40
44
|
except Exception as e:
|
41
45
|
raise Exception(
|
42
46
|
f"Can not fetch role_assignments for {self.connection.auth['auth_url']} {e}"
|
@@ -53,7 +57,7 @@ class OpenStackRoleAssignmentImporter(RoleAssignmentImporter):
|
|
53
57
|
role_assignments.append(future.result())
|
54
58
|
|
55
59
|
logger.info(f"Imported role_assignments for {self.connection.auth['auth_url']}")
|
56
|
-
|
60
|
+
|
57
61
|
return role_assignments
|
58
62
|
|
59
63
|
def _get_role_assignment_info(
|
@@ -76,16 +80,28 @@ class OpenStackRoleAssignmentImporter(RoleAssignmentImporter):
|
|
76
80
|
user_name = None
|
77
81
|
role_name = None
|
78
82
|
|
79
|
-
try:
|
80
|
-
|
81
|
-
|
83
|
+
try:
|
84
|
+
if user_id in OpenStackRoleAssignmentImporter.user_names:
|
85
|
+
user_name = OpenStackRoleAssignmentImporter.user_names[user_id]
|
86
|
+
else:
|
87
|
+
user_name = self.connection.identity.get_user(
|
88
|
+
role_assignment.user["id"]
|
89
|
+
).name
|
90
|
+
OpenStackRoleAssignmentImporter.user_names[user_id] = user_name
|
82
91
|
except Exception as e:
|
83
|
-
logger.warning(f"Can not get
|
92
|
+
logger.warning(f"Can not get user name: {e}")
|
84
93
|
|
85
94
|
try:
|
86
|
-
|
95
|
+
if role_id in OpenStackRoleAssignmentImporter.role_names:
|
96
|
+
role_name = OpenStackRoleAssignmentImporter.role_names[role_id]
|
97
|
+
else:
|
98
|
+
role_name = self.connection.identity.get_role(
|
99
|
+
role_assignment.role["id"]
|
100
|
+
).name
|
101
|
+
OpenStackRoleAssignmentImporter.role_names[role_id] = role_name
|
102
|
+
|
87
103
|
except Exception as e:
|
88
|
-
logger.warning(f"Can not get
|
104
|
+
logger.warning(f"Can not get role name: {e}")
|
89
105
|
|
90
106
|
role_assignment_ret = RoleAssignment(
|
91
107
|
user_id=user_id,
|
@@ -77,7 +77,7 @@ osi_dump/importer/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
77
77
|
osi_dump/importer/project/openstack_project_importer.py,sha256=ylcm3jEFqh4gW8vhzhIaBq5v4A-PV3BaaogC8uHlSkg,3295
|
78
78
|
osi_dump/importer/project/project_importer.py,sha256=jwEvxteFbSwyWMV8hKAtf5Lo2bZysWkQ1L_NVUE8XOQ,191
|
79
79
|
osi_dump/importer/role_assignment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
80
|
-
osi_dump/importer/role_assignment/openstack_role_assignment_importer.py,sha256=
|
80
|
+
osi_dump/importer/role_assignment/openstack_role_assignment_importer.py,sha256=i_3fx86y_UotOkQ9I9oLiXQ3UlXtokYxW4XreodAIW0,3678
|
81
81
|
osi_dump/importer/role_assignment/role_assignment_importer.py,sha256=Faorx0qsgdXjv5y2t-7obpV3wFfbmByx_-8b9yBr7L8,228
|
82
82
|
osi_dump/importer/router/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
83
83
|
osi_dump/importer/router/openstack_router_importer.py,sha256=T_Wr45nJrCcp2OOdRawmdQkNBDzczA-3DPx9dlewd4g,2781
|
@@ -109,8 +109,8 @@ osi_dump/util/extract_hostname.py,sha256=IpdklGHevmtRu67xeSRE_5n2mvWGI1sDsnJwExo
|
|
109
109
|
osi_dump/util/openstack_util.py,sha256=_o8LiRmQKtxQ8hU3rbrMNwIAxt0-aWD2rjq-NvVdK9E,1299
|
110
110
|
osi_dump/util/panda_excel.py,sha256=owr8AffIxqN3yY8kIv55Ox4j2dRz7kXZvSZFZeft8dw,734
|
111
111
|
osi_dump/util/validate_dir_path.py,sha256=pL_OrY8JnNwk3vj6Zp6bsZtgHXhszSGRoqIt-1G5S90,507
|
112
|
-
osi_dump-0.1.3.3.2.
|
113
|
-
osi_dump-0.1.3.3.2.
|
114
|
-
osi_dump-0.1.3.3.2.
|
115
|
-
osi_dump-0.1.3.3.2.
|
116
|
-
osi_dump-0.1.3.3.2.
|
112
|
+
osi_dump-0.1.3.3.2.6.dist-info/METADATA,sha256=YP_-NefdJ8q6kpPwWq5d752llU6lf5SMQ9PERl2Pzus,679
|
113
|
+
osi_dump-0.1.3.3.2.6.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
114
|
+
osi_dump-0.1.3.3.2.6.dist-info/entry_points.txt,sha256=ozm5sIBtXzLv6_FiUe26v1BgA3_xUReGLPhKQKZ56wQ,46
|
115
|
+
osi_dump-0.1.3.3.2.6.dist-info/top_level.txt,sha256=OtAAwmJfcoPvlw_Cemo_H1aXIGV_7w0O2941KQt6faQ,9
|
116
|
+
osi_dump-0.1.3.3.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|