aptly icon indicating copy to clipboard operation
aptly copied to clipboard

API: HTTP 404 on PUT repo update request

Open cchazalet opened this issue 8 months ago • 0 comments

Description

I try to update repositories via API PUT request but the API throws HTTP 404 with no answer.

The repo exists.

# curl http://localhost:8080/api/repos/bookworm--stable--main | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    93  100    93    0     0   6200      0 --:--:-- --:--:-- --:--:--  6200
{
  "Name": "bookworm--stable--main",
  "Comment": "",
  "DefaultDistribution": "",
  "DefaultComponent": ""
}

repo update command :

# curl -v -X PUT -H 'Content-Type: application/json' http://localhost:8080/api/repos/bookworm--stable--main -d '{"Name": "bookworm--stable--main", "Comment": "test", "DefaultComponent": "", "DefaultDistribution": ""}' | jq .
* Expire in 0 ms for 6 (transfer 0x5600fb299490)
* Expire in 1 ms for 1 (transfer 0x5600fb299490)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Expire in 0 ms for 1 (transfer 0x5600fb299490)
* Expire in 1 ms for 1 (transfer 0x5600fb299490)
* Expire in 0 ms for 1 (transfer 0x5600fb299490)
* Expire in 0 ms for 1 (transfer 0x5600fb299490)
* Expire in 1 ms for 1 (transfer 0x5600fb299490)
* Expire in 0 ms for 1 (transfer 0x5600fb299490)
* Expire in 0 ms for 1 (transfer 0x5600fb299490)
* Expire in 0 ms for 1 (transfer 0x5600fb299490)
*   Trying ::1...
* TCP_NODELAY set
* Expire in 149999 ms for 3 (transfer 0x5600fb299490)
* Expire in 200 ms for 4 (transfer 0x5600fb299490)
* connect to ::1 port 8080 failed: Connexion refusée
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 149999 ms for 3 (transfer 0x5600fb299490)
* Connected to localhost (127.0.0.1) port 8080 (#0)
> PUT /api/repos/bookworm--stable--main HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.64.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 104
>
} [104 bytes data]
* upload completely sent off: 104 out of 104 bytes
< HTTP/1.1 404 Not Found
< Content-Type: application/json; charset=utf-8
< Date: Fri, 09 May 2025 09:30:28 GMT
< Content-Length: 0
<
100   104    0     0  100   104      0   6500 --:--:-- --:--:-- --:--:--  6500
* Connection #0 to host localhost left intact

logs aptly-api service when I execute commande PUT api

mai 09 11:30:28 build.dev aptly[587]: 2025/05/09 11:30:28 [Recovery] 2025/05/09 - 11:30:28 panic recovered:
mai 09 11:30:28 build.dev aptly[587]: err is nil
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:227 (0x55fffbac3611)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:213 (0x55fffbac3458)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/api/api.go:327 (0x55fffc382ac6)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/api/repos.go:206 (0x55fffc3939c6)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x55fffc3a1ba3)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/api/router.go:118 (0x55fffc3a1b76)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x55fffbac326a)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:172 (0x55fffc39b584)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x55fffbacfef9)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x55fffbacfee7)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x55fffbacf03c)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 (0x55fffbacf023)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x55fffbace52d)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x55fffbace1bc)
mai 09 11:30:28 build.dev aptly[587]: /__w/aptly/aptly/.go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x55fffbacdcf1)
mai 09 11:30:28 build.dev aptly[587]: /__t/go/1.22.7/x64/src/net/http/server.go:3142 (0x55fffb7b01ad)
mai 09 11:30:28 build.dev aptly[587]: /__t/go/1.22.7/x64/src/net/http/server.go:2044 (0x55fffb7ab487)
mai 09 11:30:28 build.dev aptly[587]: /__t/go/1.22.7/x64/src/runtime/asm_amd64.s:1695 (0x55fffb438d00)
mai 09 11:30:28 build.dev aptly[587]:
mai 09 11:30:28 build.dev aptly[587]: [GIN] 2025/05/09 - 11:30:28 | 404 |    15.08209ms |       127.0.0.1 | PUT      "/api/repos/bookworm--stable--main"

Context

# aptly version
aptly version: 1.6.1
# cat /etc/debian_version
11.11
# dpkg -l | grep aptly
ii  aptly                                           1.6.1                              amd64        Swiss army knife for Debian repository management - main package
ii  aptly-api                                       1.6.1                              amd64        Swiss army knife for Debian repository management - API
ii  aptly-dbg                                       1.6.1                              amd64        Debian repository management tool (debug files)
ii  python3-aptly                                   0.12.10-2                          all          Aptly REST API client and useful tooling - Python 3.x
ii  python3-aptly-api-client                        0.2.4-2                            all          Python 3 client for the Aptly API

cchazalet avatar May 09 '25 09:05 cchazalet