Ejemplo n.º 1
0
Archivo: tag.py Proyecto: nrwahl2/pcs
def create(
    env: LibraryEnvironment, tag_id: str, idref_list: Sequence[str],
) -> None:
    """
    Create a tag in a cib.

    env -- provides all for communication with externals
    tag_id -- identifier of new tag
    idref_list -- reference ids which we want to tag
    """
    with cib_tags_section(env) as tags_section:
        env.report_processor.report_list(
            tag.validate_create_tag(
                get_resources(get_root(tags_section)),
                tag_id,
                idref_list,
                IdProvider(tags_section),
            )
        )
        if env.report_processor.has_errors:
            raise LibraryError()
        tag.create_tag(tags_section, tag_id, idref_list)
Ejemplo n.º 2
0
 def call_create_tag(self, tag_with_refs):
     lib.create_tag(
         get_tags(self.cib),
         tag_with_refs.tag_id,
         tag_with_refs.idref_list,
     )