Merge branch 'master' into tautological_condition

This commit is contained in:
JupiterRider
2025-08-30 18:51:27 +02:00
committed by GitHub
22 changed files with 524 additions and 214 deletions
+1
View File
@@ -71,3 +71,4 @@ List of contributors, in chronological order:
* Silke Hofstra (https://github.com/silkeh) * Silke Hofstra (https://github.com/silkeh)
* Itay Porezky (https://github.com/itayporezky) * Itay Porezky (https://github.com/itayporezky)
* JupiterRider (https://github.com/JupiterRider) * JupiterRider (https://github.com/JupiterRider)
* Agustin Henze (https://github.com/agustinhenze)
+2 -2
View File
@@ -63,7 +63,7 @@ Define Release APT sources in ``/etc/apt/sources.list.d/aptly.list``::
deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/release DIST main deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/release DIST main
Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble`` Where DIST is one of: ``bullseye``, ``bookworm``, ``trixie``, ``focal``, ``jammy``, ``noble``
Install aptly packages:: Install aptly packages::
@@ -80,7 +80,7 @@ Define CI APT sources in ``/etc/apt/sources.list.d/aptly-ci.list``::
deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci DIST main deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci DIST main
Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble`` Where DIST is one of: ``bullseye``, ``bookworm``, ``trixie``, ``focal``, ``jammy``, ``noble``
Note: same gpg key is used as for the Upstream Debian Packages. Note: same gpg key is used as for the Upstream Debian Packages.
+1 -1
View File
@@ -104,7 +104,7 @@ func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error) {
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "error creating tempfile for %s", path) return nil, errors.Wrapf(err, "error creating tempfile for %s", path)
} }
defer func () { _ = os.Remove(temp.Name()) }() defer func() { _ = os.Remove(temp.Name()) }()
_, err = pool.az.client.DownloadFile(context.TODO(), pool.az.container, path, temp, nil) _, err = pool.az.client.DownloadFile(context.TODO(), pool.az.container, path, temp, nil)
if err != nil { if err != nil {
+1 -1
View File
@@ -1,13 +1,13 @@
package azure package azure
import ( import (
"bytes"
"context" "context"
"crypto/md5" "crypto/md5"
"crypto/rand" "crypto/rand"
"io" "io"
"os" "os"
"path/filepath" "path/filepath"
"bytes"
"github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob" "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
+1 -1
View File
@@ -11,7 +11,7 @@ func Test(t *testing.T) {
TestingT(t) TestingT(t)
} }
type ProgressSuite struct {} type ProgressSuite struct{}
var _ = Suite(&ProgressSuite{}) var _ = Suite(&ProgressSuite{})
-1
View File
@@ -156,4 +156,3 @@ func (s *EtcDDBSuite) TestTransactionCommit(c *C) {
_, err = transaction.Get(key) _, err = transaction.Get(key)
c.Assert(err, NotNil) c.Assert(err, NotNil)
} }
-1
View File
@@ -31,7 +31,6 @@ func BenchmarkSnapshotCollectionForEach(b *testing.B) {
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
collection = NewSnapshotCollection(db) collection = NewSnapshotCollection(db)
_ = collection.ForEach(func(s *Snapshot) error { _ = collection.ForEach(func(s *Snapshot) error {
return nil return nil
}) })
+283
View File
@@ -0,0 +1,283 @@
package files
import (
"fmt"
"os"
"path/filepath"
"sync"
"time"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
. "gopkg.in/check.v1"
)
type LinkFromPoolConcurrencySuite struct {
root string
poolDir string
storage *PublishedStorage
pool *PackagePool
cs aptly.ChecksumStorage
testFile string
testContent []byte
testChecksums utils.ChecksumInfo
srcPoolPath string
}
var _ = Suite(&LinkFromPoolConcurrencySuite{})
func (s *LinkFromPoolConcurrencySuite) SetUpTest(c *C) {
s.root = c.MkDir()
s.poolDir = filepath.Join(s.root, "pool")
publishDir := filepath.Join(s.root, "public")
// Create package pool and published storage
s.pool = NewPackagePool(s.poolDir, true)
s.storage = NewPublishedStorage(publishDir, "copy", "checksum")
s.cs = NewMockChecksumStorage()
// Create test file content
s.testContent = []byte("test package content for concurrency testing")
s.testFile = filepath.Join(s.root, "test-package.deb")
err := os.WriteFile(s.testFile, s.testContent, 0644)
c.Assert(err, IsNil)
// Calculate checksums
md5sum, err := utils.MD5ChecksumForFile(s.testFile)
c.Assert(err, IsNil)
s.testChecksums = utils.ChecksumInfo{
Size: int64(len(s.testContent)),
MD5: md5sum,
}
// Import the test file into the pool
s.srcPoolPath, err = s.pool.Import(s.testFile, "test-package.deb", &s.testChecksums, false, s.cs)
c.Assert(err, IsNil)
}
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolConcurrency(c *C) {
// Test concurrent LinkFromPool operations to ensure no race conditions
concurrency := 5000
iterations := 10
for iter := 0; iter < iterations; iter++ {
c.Logf("Iteration %d: Testing concurrent LinkFromPool with %d goroutines", iter+1, concurrency)
destPath := fmt.Sprintf("main/t/test%d", iter)
var wg sync.WaitGroup
errors := make(chan error, concurrency)
successes := make(chan struct{}, concurrency)
start := time.Now()
// Launch concurrent LinkFromPool operations
for i := 0; i < concurrency; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
// Use force=true to test the most vulnerable code path (remove-then-create)
err := s.storage.LinkFromPool(
"", // publishedPrefix
destPath, // publishedRelPath
"test-package.deb", // fileName
s.pool, // sourcePool
s.srcPoolPath, // sourcePath
s.testChecksums, // sourceChecksums
true, // force - this triggers vulnerable remove-then-create pattern
)
if err != nil {
errors <- fmt.Errorf("goroutine %d failed: %v", id, err)
} else {
successes <- struct{}{}
}
}(i)
}
// Wait for completion
wg.Wait()
duration := time.Since(start)
close(errors)
close(successes)
// Count results
errorCount := 0
successCount := 0
var firstError error
for err := range errors {
errorCount++
if firstError == nil {
firstError = err
}
c.Logf("Race condition error: %v", err)
}
for range successes {
successCount++
}
c.Logf("Results: %d successes, %d errors, took %v", successCount, errorCount, duration)
// Assert no race conditions occurred
if errorCount > 0 {
c.Fatalf("Race condition detected in iteration %d! "+
"Errors: %d out of %d operations (%.1f%% failure rate). "+
"First error: %v. "+
"This indicates the fix is not working properly.",
iter+1, errorCount, concurrency,
float64(errorCount)/float64(concurrency)*100, firstError)
}
// Verify the final file exists and has correct content
finalFile := filepath.Join(s.storage.rootPath, destPath, "test-package.deb")
_, err := os.Stat(finalFile)
c.Assert(err, IsNil, Commentf("Final file should exist after concurrent operations"))
content, err := os.ReadFile(finalFile)
c.Assert(err, IsNil, Commentf("Should be able to read final file"))
c.Assert(content, DeepEquals, s.testContent, Commentf("File content should be intact after concurrent operations"))
c.Logf("✓ Iteration %d: No race conditions detected", iter+1)
}
c.Logf("SUCCESS: Handled %d total concurrent operations across %d iterations with no race conditions",
concurrency*iterations, iterations)
}
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolConcurrencyDifferentFiles(c *C) {
// Test concurrent operations on different files to ensure no blocking
concurrency := 10
var wg sync.WaitGroup
errors := make(chan error, concurrency)
start := time.Now()
// Launch concurrent operations on different destination files
for i := 0; i < concurrency; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
destPath := fmt.Sprintf("main/t/test-file-%d", id)
err := s.storage.LinkFromPool(
"", // publishedPrefix
destPath, // publishedRelPath
"test-package.deb", // fileName
s.pool, // sourcePool
s.srcPoolPath, // sourcePath
s.testChecksums, // sourceChecksums
false, // force
)
if err != nil {
errors <- fmt.Errorf("goroutine %d failed: %v", id, err)
}
}(i)
}
// Wait for completion
wg.Wait()
duration := time.Since(start)
close(errors)
// Count errors
errorCount := 0
for err := range errors {
errorCount++
c.Logf("Error: %v", err)
}
c.Assert(errorCount, Equals, 0, Commentf("No errors should occur when linking to different files"))
c.Logf("SUCCESS: %d concurrent operations on different files completed in %v", concurrency, duration)
// Verify all files were created correctly
for i := 0; i < concurrency; i++ {
finalFile := filepath.Join(s.storage.rootPath, fmt.Sprintf("main/t/test-file-%d", i), "test-package.deb")
_, err := os.Stat(finalFile)
c.Assert(err, IsNil, Commentf("File %d should exist", i))
content, err := os.ReadFile(finalFile)
c.Assert(err, IsNil, Commentf("Should be able to read file %d", i))
c.Assert(content, DeepEquals, s.testContent, Commentf("File %d content should be correct", i))
}
}
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolWithoutForceNoConcurrencyIssues(c *C) {
// Test that when force=false, concurrent operations fail gracefully without corruption
concurrency := 20
destPath := "main/t/single-dest"
var wg sync.WaitGroup
errors := make(chan error, concurrency)
successes := make(chan struct{}, concurrency)
// First, create the file so subsequent operations will conflict
err := s.storage.LinkFromPool("", destPath, "test-package.deb", s.pool, s.srcPoolPath, s.testChecksums, false)
c.Assert(err, IsNil)
start := time.Now()
// Launch concurrent operations that should mostly fail
for i := 0; i < concurrency; i++ {
wg.Add(1)
go func(id int) {
defer wg.Done()
err := s.storage.LinkFromPool(
"", // publishedPrefix
destPath, // publishedRelPath
"test-package.deb", // fileName
s.pool, // sourcePool
s.srcPoolPath, // sourcePath
s.testChecksums, // sourceChecksums
false, // force=false - should fail if file exists and is same
)
if err != nil {
errors <- err
} else {
successes <- struct{}{}
}
}(i)
}
// Wait for completion
wg.Wait()
duration := time.Since(start)
close(errors)
close(successes)
errorCount := 0
successCount := 0
for range errors {
errorCount++
}
for range successes {
successCount++
}
c.Logf("Results with force=false: %d successes, %d errors, took %v", successCount, errorCount, duration)
// With force=false and identical files, operations should succeed (file already exists with same content)
// No race conditions should cause crashes or corruption
c.Assert(errorCount, Equals, 0, Commentf("With identical files and force=false, operations should succeed"))
// Verify the file still exists and has correct content
finalFile := filepath.Join(s.storage.rootPath, destPath, "test-package.deb")
content, err := os.ReadFile(finalFile)
c.Assert(err, IsNil)
c.Assert(content, DeepEquals, s.testContent, Commentf("File should not be corrupted by concurrent access"))
}
+33 -7
View File
@@ -22,6 +22,26 @@ type PublishedStorage struct {
verifyMethod uint verifyMethod uint
} }
// Global mutex map to prevent concurrent access to the same destinationPath in LinkFromPool
var (
fileLockMutex sync.Mutex
fileLocks = make(map[string]*sync.Mutex)
)
// getFileLock returns a mutex for a specific file path to prevent concurrent modifications
func getFileLock(filePath string) *sync.Mutex {
fileLockMutex.Lock()
defer fileLockMutex.Unlock()
if mutex, exists := fileLocks[filePath]; exists {
return mutex
}
mutex := &sync.Mutex{}
fileLocks[filePath] = mutex
return mutex
}
// Check interfaces // Check interfaces
var ( var (
_ aptly.PublishedStorage = (*PublishedStorage)(nil) _ aptly.PublishedStorage = (*PublishedStorage)(nil)
@@ -136,6 +156,12 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
baseName := filepath.Base(fileName) baseName := filepath.Base(fileName)
poolPath := filepath.Join(storage.rootPath, publishedPrefix, publishedRelPath, filepath.Dir(fileName)) poolPath := filepath.Join(storage.rootPath, publishedPrefix, publishedRelPath, filepath.Dir(fileName))
destinationPath := filepath.Join(poolPath, baseName)
// Acquire file-specific lock to prevent concurrent access to the same file
fileLock := getFileLock(destinationPath)
fileLock.Lock()
defer fileLock.Unlock()
var localSourcePool aptly.LocalPackagePool var localSourcePool aptly.LocalPackagePool
if storage.linkMethod != LinkMethodCopy { if storage.linkMethod != LinkMethodCopy {
@@ -154,7 +180,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
var dstStat os.FileInfo var dstStat os.FileInfo
dstStat, err = os.Stat(filepath.Join(poolPath, baseName)) dstStat, err = os.Stat(destinationPath)
if err == nil { if err == nil {
// already exists, check source file // already exists, check source file
@@ -173,7 +199,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
} else { } else {
// if source and destination have the same checksums, no need to copy // if source and destination have the same checksums, no need to copy
var dstMD5 string var dstMD5 string
dstMD5, err = utils.MD5ChecksumForFile(filepath.Join(poolPath, baseName)) dstMD5, err = utils.MD5ChecksumForFile(destinationPath)
if err != nil { if err != nil {
return err return err
@@ -204,11 +230,11 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
// source and destination have different inodes, if !forced, this is fatal error // source and destination have different inodes, if !forced, this is fatal error
if !force { if !force {
return fmt.Errorf("error linking file to %s: file already exists and is different", filepath.Join(poolPath, baseName)) return fmt.Errorf("error linking file to %s: file already exists and is different", destinationPath)
} }
// forced, so remove destination // forced, so remove destination
err = os.Remove(filepath.Join(poolPath, baseName)) err = os.Remove(destinationPath)
if err != nil { if err != nil {
return err return err
} }
@@ -223,7 +249,7 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
} }
var dst *os.File var dst *os.File
dst, err = os.Create(filepath.Join(poolPath, baseName)) dst, err = os.Create(destinationPath)
if err != nil { if err != nil {
_ = r.Close() _ = r.Close()
return err return err
@@ -244,9 +270,9 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
err = dst.Close() err = dst.Close()
} else if storage.linkMethod == LinkMethodSymLink { } else if storage.linkMethod == LinkMethodSymLink {
err = localSourcePool.Symlink(sourcePath, filepath.Join(poolPath, baseName)) err = localSourcePool.Symlink(sourcePath, destinationPath)
} else { } else {
err = localSourcePool.Link(sourcePath, filepath.Join(poolPath, baseName)) err = localSourcePool.Link(sourcePath, destinationPath)
} }
return err return err
+1
View File
@@ -1,3 +1,4 @@
//go:build !go1.7
// +build !go1.7 // +build !go1.7
package http package http
+8 -8
View File
@@ -136,14 +136,14 @@ func (d *GrabDownloader) download(_ context.Context, url string, destination str
<-resp.Done <-resp.Done
// download is complete // download is complete
// Loop: // Loop:
// for { // for {
// select { // select {
// case <-resp.Done: // case <-resp.Done:
// // download is complete // // download is complete
// break Loop // break Loop
// } // }
// } // }
err = resp.Err() err = resp.Err()
if err != nil && err == grab.ErrBadChecksum && ignoreMismatch { if err != nil && err == grab.ErrBadChecksum && ignoreMismatch {
fmt.Printf("Ignoring checksum mismatch for %s\n", url) fmt.Printf("Ignoring checksum mismatch for %s\n", url)
+6 -5
View File
@@ -112,9 +112,11 @@ func NewServer(config *Config) (*Server, error) {
buckets: make(map[string]*bucket), buckets: make(map[string]*bucket),
config: config, config: config,
} }
go func() { _ = http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { go func() {
_ = http.Serve(l, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
srv.serveHTTP(w, req) srv.serveHTTP(w, req)
})) }() }))
}()
return srv, nil return srv, nil
} }
@@ -527,14 +529,13 @@ func (bucketResource) post(a *action) interface{} {
// and dashes (-). You can use uppercase letters for buckets only in the // and dashes (-). You can use uppercase letters for buckets only in the
// US Standard region. // US Standard region.
// //
// Must start with a number or letter // # Must start with a number or letter
// //
// Must be between 3 and 255 characters long // # Must be between 3 and 255 characters long
// //
// There's one extra rule (Must not be formatted as an IP address (e.g., 192.168.5.4) // There's one extra rule (Must not be formatted as an IP address (e.g., 192.168.5.4)
// but the real S3 server does not seem to check that rule, so we will not // but the real S3 server does not seem to check that rule, so we will not
// check it either. // check it either.
//
func validBucketName(name string) bool { func validBucketName(name string) bool {
if len(name) < 3 || len(name) > 255 { if len(name) < 3 || len(name) > 255 {
return false return false
+125 -125
View File
@@ -71,93 +71,93 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
_, _ = f.Read(buf) _, _ = f.Read(buf)
c.Check(string(buf), Equals, ""+ c.Check(string(buf), Equals, ""+
"{\n" + "{\n"+
" \"rootDir\": \"/tmp/aptly\",\n" + " \"rootDir\": \"/tmp/aptly\",\n"+
" \"logLevel\": \"info\",\n" + " \"logLevel\": \"info\",\n"+
" \"logFormat\": \"json\",\n" + " \"logFormat\": \"json\",\n"+
" \"databaseOpenAttempts\": 5,\n" + " \"databaseOpenAttempts\": 5,\n"+
" \"architectures\": null,\n" + " \"architectures\": null,\n"+
" \"skipLegacyPool\": false,\n" + " \"skipLegacyPool\": false,\n"+
" \"dependencyFollowSuggests\": false,\n" + " \"dependencyFollowSuggests\": false,\n"+
" \"dependencyFollowRecommends\": false,\n" + " \"dependencyFollowRecommends\": false,\n"+
" \"dependencyFollowAllVariants\": false,\n" + " \"dependencyFollowAllVariants\": false,\n"+
" \"dependencyFollowSource\": false,\n" + " \"dependencyFollowSource\": false,\n"+
" \"dependencyVerboseResolve\": false,\n" + " \"dependencyVerboseResolve\": false,\n"+
" \"ppaDistributorID\": \"\",\n" + " \"ppaDistributorID\": \"\",\n"+
" \"ppaCodename\": \"\",\n" + " \"ppaCodename\": \"\",\n"+
" \"serveInAPIMode\": false,\n" + " \"serveInAPIMode\": false,\n"+
" \"enableMetricsEndpoint\": false,\n" + " \"enableMetricsEndpoint\": false,\n"+
" \"enableSwaggerEndpoint\": false,\n" + " \"enableSwaggerEndpoint\": false,\n"+
" \"AsyncAPI\": false,\n" + " \"AsyncAPI\": false,\n"+
" \"databaseBackend\": {\n" + " \"databaseBackend\": {\n"+
" \"type\": \"\",\n" + " \"type\": \"\",\n"+
" \"dbPath\": \"\",\n" + " \"dbPath\": \"\",\n"+
" \"url\": \"\"\n" + " \"url\": \"\"\n"+
" },\n" + " },\n"+
" \"downloader\": \"\",\n" + " \"downloader\": \"\",\n"+
" \"downloadConcurrency\": 5,\n" + " \"downloadConcurrency\": 5,\n"+
" \"downloadSpeedLimit\": 0,\n" + " \"downloadSpeedLimit\": 0,\n"+
" \"downloadRetries\": 0,\n" + " \"downloadRetries\": 0,\n"+
" \"downloadSourcePackages\": false,\n" + " \"downloadSourcePackages\": false,\n"+
" \"gpgProvider\": \"gpg\",\n" + " \"gpgProvider\": \"gpg\",\n"+
" \"gpgDisableSign\": false,\n" + " \"gpgDisableSign\": false,\n"+
" \"gpgDisableVerify\": false,\n" + " \"gpgDisableVerify\": false,\n"+
" \"skipContentsPublishing\": false,\n" + " \"skipContentsPublishing\": false,\n"+
" \"skipBz2Publishing\": false,\n" + " \"skipBz2Publishing\": false,\n"+
" \"FileSystemPublishEndpoints\": {\n" + " \"FileSystemPublishEndpoints\": {\n"+
" \"test\": {\n" + " \"test\": {\n"+
" \"rootDir\": \"/opt/aptly-publish\",\n" + " \"rootDir\": \"/opt/aptly-publish\",\n"+
" \"linkMethod\": \"\",\n" + " \"linkMethod\": \"\",\n"+
" \"verifyMethod\": \"\"\n" + " \"verifyMethod\": \"\"\n"+
" }\n" + " }\n"+
" },\n" + " },\n"+
" \"S3PublishEndpoints\": {\n" + " \"S3PublishEndpoints\": {\n"+
" \"test\": {\n" + " \"test\": {\n"+
" \"region\": \"us-east-1\",\n" + " \"region\": \"us-east-1\",\n"+
" \"bucket\": \"repo\",\n" + " \"bucket\": \"repo\",\n"+
" \"prefix\": \"\",\n" + " \"prefix\": \"\",\n"+
" \"acl\": \"\",\n" + " \"acl\": \"\",\n"+
" \"awsAccessKeyID\": \"\",\n" + " \"awsAccessKeyID\": \"\",\n"+
" \"awsSecretAccessKey\": \"\",\n" + " \"awsSecretAccessKey\": \"\",\n"+
" \"awsSessionToken\": \"\",\n" + " \"awsSessionToken\": \"\",\n"+
" \"endpoint\": \"\",\n" + " \"endpoint\": \"\",\n"+
" \"storageClass\": \"\",\n" + " \"storageClass\": \"\",\n"+
" \"encryptionMethod\": \"\",\n" + " \"encryptionMethod\": \"\",\n"+
" \"plusWorkaround\": false,\n" + " \"plusWorkaround\": false,\n"+
" \"disableMultiDel\": false,\n" + " \"disableMultiDel\": false,\n"+
" \"forceSigV2\": false,\n" + " \"forceSigV2\": false,\n"+
" \"forceVirtualHostedStyle\": false,\n" + " \"forceVirtualHostedStyle\": false,\n"+
" \"debug\": false\n" + " \"debug\": false\n"+
" }\n" + " }\n"+
" },\n" + " },\n"+
" \"SwiftPublishEndpoints\": {\n" + " \"SwiftPublishEndpoints\": {\n"+
" \"test\": {\n" + " \"test\": {\n"+
" \"container\": \"repo\",\n" + " \"container\": \"repo\",\n"+
" \"prefix\": \"\",\n" + " \"prefix\": \"\",\n"+
" \"osname\": \"\",\n" + " \"osname\": \"\",\n"+
" \"password\": \"\",\n" + " \"password\": \"\",\n"+
" \"tenant\": \"\",\n" + " \"tenant\": \"\",\n"+
" \"tenantid\": \"\",\n" + " \"tenantid\": \"\",\n"+
" \"domain\": \"\",\n" + " \"domain\": \"\",\n"+
" \"domainid\": \"\",\n" + " \"domainid\": \"\",\n"+
" \"tenantdomain\": \"\",\n" + " \"tenantdomain\": \"\",\n"+
" \"tenantdomainid\": \"\",\n" + " \"tenantdomainid\": \"\",\n"+
" \"authurl\": \"\"\n" + " \"authurl\": \"\"\n"+
" }\n" + " }\n"+
" },\n" + " },\n"+
" \"AzurePublishEndpoints\": {\n" + " \"AzurePublishEndpoints\": {\n"+
" \"test\": {\n" + " \"test\": {\n"+
" \"container\": \"repo\",\n" + " \"container\": \"repo\",\n"+
" \"prefix\": \"\",\n" + " \"prefix\": \"\",\n"+
" \"accountName\": \"\",\n" + " \"accountName\": \"\",\n"+
" \"accountKey\": \"\",\n" + " \"accountKey\": \"\",\n"+
" \"endpoint\": \"\"\n" + " \"endpoint\": \"\"\n"+
" }\n" + " }\n"+
" },\n" + " },\n"+
" \"packagePoolStorage\": {\n" + " \"packagePoolStorage\": {\n"+
" \"type\": \"local\",\n" + " \"type\": \"local\",\n"+
" \"path\": \"/tmp/aptly-pool\"\n" + " \"path\": \"/tmp/aptly-pool\"\n"+
" }\n" + " }\n"+
"}") "}")
} }
@@ -237,44 +237,44 @@ func (s *ConfigSuite) TestSaveYAML2Config(c *C) {
buf := make([]byte, st.Size()) buf := make([]byte, st.Size())
_, _ = f.Read(buf) _, _ = f.Read(buf)
c.Check(string(buf), Equals, "" + c.Check(string(buf), Equals, ""+
"root_dir: \"\"\n" + "root_dir: \"\"\n"+
"log_level: \"\"\n" + "log_level: \"\"\n"+
"log_format: \"\"\n" + "log_format: \"\"\n"+
"database_open_attempts: 0\n" + "database_open_attempts: 0\n"+
"architectures: []\n" + "architectures: []\n"+
"skip_legacy_pool: false\n" + "skip_legacy_pool: false\n"+
"dep_follow_suggests: false\n" + "dep_follow_suggests: false\n"+
"dep_follow_recommends: false\n" + "dep_follow_recommends: false\n"+
"dep_follow_all_variants: false\n" + "dep_follow_all_variants: false\n"+
"dep_follow_source: false\n" + "dep_follow_source: false\n"+
"dep_verboseresolve: false\n" + "dep_verboseresolve: false\n"+
"ppa_distributor_id: \"\"\n" + "ppa_distributor_id: \"\"\n"+
"ppa_codename: \"\"\n" + "ppa_codename: \"\"\n"+
"serve_in_api_mode: false\n" + "serve_in_api_mode: false\n"+
"enable_metrics_endpoint: false\n" + "enable_metrics_endpoint: false\n"+
"enable_swagger_endpoint: false\n" + "enable_swagger_endpoint: false\n"+
"async_api: false\n" + "async_api: false\n"+
"database_backend:\n" + "database_backend:\n"+
" type: \"\"\n" + " type: \"\"\n"+
" db_path: \"\"\n" + " db_path: \"\"\n"+
" url: \"\"\n" + " url: \"\"\n"+
"downloader: \"\"\n" + "downloader: \"\"\n"+
"download_concurrency: 0\n" + "download_concurrency: 0\n"+
"download_limit: 0\n" + "download_limit: 0\n"+
"download_retries: 0\n" + "download_retries: 0\n"+
"download_sourcepackages: false\n" + "download_sourcepackages: false\n"+
"gpg_provider: \"\"\n" + "gpg_provider: \"\"\n"+
"gpg_disable_sign: false\n" + "gpg_disable_sign: false\n"+
"gpg_disable_verify: false\n" + "gpg_disable_verify: false\n"+
"skip_contents_publishing: false\n" + "skip_contents_publishing: false\n"+
"skip_bz2_publishing: false\n" + "skip_bz2_publishing: false\n"+
"filesystem_publish_endpoints: {}\n" + "filesystem_publish_endpoints: {}\n"+
"s3_publish_endpoints: {}\n" + "s3_publish_endpoints: {}\n"+
"swift_publish_endpoints: {}\n" + "swift_publish_endpoints: {}\n"+
"azure_publish_endpoints: {}\n" + "azure_publish_endpoints: {}\n"+
"packagepool_storage:\n" + "packagepool_storage:\n"+
" type: local\n" + " type: local\n"+
" path: /tmp/aptly-pool\n") " path: /tmp/aptly-pool\n")
} }