Skip to content

Commit ddf5e2e

Browse files
committed
Filter out non-ascii characters in usernames
- treat in the same way as non-ascii characters in VM names.
1 parent c779a29 commit ddf5e2e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

caso/extract/openstack/nova.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,24 @@ def _build_record(self, server):
224224

225225
floating_ips = self._count_ips_on_server(server)
226226

227+
# Filter out non-ascii characters for APEL compatibility.
227228
vm_name = server.name.encode("ascii", errors="ignore")
229+
local_user_id = server.user_id.encode("ascii", errors="ignore")
230+
global_username = user.encode("ascii", errors="ignore")
228231

229232
r = record.CloudRecord(
230233
uuid=server.id,
231234
site_name=CONF.site_name,
232235
name=vm_name,
233-
user_id=server.user_id,
236+
user_id=local_user_id,
234237
group_id=server.tenant_id,
235238
fqan=self.vo,
236239
start_time=server_start,
237240
end_time=server_end,
238241
compute_service=CONF.service_name,
239242
status=status,
240243
image_id=image_id,
241-
user_dn=user,
244+
user_dn=global_username,
242245
benchmark_type=bench_name,
243246
benchmark_value=bench_value,
244247
memory=memory,

0 commit comments

Comments
 (0)