From 6a9c20a87c2ae3eaa941120073cad34c328cb7df Mon Sep 17 00:00:00 2001 From: Serhii Tsymbaliuk Date: May 21 2019 12:45:27 +0000 Subject: Fix occasional 'whoami.data is undefined' error in FreeIPA web UI 'Metadata' phase (Web UI initialization flow) doesn't wait "whoami" response. It causes the error when on the next phase "whoami" data is undefined. To avoid this "whoami" request now has flag async = false, so init_metadata waits until it will be completed. Ticket: https://pagure.io/freeipa/issue/7917 Signed-off-by: Serhii Tsymbaliuk Reviewed-By: Rob Crittenden --- diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js index 2be6474..758db1b 100644 --- a/install/ui/src/freeipa/ipa.js +++ b/install/ui/src/freeipa/ipa.js @@ -251,7 +251,10 @@ var IPA = function () { on_success: function(data, text_status, xhr) { that.whoami.metadata = data.result || data; var wa_data = that.whoami.metadata; - + // This AJAX request has no synchronization point, + // so we set async = false to make sure that init_metadata + // doesn't start before we get whoami response. + $.ajaxSetup({async: false}); rpc.command({ method: wa_data.details || wa_data.command, args: wa_data.arguments, @@ -275,6 +278,8 @@ var IPA = function () { } } }).execute(); + // Restore AJAX options + $.ajaxSetup(that.ajax_options); } }); };