Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully. ``` (env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:05:50,432: creat_project: INFO: Projects post request status code: 201 2019-03-22 17:05:50,432: creat_project: INFO: Project created: { "url": "https://staging-qa-reports.linaro.org/api/projects/195/", "builds": "https://staging-qa-reports.linaro.org/api/projects/195/builds/", "id": 195, "full_name": "staging-lkft/lkft-gps-private", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": false, "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": "ltp", "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } ```
When creating the same project again, the following error returned. ``` (env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:06:02,309: creat_project: INFO: Projects post request status code: 400 2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$ ```
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
Any ideas why?
Thanks, Chase
On Fri, 22 Mar 2019 at 09:14, Chase Qi chase.qi@linaro.org wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:05:50,432: creat_project: INFO: Projects post request status code: 201 2019-03-22 17:05:50,432: creat_project: INFO: Project created: { "url": "https://staging-qa-reports.linaro.org/api/projects/195/", "builds": "https://staging-qa-reports.linaro.org/api/projects/195/builds/", "id": 195, "full_name": "staging-lkft/lkft-gps-private", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": false, "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": "ltp", "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" }
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:06:02,309: creat_project: INFO: Projects post request status code: 400 2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
I'm not able to reproduce it locally. How long do you have to wait to see the private project from your call?
milosz
Any ideas why?
Thanks, Chase _______________________________________________ Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev
Hi Milosz,
On Fri, Mar 22, 2019 at 7:22 PM Milosz Wasilewski milosz.wasilewski@linaro.org wrote:
On Fri, 22 Mar 2019 at 09:14, Chase Qi chase.qi@linaro.org wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:05:50,432: creat_project: INFO: Projects post request status code: 201 2019-03-22 17:05:50,432: creat_project: INFO: Project created: { "url": "https://staging-qa-reports.linaro.org/api/projects/195/", "builds": "https://staging-qa-reports.linaro.org/api/projects/195/builds/", "id": 195, "full_name": "staging-lkft/lkft-gps-private", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": false, "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": "ltp", "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" }
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private", "name": "lkft-gps-private", "is_public": "False", "html_mail": false, "moderate_notifications": false, "description": "", "important_metadata_keys": "build-url\r\ngit branch\r\ngit commit\r\ngit describe\r\ngit repo", "enabled_plugins_list": [ "ltp" ], "wait_before_notification": 600, "notification_timeout": 18000, "data_retention_days": 0, "project_settings": "{}", "custom_email_template": "https://staging-qa-reports.linaro.org/api/emailtemplates/1/" } 2019-03-22 17:06:02,309: creat_project: INFO: Projects post request status code: 400 2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
I'm not able to reproduce it locally. How long do you have to wait to see the private project from your call?
The lkft-gps-private was created 4 hours ago, I still cannot see it in the returned project list https://pastebin.linaro.org/view/b6406682 Once debug logging level enabled, the script show returned group and project list: ./create_project.py -p lkft-gps-private -P False -l DEBUG
What did you get with: ./create_project.py -p lkft-gps-private -P False ? did it return project already exists?
Thanks, Chase
milosz
Any ideas why?
Thanks, Chase _______________________________________________ Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
Hi Antonio,
On Fri, Mar 22, 2019 at 9:18 PM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
This is trying to simulate when user/ci use the script to create a project that already exist. This block of code https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L101 check if the project exist, if yes, then print existing projects and return. The problem is kft-gps-private doesn't appear in the returned projects. This line https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L132 to create project shouldn't be executed in this case.
Thanks, Chase
Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev
On Fri, Mar 22, 2019 at 09:24:27PM +0800, Chase Qi wrote:
Hi Antonio,
On Fri, Mar 22, 2019 at 9:18 PM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
This is trying to simulate when user/ci use the script to create a project that already exist. This block of code https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L101 check if the project exist, if yes, then print existing projects and return. The problem is kft-gps-private doesn't appear in the returned projects. This line https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L132 to create project shouldn't be executed in this case.
Ah! Ok, I understand now. What user are you using to call the API? I think there is a bug in the authorization code that is causing a mismatch between the permissions needed to create a project and the ones needed to be able to see it later if it's private.
On Sat, Mar 23, 2019 at 4:31 AM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 09:24:27PM +0800, Chase Qi wrote:
Hi Antonio,
On Fri, Mar 22, 2019 at 9:18 PM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
This is trying to simulate when user/ci use the script to create a project that already exist. This block of code https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L101 check if the project exist, if yes, then print existing projects and return. The problem is kft-gps-private doesn't appear in the returned projects. This line https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L132 to create project shouldn't be executed in this case.
Ah! Ok, I understand now. What user are you using to call the API? I
I am using the token genereated from here https://staging-qa-reports.linaro.org/_/settings/api-token/ . The one listed here for chase.qi https://staging-qa-reports.linaro.org/admin/authtoken/token/
Thanks, Chase
think there is a bug in the authorization code that is causing a mismatch between the permissions needed to create a project and the ones needed to be able to see it later if it's private. _______________________________________________ Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev
Antonio figured it is caused by an issue in my script. The issue has been resolved by https://github.com/chase-qi/tools/commit/f1e20595a6d22d97dbbb4816bd99f33046f...
Thanks, Chase
On Mon, Mar 25, 2019 at 9:54 AM Chase Qi chase.qi@linaro.org wrote:
On Sat, Mar 23, 2019 at 4:31 AM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 09:24:27PM +0800, Chase Qi wrote:
Hi Antonio,
On Fri, Mar 22, 2019 at 9:18 PM Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
This is trying to simulate when user/ci use the script to create a project that already exist. This block of code https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L101 check if the project exist, if yes, then print existing projects and return. The problem is kft-gps-private doesn't appear in the returned projects. This line https://github.com/chase-qi/tools/blob/master/squad/create_project.py#L132 to create project shouldn't be executed in this case.
Ah! Ok, I understand now. What user are you using to call the API? I
I am using the token genereated from here https://staging-qa-reports.linaro.org/_/settings/api-token/ . The one listed here for chase.qi https://staging-qa-reports.linaro.org/admin/authtoken/token/
Thanks, Chase
think there is a bug in the authorization code that is causing a mismatch between the permissions needed to create a project and the ones needed to be able to see it later if it's private. _______________________________________________ Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev
On Fri, 22 Mar 2019 at 13:18, Antonio Terceiro antonio.terceiro@linaro.org wrote:
On Fri, Mar 22, 2019 at 05:14:20PM +0800, Chase Qi wrote:
Hi,
I wrote the script https://github.com/chase-qi/tools/blob/master/squad/create_project.py to create squad project if it doesn't exist. It works fine with public project, but doesn't work well with private project. The reason is it fails to get the new created private project.
For the first time, private project can be created successfully.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:44,699: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:46,745: get_list: INFO: projects get request status code: 200 2019-03-22 17:05:48,797: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...]
When creating the same project again, the following error returned.
(env) cq@tp:~/github/chase-qi/tools/squad$ ./create_project.py -p lkft-gps-private -P False 2019-03-22 17:05:56,582: get_list: INFO: groups get request status code: 200 2019-03-22 17:05:58,628: get_list: INFO: projects get request status code: 200 2019-03-22 17:06:00,674: main: INFO: Data to POST: { "group": "https://staging-qa-reports.linaro.org/api/groups/5/", "slug": "lkft-gps-private",
[...] [...]
2019-03-22 17:06:02,310: creat_project: INFO: Project created: { "non_field_errors": [ "The fields group, slug must make a unique set." ] } (env) cq@tp:~/github/chase-qi/tools/squad$
The script able to check if the project to create already exist by comparing the project name with the existing projects. `However, requests.get(url, headers=headers)` only return public project and old existing private project, it doesn't return the new created private ones.
In this example you are trying to craete two projects with the same name(slug) "lkft-gps-private" under the same project (5). You cannot do that, and that's exactly what the error message you got is saying.
Antonio,
The script checks if the project you're trying to setup already exists. If it exists, there is no attempt to create it again. What Chase says is that API on staging doesn't show the newly created projects. I can't reproduce it locally. When I call the script with the same project name again it simply says the project already exists. Will try on staging.
milosz
Squad-dev mailing list Squad-dev@lists.linaro.org https://lists.linaro.org/mailman/listinfo/squad-dev