Skip to content

Commit 2c30556

Browse files
copolycubegonchik
authored andcommitted
Update jira-add-components-to-all-projects.py (#373)
correction on wrong variables + adding the option to skip some projects
1 parent 830e8d3 commit 2c30556

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

examples/jira-add-components-to-all-projects.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88

99
components = ["Data Base", "HTML", "JavaScript"]
1010

11-
"""That example show how to create components on all existing projects"""
11+
"""That example show how to create components on all existing projects, only skipping the one in a provided list"""
1212

13+
project_to_skip = [ "SI", "SA", "ETA"]
14+
1315
for i in jira.get_all_projects(included_archived=None):
14-
for j in compo:
15-
data = {"project": i["key"], "name":j}
16-
jira.create_component(data)
17-
print("{} - component created ".format(component.get('name')))
16+
if i["key"] in project_to_skip :
17+
print("Skipping project {} ".format(i["key"]))
18+
else :
19+
for j in components:
20+
print("Creating in project {} ".format(i["key"]))
21+
comp = {"project": i["key"], "name":j}
22+
jira.create_component(comp)
23+
print("{} - component created ".format(comp.get('name')))
1824

0 commit comments

Comments
 (0)