[migration] update the script attribute of recipes, testexecutions and plans
related to #e50f134e41b7 changes
--- a/migration/3.0.0_Any.py Tue Sep 17 13:46:21 2013 +0200
+++ b/migration/3.0.0_Any.py Wed Sep 18 13:29:47 2013 +0200
@@ -27,3 +27,32 @@
log_file.cw_set(reverse_log_file=xeid)
commit()
+from cubes.apycot import recipes
+r_script_names = {
+ u'apycot.recipe.quick': 'quick_script',
+ u'apycot.recipe.full': 'full_script',
+ u'apycot.recipe.scenario_runner': 'scenario_runner_script'
+ }
+
+warning_msg = """
+### WARNING, THIS RECIPE SCRIPT WAS ADDED
+### DURING A MIGRATION SCRIPT AND MIGHT
+### NOT MATCH WHAT IS SHOWN IN THE LOGS
+"""
+
+for r_name in r_script_names:
+ ## update script in recipe
+ r_entity = rql('Any X WHERE X is Recipe, X name %(r_name)s,'
+ 'X script "#to be updated"',
+ {'r_name': r_name})
+ if len(r_entity) > 0:
+ r_entity = r_entity.get_entity(0, 0)
+ r_entity.set_attributes(script=getattr(recipes, r_script_names[r_name]))
+ ## update script for existing TestExecution and Chekresults
+ r_set = rql('Any X WHERE X execution_of Y, Y name %(r_name)s',
+ {'r_name': r_name})
+ for e in r_set.entities():
+ if e.script is None:
+ e.set_attributes(script=warning_msg + getattr(recipes,
+ r_script_names[r_name]))
+