def add_admin_to_eng_team(eng_uuid): admin_db_id = DBGeneral.select_where( 'id', Constants.DBConstants.IceTables.USER_PROFILE, 'email', Constants.Users.Admin.EMAIL, 1) queryStr = "INSERT INTO public.ice_engagement_engagement_team" +\ "(engagement_id, iceuserprofile_id) VALUES ('%s', '%s');" % ( eng_uuid, admin_db_id) logger.debug("add_admin_to_eng_team Query: %s" % queryStr) DBGeneral.insert_query(queryStr)
def insert_aic_version(ui_visibility="TRUE"): new_aic_version = { "uuid": str( uuid.uuid4()), "name": "AIC", "version": DBBridge.helper_rand_string( "randomNumber", 2), "ui_visibility": ui_visibility, "weight": 0} queryStr = "INSERT INTO public.ice_deployment_target( \ uuid, name, version, ui_visibility, weight) \ VALUES " +\ "('%s', '%s', '%s', '%s', %s);" % ( new_aic_version['uuid'], new_aic_version['name'], new_aic_version['version'], new_aic_version['ui_visibility'], new_aic_version['weight']) DBGeneral.insert_query(queryStr) return new_aic_version
def create_default_heat_teampleate(): template_query = "INSERT INTO public.ice_checklist_template(uuid, " +\ "name, category, version, create_time)"\ "VALUES ('%s', '%s', '%s', '%s', '%s');" % ( str(uuid4()), 'Editing Heat', 'first category', '1', timezone.now()) DBGeneral.insert_query(template_query) template_id = DBGeneral.select_query( "SELECT uuid FROM public.ice_checklist_template where " + "name = 'Editing Heat'") # SECTIONS section1_query = "INSERT INTO public.ice_checklist_section(uuid, " +\ "name, weight, description, validation_instructions, " +\ "create_time, template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s');" % ( str(uuid4()), 'External References', '1', 'section descripyion', 'valid instructions', timezone.now(), template_id) DBGeneral.insert_query(section1_query) section1_id = DBGeneral.select_query( ("""SELECT uuid FROM public.ice_checklist_section """ + """where name = 'External References' """ + """and template_id = '{s}'""").format(s=template_id)) section2_query = "INSERT INTO public.ice_checklist_section(uuid, " +\ "name, weight, description, validation_instructions, " +\ "create_time, template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s');" % ( str(uuid4()), 'Parameter Specification', '2', 'section descripyion', 'valid instructions', timezone.now(), template_id) DBGeneral.insert_query(section2_query) section2_id = DBGeneral.select_query( ("""SELECT uuid FROM public.ice_checklist_section """ + """where name = """ + """'Parameter Specification' and template_id = '{s}'""").format( s=template_id)) # Line items line_item1 = \ "INSERT INTO public.ice_checklist_line_item(uuid, " +\ "name, weight, description, line_type, validation_instructions," +\ "create_time,section_id, template_id) "\ "VALUES ('%s', '%s', " % (str(uuid4()), 'Normal references') +\ "'%s', " % '1' +\ "'%s'," % 'Numeric parameters should include ' +\ 'range and/or allowed values.' +\ " '%s'," % 'manual', +\ "'%s'" % 'Here are some useful tips ' +\ 'for how to validate this item ' +\ 'in the most awesome way:<br><br><ul><li>Here is my ' +\ 'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' +\ 'Here is my awesome tip 3</li></ul>' +\ ", '%s'" % timezone.now() +\ ", '%s'," % section1_id +\ " '%s');" % template_id DBGeneral.insert_query(line_item1) line_item2 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\ "name, weight, description, line_type, validation_instructions," +\ "create_time, section_id, template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s');" % ( str(uuid4()), 'String parameters', '2', 'Numeric parameters should include range ' + 'and/or allowed values.', 'auto', 'Here are some useful tips for how to validate this item ' + 'in the most awesome way:<br><br><ul><li>Here is my ' + 'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' + 'Here is my awesome tip 3</li></ul>', timezone.now(), section2_id, template_id) DBGeneral.insert_query(line_item2) line_item3 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\ "name, weight, description, line_type, validation_instructions," +\ "create_time,section_id, template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', " +\ "'%s', '%s', '%s');" % ( str(uuid4()), 'Numeric parameters', '3', 'Numeric parameters should include range and/or ' + 'allowed values.', 'manual', 'Here are some useful tips for how to validate this item ' + 'in the most awesome way:<br><br><ul><li>Here is my ' + 'awesome tip 1</li><li>Here is my awesome tip 2</li><li>' + 'Here is my awesome tip 3</li></ul>', timezone.now(), section2_id, template_id) DBGeneral.insert_query(line_item3) line_item4 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\ "name, weight, description, line_type, " +\ "validation_instructions,create_time, section_id, " +\ "template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s', " +\ "'%s', '%s');" % ( str(uuid4()), 'VF image', '2', 'Numeric parameters should include range and/or ' + 'allowed values.', 'auto', 'Here are some useful tips for how to validate this ' + 'item in the most awesome way:<br><br><ul><li>Here is ' + 'my awesome tip 1</li><li>Here is my awesome tip 2' + '</li><li>Here is my awesome tip 3</li></ul>', timezone.now(), section1_id, template_id) DBGeneral.insert_query(line_item4) line_item5 = "INSERT INTO public.ice_checklist_line_item(uuid, " +\ "name, weight, description, line_type, validation_instructions," +\ "create_time,section_id, template_id) "\ "VALUES ('%s', '%s', '%s', '%s', '%s','%s', '%s'," +\ " '%s', '%s');" % (str( uuid4()), 'Parameters', '1', 'Numeric parameters should include range ' + 'and/or allowed values.', 'auto', 'Here are some useful tips for how to validate this item ' + 'in the most awesome way:<br><br><ul><li>Here is my awesome ' + 'tip 1</li><li>Here is my awesome tip 2</li><li>Here is my ' + 'awesome tip 3</li></ul>', timezone.now(), section2_id, template_id) DBGeneral.insert_query(line_item5)
def remove_engagement_from_recent(vf_uuid): DBGeneral.insert_query( "DELETE FROM %s WHERE vf_id='%s'" % (Constants.DBConstants. IceTables.RECENT, vf_uuid))
def change_ecomp_release_weight(new_weight, old_weight): DBGeneral.insert_query( "UPDATE public.ice_ecomp_release SET weight=%s WHERE weight=%s" % (new_weight, old_weight))
def change_aic_version_weight(new_weight, old_weight): DBGeneral.insert_query( "UPDATE public.ice_deployment_target " + "SET weight=%s " % new_weight + "WHERE weight=%s" % old_weight)
def delete_aic_version(aic_uuid): DBGeneral.insert_query( "DELETE FROM public.ice_deployment_target WHERE uuid='%s';" % aic_uuid)