Просмотр исходного кода

Fix user scripts normalization failure when `None` is passed

Daniel Vincze 4 лет назад
Родитель
Сommit
6317448ea4
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      coriolis/api/v1/utils.py

+ 2 - 0
coriolis/api/v1/utils.py

@@ -120,6 +120,8 @@ def validate_user_scripts(user_scripts):
 def normalize_user_scripts(user_scripts, instances):
 def normalize_user_scripts(user_scripts, instances):
     """ Removes instance user_scripts if said instance is not one of the
     """ Removes instance user_scripts if said instance is not one of the
         selected instances for the replica/migration """
         selected instances for the replica/migration """
+    if user_scripts is None:
+        user_scripts = {}
     for instance in user_scripts.get('instances', {}).keys():
     for instance in user_scripts.get('instances', {}).keys():
         if instance not in instances:
         if instance not in instances:
             LOG.warn("Removing provided instance '%s' from user_scripts body "
             LOG.warn("Removing provided instance '%s' from user_scripts body "