Quantcast
Channel: Feed of "gitea/terraform-provider-gitea"
Viewing all articles
Browse latest Browse all 64

tobiasbp opened issue gitea/terraform-provider-gitea#34

$
0
0

UPDATE
I realize the issue is that orgs and users can not have the same name by design. The URLs would conflict:

  • gitea.org/<user>
  • gitea.org/<org>

However, it would be nice with more intuitive error message from Gitea.

Describe the bug
When creating an org and a user with the provider, and the same string is used for the org name and the user username, the user will not be created and Gitea (1.20.5 tested) returns the following error pq: duplicate key value violates unique constraint "UQE_user_lower_name".

This sounds to me like a problem with Gitea itself, not the provider. If other people agree with me on that, I will move this issue to the Gitea repository.

To Reproduce

resource "gitea_org" "delete_member_test" {  name = "conflicting_name"}resource "gitea_user" "delete_member_test" {  username   = "conflicting_name"  login_name = "test_user"  password   = "Geheim1!"  email      = "test@user.dev"}

Expected behavior
Both the org and the user should be created.

Log Output
Here is the request for the user creation and the response:

---[ REQUEST ]---------------------------------------POST /api/v1/orgs HTTP/1.1Host: gitea.example.comUser-Agent: Go-http-client/1.1Content-Length: 149Authorization: Basic ****content-type: application/jsonAccept-Encoding: gzip{"username": "conflicting_name","full_name": "","description": "","website": "","location": "","visibility": "public","repo_admin_change_team_access": true}-----------------------------------------------------: timestamp=2023-10-25T09:24:37.858+02002023-10-25T09:24:37.858+0200 [INFO]  provider.terraform-provider-gitea: 2023/10/25 09:24:37 [DEBUG] Gitea API Request Details:---[ REQUEST ]---------------------------------------POST /api/v1/admin/users HTTP/1.1Host: gitea.example.comUser-Agent: Go-http-client/1.1Content-Length: 200Authorization: Basic ****content-type: application/jsonAccept-Encoding: gzip{"source_id": 0,"login_name": "test_user","username": "conflicting_name","full_name": "","email": "test@user.dev","password": "Geheim1!","must_change_password": true,"send_notify": true,"visibility": "public"}-----------------------------------------------------: timestamp=2023-10-25T09:24:37.858+02002023-10-25T09:24:38.475+0200 [INFO]  provider.terraform-provider-gitea: 2023/10/25 09:24:38 [DEBUG] Gitea API Response Details:---[ RESPONSE ]--------------------------------------HTTP/2.0 500 Internal Server ErrorContent-Length: 160Cache-Control: max-age=0, private, must-revalidate, no-transformContent-Type: application/json;charset=utf-8Date: Wed, 25 Oct 2023 07:24:38 GMTStrict-Transport-Security: max-age=15724800; includeSubDomainsX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINX-Gitea-Debug: RUN_MODE=dev{"message": "pq: duplicate key value violates unique constraint \"UQE_user_lower_name\"","url": "https://gitea.example.com/api/swagger"}-----------------------------------------------------: timestamp=2023-10-25T09:24:38.475+02002023-10-25T09:24:38.475+0200 [INFO]  provider.terraform-provider-gitea: 2023/10/25 09:24:38 [DEBUG] Gitea API Response Details:---[ RESPONSE ]--------------------------------------HTTP/2.0 201 CreatedContent-Length: 292Cache-Control: max-age=0, private, must-revalidate, no-transformContent-Type: application/json;charset=utf-8Date: Wed, 25 Oct 2023 07:24:38 GMTStrict-Transport-Security: max-age=15724800; includeSubDomainsX-Content-Type-Options: nosniffX-Frame-Options: SAMEORIGINX-Gitea-Debug: RUN_MODE=dev{"id": 756,"name": "conflicting_name","full_name": "","avatar_url": "https://gitea.example.com/avatars/905b3cb78a3526863e9d2d958293d14f","description": "","website": "","location": "","visibility": "public","repo_admin_change_team_access": true,"username": "conflicting_name"}

Additional Data
Important for reproducability.

  • Terraform Version: v1.5.7

  • Operating System: Ubuntu Linux

  • Provider Version 0.3.0


Viewing all articles
Browse latest Browse all 64

Trending Articles