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