def get_issues(self): """ Get PRDS, then get their New Feature links, then get the New Features Puts issues in self.prd_issue_list and self.new_feature_issue_list Lists of issue dictionaries """ # Get prd new feature link ids, then we'll get those issues # jql = '(("FL Project" = "G.1.0") and ((project = "Titan") or (project = "Griffin")) and (issuetype = "PRD"))' jql = '(("FL Project" = \"%s\") and (project = \"%s\") and (issuetype = "PRD"))' % (self.options.fl_project, self.options.project) self.jql = jql print "Getting PRD issues" print "jql: %s" % jql self.prd_issue_list = list(jira_utils.get_issues(jql)) # Get prd new feature link ids, then we'll get those issues nf_link_ids = [] for item in self.prd_issue_list: for issue_link in item['fields']['issuelinks']: try: if issue_link['inwardIssue']['fields']['issuetype']['name'] == "New Feature": nf_link_ids.append(issue_link['inwardIssue']['key']) # Add New feature id to list except KeyError: continue # Some issue links don't have the field "inwardIssue", skip those and continue nf_link_ids_string = ",".join(sorted(nf_link_ids)) jql = 'key in (' + nf_link_ids_string + ')' # Like: key in ("Titan-1234", "Titan-5678") print "Getting PRDs New Feature link issues" print "jql: %s" % jql self.new_feature_issue_list = list(jira_utils.get_issues(jql))
pass else: raise IOError('Cannot open configuration file') except ConfigParser.ParsingError, error: print 'Error,', error # The jira query that will get the issues we're interested in. jql = '(("FL Project" = "G.1.0") and ("project" = "TITAN") and \ (issuetype = "New Feature") and (status != "Open" or status != "In Progress" or status != "Reopened" or status != "Resolved" or status != "Closed") or \ (issuetype = Sub-task and status = "In Progress"))' # (issuetype = Sub-task and status = "In Progress"))' % self.options.fl_project print "jql: %s" % jql # temp_issue = jira_utils.get_issue("TEST-114") # print json.dumps(temp_issue, indent=4) # sys.exit() ja.issues = list(jira_utils.get_issues(jql)) # Gets issues using the jgl query (turn returned json into python list) print "Number of issues: %s" % len(ja.issues) ja.create_issue_objs() # Create IssueClass objects for each issue, also gets changes and time in status ja.put_subtask_in_parent() ja.get_stalled_issues() ja.send_main_email() # Email complete list of latest issue status times # ja.send_assignee_emails() # Send email to assignees about their issues if __name__ == "__main__": sys.exit(main())