def create( env, ticket_key, resource_id, options, resource_in_clone_alowed=False, duplication_alowed=False, ): """ create ticket constraint string ticket_key ticket for constraining resource dict options desired constraint attributes bool resource_in_clone_alowed flag for allowing to reference id which is in tag clone or master bool duplication_alowed flag for allowing create duplicate element callable duplicate_check takes two elements and decide if they are duplicates """ cib = env.get_cib() options = ticket.prepare_options_plain( cib, env.report_processor, options, ticket_key, constraint.find_valid_resource_id(env.report_processor, cib, resource_in_clone_alowed, resource_id), ) constraint_section = get_constraints(cib) constraint_element = ticket.create_plain(constraint_section, options) constraint.check_is_without_duplication( env.report_processor, constraint_section, constraint_element, are_duplicate=ticket.get_duplicit_checker_callback( are_new_role_names_supported(constraint_section)), export_element=constraint.export_plain, duplication_alowed=duplication_alowed, ) env.push_cib()
def create( env, ticket_key, resource_id, options, autocorrection_allowed=False, resource_in_clone_alowed=False, duplication_alowed=False, ): """ create ticket constraint string ticket_key ticket for constraining resource dict options desired constraint attributes bool resource_in_clone_alowed flag for allowing to reference id which is in tag clone or master bool duplication_alowed flag for allowing create duplicate element callable duplicate_check takes two elements and decide if they are duplicates """ cib = env.get_cib() options = ticket.prepare_options_plain( cib, options, ticket_key, constraint.find_valid_resource_id( env.report_processor, cib, autocorrection_allowed, resource_in_clone_alowed, resource_id ), ) constraint_section = get_constraints(cib) constraint_element = ticket.create_plain(constraint_section, options) constraint.check_is_without_duplication( env.report_processor, constraint_section, constraint_element, are_duplicate=ticket.are_duplicate_plain, export_element=constraint.export_plain, duplication_alowed=duplication_alowed, ) env.push_cib(cib)