1

So my issue is with the Python Library for the JIRA API. We are using JIRA as a asset management database (Yes I know its normal used by dev's and we use it for that as well but this was a case were it worked well) to keep track of are server configs (Memory, CPU, Location on the Rack ..etc..)

Using this function I am having it create a Issue under a Project and pull the information for the fields from another API.

(note that I cant give clues as to who I work for so the code is edited - however it all works expect when i add one line)

def create_compute_node_in_jira(self, compute_node_name ,user_name, password, info_dic): help_obj = helper() jira = JIRA("https://",basic_auth=(user_name,password))

    #Uses a dic to create the fields / info for the Issue

    issue_dict = {
    'project': {'key': <project>},
    'summary': compute_node_name,
    'issuetype': {'name': 'Server Hardware'},
    'customfield_10500': str(info_dic["Hostname"]), 
    'customfield_11007': {'value': str("2U")}, 
    'customfield_11006': str(info_dic["Aggr0-IP"]),
    'customfield_10510': {'value': str(7)}, 
    'customfield_10501': str(info_dic["Serial-Number"]) 
    'customfield_10502': {'value': str(<server>)},
    'customfield_10503': str(help_obj.data_parser_sm(info_dic["Hostname"])),
    'customfield_10509': {'value': str("<OS>")},  
    'customfield_10504': {'value': str("<mem>")},   
    'customfield_10505': str(help_obj.data_parser_cpu(info_dic["CpuType"])),
    'customfield_10507': {'value': str(info_dic["Cpu-Core"])}, 
    'customfield_10508': {'value': str(<OS Version>)},     
    'customfield_11008': {'value': str("CMH")}
    }
    jira.create_issue(fields=issue_dict)
    return "[*]Created ticket" # Should exit script after this is returned

The line - 'customfield_11008': {'value': str("CMH")} - causes the function to return the following expection:

jira.utils.JIRAError: JiraError HTTP 400 text: Option id 'null' is not valid url: https:///rest/api/2/issue

however when i omit that line it runs with out a problem. I tried CMH lower case - capital ..etc.. and it still breaks the scripts. I even went through the web gui and copied the "CMH" entry in another ticket and it stilled caused a problem. Has anybody seen this before / have any guesses as to why it is breaking ?

2 Answers 2

4

So after a while of playing around with JIRA I found out it was my own mistake. It seems this error is caused when you post to a field using the API a "value" that it does not understand. A example was I was using the wrong custom field and the JIRA Field that I was posting to was not setup to take the value I was using.

Sign up to request clarification or add additional context in comments.

Comments

1

You will see this error when the field's value is expected to match an option list, and you are trying to send a value which is not on this list.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.