mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-02 09:47:46 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f679c54f2a |
@@ -597,7 +597,6 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
if err == nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to rename: mirror %s already exists", b.Name)
|
||||
}
|
||||
remote.Name = b.Name
|
||||
}
|
||||
|
||||
downloader := context.NewDownloader(out)
|
||||
|
||||
Vendored
+11
-12
@@ -185,18 +185,6 @@ filesystem_publish_endpoints:
|
||||
# # * size (compare file size)
|
||||
# verify_method: md5
|
||||
|
||||
# S3 Endpoint Support
|
||||
#
|
||||
# cloud storage). First, publishing
|
||||
# endpoints should be described in aptly configuration file. Each endpoint has name
|
||||
# and associated settings.
|
||||
#
|
||||
# In order to publish to S3, specify endpoint as `s3:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main s3:test:`
|
||||
#
|
||||
|
||||
# JFrog Artifactory Endpoint Support
|
||||
#
|
||||
# aptly can be configured to publish repositories directly to JFrog Artifactory. First,
|
||||
@@ -225,6 +213,17 @@ jfrog_publish_endpoints:
|
||||
# api_key: api_key
|
||||
# access_token: access_token
|
||||
|
||||
# S3 Endpoint Support
|
||||
#
|
||||
# cloud storage). First, publishing
|
||||
# endpoints should be described in aptly configuration file. Each endpoint has name
|
||||
# and associated settings.
|
||||
#
|
||||
# In order to publish to S3, specify endpoint as `s3:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main s3:test:`
|
||||
#
|
||||
s3_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
|
||||
@@ -279,78 +279,6 @@ class MirrorsAPITestEditArchiveURL(APITest):
|
||||
self.check_equal(resp.json()['ArchiveRoot'], 'http://repo.aptly.info/system-tests/ftp.ch.debian.org/debian/')
|
||||
|
||||
|
||||
class MirrorsAPITestRename(APITest):
|
||||
"""
|
||||
PUT /api/mirrors/:name - Rename mirror via update endpoint
|
||||
"""
|
||||
def check(self):
|
||||
mirror_name = self.random_name()
|
||||
mirror_desc = {'Name': mirror_name,
|
||||
'ArchiveURL': 'http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/',
|
||||
'IgnoreSignatures': True,
|
||||
'Distribution': 'wheezy',
|
||||
'Components': ['main'],
|
||||
'Architectures': ['amd64']}
|
||||
|
||||
resp = self.post("/api/mirrors", json=mirror_desc)
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
# Rename the mirror via PUT
|
||||
new_name = self.random_name()
|
||||
resp = self.put_task("/api/mirrors/" + mirror_name, json={'Name': new_name, 'IgnoreSignatures': True})
|
||||
self.check_task(resp)
|
||||
|
||||
# Old name should no longer exist
|
||||
resp = self.get("/api/mirrors/" + mirror_name)
|
||||
self.check_equal(resp.status_code, 404)
|
||||
|
||||
# New name should exist with correct data
|
||||
resp = self.get("/api/mirrors/" + new_name)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
self.check_subset({'Name': new_name,
|
||||
'ArchiveRoot': 'http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/',
|
||||
'Distribution': 'wheezy'}, resp.json())
|
||||
|
||||
|
||||
class MirrorsAPITestRenameConflict(APITest):
|
||||
"""
|
||||
PUT /api/mirrors/:name - Rename mirror to an already existing name should fail with 409
|
||||
"""
|
||||
def check(self):
|
||||
mirror_name_a = self.random_name()
|
||||
mirror_name_b = self.random_name()
|
||||
|
||||
mirror_desc_a = {'Name': mirror_name_a,
|
||||
'ArchiveURL': 'http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/',
|
||||
'IgnoreSignatures': True,
|
||||
'Distribution': 'wheezy',
|
||||
'Components': ['main'],
|
||||
'Architectures': ['amd64']}
|
||||
|
||||
mirror_desc_b = {'Name': mirror_name_b,
|
||||
'ArchiveURL': 'http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/',
|
||||
'IgnoreSignatures': True,
|
||||
'Distribution': 'wheezy',
|
||||
'Components': ['main'],
|
||||
'Architectures': ['amd64']}
|
||||
|
||||
resp = self.post("/api/mirrors", json=mirror_desc_a)
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
resp = self.post("/api/mirrors", json=mirror_desc_b)
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
# Try to rename mirror A to mirror B's name — should fail with 409
|
||||
resp = self.put("/api/mirrors/" + mirror_name_a, json={'Name': mirror_name_b, 'IgnoreSignatures': True})
|
||||
self.check_equal(resp.status_code, 409)
|
||||
self.check_in('unable to rename', resp.json()['error'])
|
||||
|
||||
# Mirror A should still exist under its original name
|
||||
resp = self.get("/api/mirrors/" + mirror_name_a)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
self.check_subset({'Name': mirror_name_a}, resp.json())
|
||||
|
||||
|
||||
class MirrorsAPITestEditFlatMirrorUdebs(APITest):
|
||||
"""
|
||||
POST /api/mirrors/{name} - Edit flat mirror with udebs (should fail)
|
||||
|
||||
Reference in New Issue
Block a user