From 21c3a1882324ad51bb8c3ebf892093a4acded615 Mon Sep 17 00:00:00 2001 From: Copolycube Date: Fri, 25 Oct 2019 11:38:56 -0400 Subject: [PATCH] Update jira-add-components-to-all-projects.py correction on wrong variables + adding the option to skip some projects --- examples/jira-add-components-to-all-projects.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/jira-add-components-to-all-projects.py b/examples/jira-add-components-to-all-projects.py index 37d652088..8566b056d 100644 --- a/examples/jira-add-components-to-all-projects.py +++ b/examples/jira-add-components-to-all-projects.py @@ -8,11 +8,17 @@ components = ["Data Base", "HTML", "JavaScript"] -"""That example show how to create components on all existing projects""" +"""That example show how to create components on all existing projects, only skipping the one in a provided list""" +project_to_skip = [ "SI", "SA", "ETA"] + for i in jira.get_all_projects(included_archived=None): - for j in compo: - data = {"project": i["key"], "name":j} - jira.create_component(data) - print("{} - component created ".format(component.get('name'))) + if i["key"] in project_to_skip : + print("Skipping project {} ".format(i["key"])) + else : + for j in components: + print("Creating in project {} ".format(i["key"])) + comp = {"project": i["key"], "name":j} + jira.create_component(comp) + print("{} - component created ".format(comp.get('name')))