This is an automated email from the ASF dual-hosted git repository.
jsinovassinnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/master by this push:
new 08715cba6 UNOMI-747 : add null check in events migration script (#589)
08715cba6 is described below
commit 08715cba6ce97d8830ab36e7603a8e62d15d3cdb
Author: jsinovassin <[email protected]>
AuthorDate: Tue Mar 14 14:23:24 2023 +0100
UNOMI-747 : add null check in events migration script (#589)
---
.../src/main/resources/requestBody/2.0.0/event_migrate.painless | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless
b/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless
index 800fa97b7..9fd7e968a 100644
---
a/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless
+++
b/tools/shell-commands/src/main/resources/requestBody/2.0.0/event_migrate.painless
@@ -20,8 +20,12 @@ if ('login' == ctx._source.eventType) {
/* Look for empty scope */
if (ctx._source.scope == '') {
ctx._source.put('scope', 'systemsite');
- ctx._source.source.put('scope', 'systemsite');
- ctx._source.target.put('scope', 'systemsite');
+ if (ctx._source.source != null) {
+ ctx._source.source.put('scope', 'systemsite');
+ }
+ if (ctx._source.target != null) {
+ ctx._source.target.put('scope', 'systemsite');
+ }
}
}
/* Handle view events */