-
-
Notifications
You must be signed in to change notification settings - Fork 892
let Jira cloud assign a default permissionScheme if none is specified #1483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
this closes #1483 |
hmm this doesn't seem right, the Jira Cloud docs do say this is a correct parameter: |
we should add a test for this in our cloud tests |
I found this issue mentioned as well by some user: It has almost a year and the issue still persists. |
The documentation says it's a valid field but it still throws a 500. We either embrace the error or we remove the field if not specified, which is what I am proposing. The current test manager is suppressing that and other errors so the test suite does not cover that scenario: ...
create_attempts = 6
for _ in range(create_attempts):
try:
if self.jira_admin.create_project(project_key, project_name):
break
except JIRAError as e:
if "A project with that name already exists" not in str(e):
raise e |
I don't think the test manager is suppressing this error, it only ignores if the error message is relating to the project already existing |
Are you able to confirm the integer value the original code returns for your instance? |
My simplest test is the following: >>> j = JIRA(...)
>>> j._session.post(j._get_url("project"), data={"key": "X", "name": "XYZ", "leadAccountId": "xxx", "projectTypeKey": "software"})
<Response [201]>
>>> j._session.post(j._get_url("project"), data={"key": "X", "name": "XYZ", "leadAccountId": "xxx", "projectTypeKey": "software", "permissionScheme": 0}})
jira.exceptions.JIRAError: JiraError HTTP 500 url: https://xxx.atlassian.net/rest/api/2/project
text: Internal server error
response headers = {...}
response text = {"errorMessages":["Internal server error"],"errors":{}} Having the field |
I am running it against Jira Cloud Platform and the |
You're right , it doesn't look like it. I need more time to understand what is suppressing the 500. |
Co-authored-by: Adel Haddad <26027314+adehad@users.noreply.github.com>
Ok so I ran the Jira Cloud CI on my local env and it fails: ...
File "/tmp/jira/tests/conftest.py", line 255, in _create_project
if self.jira_admin.create_project(project_key, project_name): which is the following line: ...
if self.jira_admin.create_project(project_key, project_name): It begs the question of how is this not failing in this project? I ran the test suite against API v2: https://xxx.atlassian.net/rest/api/2 |
Do you have more details in the traceback? I also find it strange that if you are also a Jira admin that you are not able to reproduce the same behaviour |
Yes full stack trace below: ERROR tests.conftest:conftest.py:63 JiraError HTTP 500 url: https://xxx.atlassian.net/rest/api/2/project
text: Internal server error
response headers = {...}
response text = {"errorMessages":["Internal server error"],"errors":{}}
Traceback (most recent call last):
File "/tmp/jira/tests/conftest.py", line 58, in setUp
self.test_manager = JiraTestManager()
File "/tmp/jira/tests/conftest.py", line 156, in __init__
self.create_some_data()
File "/tmp/jira/tests/conftest.py", line 287, in create_some_data
self.project_a_id = self._create_project(self.project_a, self.project_a_name)
File "/tmp/jira/tests/conftest.py", line 259, in _create_project
raise e
File "/tmp/jira/tests/conftest.py", line 255, in _create_project
if self.jira_admin.create_project(project_key, project_name):
File "/tmp/jira/jira/client.py", line 4449, in create_project
r = self._session.post(url, data=json.dumps(payload))
File "/tmp/jira/.tox/py39/lib/python3.9/site-packages/requests/sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "/tmp/jira/jira/resilientsession.py", line 223, in request
elif raise_on_error(response, **processed_kwargs):
File "/tmp/jira/jira/resilientsession.py", line 69, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 500 url: https://xxx.atlassian.net/rest/api/2/project
text: Internal server error
response headers = {...}
response text = {"errorMessages":["Internal server error"],"errors":{}}
|
It fails with The simplest of tests is this: jira_admin=JIRA(...)
jira_admin.create_project("X", "XYZ") |
Very strange, if you are able to get logs from the Jira instance itself that might help us further, but unfortunately I am not sure why we are seeing this behaviour. |
Thing is, this is the Cloud . If it was a local server I could check the logs and we could compare server versions . But being a cloud instance, it should all be the same version but possibly isn't . I created my cloud environment less than a month ago. And bcs yours is older it could be linked to a different version. But I'm just guessing here since none of this is documented and I'm assuming your cloud environment does not raise 500. From here I can create an (extra) Jira ticket to report the situation . |
Ok as opposed to what I said yesterday, it does seem the cloud has a version linked to it. My cloud instance has the following properties: {'baseUrl': 'https://xxx.atlassian.net',
'buildDate': '2022-09-05T12:15:56.000+0000',
'buildNumber': 100206,
'defaultLocale': {'locale': 'en_US'},
'deploymentType': 'Cloud',
'scmInfo': '40f823cc9831469ea3c6decd06fddaf0ad67f8e2',
'serverTime': '2022-09-06T08:03:48.153+0000',
'serverTitle': 'Jira',
'version': '1001.0.0-SNAPSHOT',
'versionNumbers': [1001, 0, 0]} Please confirm that you are using an older version than mine. |
Sorry @rena2damas , have been swamped with work, just letting you know I haven't forgotten to look into this further |
@adehad no problem I myself been also busy but thanks nonetheless |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, could you add a test to verify this?
if permissionScheme is None: | ||
if permissionScheme is None and self._is_cloud: | ||
# Let Jira Cloud decide the default field due to issues in handling the | ||
# field. See https://bit.ly/3ALVqgo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think many people will open a random bit.ly address in some comments. could you paste the full URL here? It might look slightly uglier but at least people won't open this in a burner VM like I did :-D
issue: when a permissionScheme is specified , Jira cloud raises a 500 error