getsentry / sentry-jira

A Plugin for sentry that lets you create JIRA issues
Other
95 stars 32 forks source link

Fix Version/s seems to be a required field #24

Closed jonathancua closed 11 years ago

jonathancua commented 11 years ago

I am using the following: Python 2.6, Sentry 5.0.14, sentry-jira plugin 0.6.7 and jira 5.1.4

This seems to be related to this issue (https://github.com/thurloat/sentry-jira/issues/20 and https://github.com/thurloat/sentry-jira/issues/23).

When I am submitting the jira ticket, it now complains about the "Fix version/s" which gives this error and it does not allow the jira ticket to be submitted.

"Field 'fixVersions' cannot be set. It is not on the appropriate screen, or unknown."

I tried to put any values but it does not seem to be accepting it.

As a workaround, I had to comment out the following in forms.py:

# fixVersions = forms.MultipleChoiceField(
#    label=_("Fix Version/s"),
#    required=False
#)

....

# self.fields["fixVersions"].choices = self.make_choices(versions)

This seem to work. But I'm not sure what the effect of this would be.

thurloat commented 11 years ago

Learned another something about JIRA today, not only are fixVersions not required fields, but some issue types can have the field excluded from the create form.

Even though you leave it empty, if it's not included in the /projectmeta response as an issue field for that type it complains that the key is there anyway.

The fixVersions field is an artifact of the first version of development which didn't allow any custom fields and just had some basic hard-coded fields.

Can you try with current master and let me know if it's working?

jonathancua commented 11 years ago

This introduced another bug. When I am about to submit the jira ticket, it now complains about this.

issue type is required Changing the issue type will refresh the page with the required form fields.

This error appears even though I chose an issue type or I changed the issue type. This does not let you submit the ticket.

thurloat commented 11 years ago

Odd, I came across that issue while writing the last commit, check https://github.com/thurloat/sentry-jira/commit/0222857b3a9026667e65124dc52816d44d3df656#L0R229 for the line that is supposed to fix it.

what version of JIRA are you running?

jonathancua commented 11 years ago

I am using the following: Python 2.6, Sentry 5.0.14, sentry-jira plugin 0.6.7 and jira 5.1.4

thurloat commented 11 years ago

thought it may have been a sneaky API change between your 5.1.4 and 5.1.6 but my testing says it's working on your version also. I pushed out the fix mentioned above to pypi so you should be able to pip install --upgrade sentry-jira to ensure that fix is applied in your environment.

jonathancua commented 11 years ago

When I downloaded sentry-jira 0.6.8 from pypi, I was still getting the error. When I made the change below in forms.py,

 -                    very_clean.pop(field, None)
+                    del very_clean[field]
+                    # very_clean.pop(field, None)

 -        very_clean["issuetype"] = {"id": very_clean["issuetype"]}
 -        very_clean.pop("project_key", None)
+        del very_clean["project_key"]
+        # very_clean["issuetype"] = {"id": very_clean["issuetype"]}
+        # very_clean.pop("project_key", None)

the changes seems to work (I'm able to submit the ticket to jira).

thurloat commented 11 years ago

any particular reason you switched the pops for dels ?

jonathancua commented 11 years ago

Actually, I was just reverting the change that you made in this commit.

https://github.com/thurloat/sentry-jira/commit/0222857b3a9026667e65124dc52816d44d3df656#L0R229

thurloat commented 11 years ago

@bichonfrise74 now it should work for both of our instances, in the commit message I left a potential clue for the difference and i'll keep looking into.

Let me know if latest isn't working for you.

jonathancua commented 11 years ago

Unfortunately, this fix didn't solve the issue that I am seeing. It was still saying that the IssueType is required even though I have selected it.

thurloat commented 11 years ago

@bichonfrise74 just released hotfix version 0.6.11, can you upgrade and ensure it works for JIRA 5.1.4 now?

jonathancua commented 11 years ago

Thanks, I will try it when I get a chance.