def append_pav_to_tickets(pav, pav_append, prod=False, dry_run=False): """Find tickets with given PAV and append new PAV to them. Args: pav: Existing PAV to search with pav_append: New PAV that will be added to tickets prod: Choose if production JIRA is used, default False dry_run: If True action is not performed, just logged, default False """ ticket_ids = get_ticket_IDs(prod=prod, pav=pav) if not ticket_ids: logging.error('No tickets match provided PAV') return for ticket_id in ticket_ids: logging.debug('Appending PAV to ticket {0}'.format(ticket_id)) if not dry_run: ticket = Ticket(prod=prod, ticket_id=ticket_id) ticket.add_pav(pav_append)