mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-02 04:50:49 +00:00
Merge branch 's3-sigv2-debug'
This commit is contained in:
@@ -12,6 +12,7 @@ gom 'github.com/mattn/go-shellwords', :commit => 'c7ca6f94add751566a61cf2199e1de
|
|||||||
gom 'github.com/mkrautz/goar', :commit => '282caa8bd9daba480b51f1d5a988714913b97aad'
|
gom 'github.com/mkrautz/goar', :commit => '282caa8bd9daba480b51f1d5a988714913b97aad'
|
||||||
gom 'github.com/mxk/go-flowrate/flowrate', :commit => 'cca7078d478f8520f85629ad7c68962d31ed7682'
|
gom 'github.com/mxk/go-flowrate/flowrate', :commit => 'cca7078d478f8520f85629ad7c68962d31ed7682'
|
||||||
gom 'github.com/ncw/swift', :commit => '384ef27c70645e285f8bb9d02276bf654d06027e'
|
gom 'github.com/ncw/swift', :commit => '384ef27c70645e285f8bb9d02276bf654d06027e'
|
||||||
|
gom 'github.com/smira/go-aws-auth', :commit => '0070896e9d7f4f9f2d558532b2d896ce2239992a'
|
||||||
gom 'github.com/smira/go-xz', :commit => '0c531f070014e218b21f3cfca801cc992d52726d'
|
gom 'github.com/smira/go-xz', :commit => '0c531f070014e218b21f3cfca801cc992d52726d'
|
||||||
gom 'github.com/smira/commander', :commit => 'f408b00e68d5d6e21b9f18bd310978dafc604e47'
|
gom 'github.com/smira/commander', :commit => 'f408b00e68d5d6e21b9f18bd310978dafc604e47'
|
||||||
gom 'github.com/smira/flag', :commit => '357ed3e599ffcbd4aeaa828e1d10da2df3ea5107'
|
gom 'github.com/smira/flag', :commit => '357ed3e599ffcbd4aeaa828e1d10da2df3ea5107'
|
||||||
|
|||||||
+2
-1
@@ -324,7 +324,8 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
|
|||||||
publishedStorage, err = s3.NewPublishedStorage(
|
publishedStorage, err = s3.NewPublishedStorage(
|
||||||
params.AccessKeyID, params.SecretAccessKey, params.SessionToken,
|
params.AccessKeyID, params.SecretAccessKey, params.SessionToken,
|
||||||
params.Region, params.Endpoint, params.Bucket, params.ACL, params.Prefix, params.StorageClass,
|
params.Region, params.Endpoint, params.Bucket, params.ACL, params.Prefix, params.StorageClass,
|
||||||
params.EncryptionMethod, params.PlusWorkaround, params.DisableMultiDel)
|
params.EncryptionMethod, params.PlusWorkaround, params.DisableMultiDel,
|
||||||
|
params.ForceSigV2, params.Debug)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fatal(err)
|
Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "APTLY" "1" "February 2016" "" ""
|
.TH "APTLY" "1" "March 2016" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBaptly\fR \- Debian repository management tool
|
\fBaptly\fR \- Debian repository management tool
|
||||||
@@ -61,7 +61,9 @@ Configuration file is stored in JSON format (default values shown below):
|
|||||||
"storageClass": "",
|
"storageClass": "",
|
||||||
"encryptionMethod": "",
|
"encryptionMethod": "",
|
||||||
"plusWorkaround": false,
|
"plusWorkaround": false,
|
||||||
"disableMultiDel": false
|
"disableMultiDel": false,
|
||||||
|
"forceSigV2": false,
|
||||||
|
"debug": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"SwiftPublishEndpoints": {
|
"SwiftPublishEndpoints": {
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ Configuration file is stored in JSON format (default values shown below):
|
|||||||
"storageClass": "",
|
"storageClass": "",
|
||||||
"encryptionMethod": "",
|
"encryptionMethod": "",
|
||||||
"plusWorkaround": false,
|
"plusWorkaround": false,
|
||||||
"disableMultiDel": false
|
"disableMultiDel": false,
|
||||||
|
"forceSigV2": false,
|
||||||
|
"debug": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"SwiftPublishEndpoints": {
|
"SwiftPublishEndpoints": {
|
||||||
|
|||||||
+21
-2
@@ -3,11 +3,14 @@ package s3
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/corehandlers"
|
||||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/s3"
|
"github.com/aws/aws-sdk-go/service/s3"
|
||||||
"github.com/smira/aptly/aptly"
|
"github.com/smira/aptly/aptly"
|
||||||
"github.com/smira/aptly/files"
|
"github.com/smira/aptly/files"
|
||||||
|
"github.com/smira/go-aws-auth"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -63,10 +66,14 @@ func NewPublishedStorageRaw(
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func signV2(req *request.Request) {
|
||||||
|
awsauth.SignS3(req.HTTPRequest)
|
||||||
|
}
|
||||||
|
|
||||||
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
|
// NewPublishedStorage creates new instance of PublishedStorage with specified S3 access
|
||||||
// keys, region and bucket name
|
// keys, region and bucket name
|
||||||
func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix,
|
func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, bucket, defaultACL, prefix,
|
||||||
storageClass, encryptionMethod string, plusWorkaround, disableMultiDel bool) (*PublishedStorage, error) {
|
storageClass, encryptionMethod string, plusWorkaround, disableMultiDel, forceSigV2, debug bool) (*PublishedStorage, error) {
|
||||||
|
|
||||||
config := &aws.Config{
|
config := &aws.Config{
|
||||||
Region: aws.String(region),
|
Region: aws.String(region),
|
||||||
@@ -80,8 +87,20 @@ func NewPublishedStorage(accessKey, secretKey, sessionToken, region, endpoint, b
|
|||||||
config.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, sessionToken)
|
config.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, sessionToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewPublishedStorageRaw(bucket, defaultACL, prefix, storageClass,
|
if debug {
|
||||||
|
config = config.WithLogLevel(aws.LogDebug)
|
||||||
|
}
|
||||||
|
|
||||||
|
result, err := NewPublishedStorageRaw(bucket, defaultACL, prefix, storageClass,
|
||||||
encryptionMethod, plusWorkaround, disableMultiDel, config)
|
encryptionMethod, plusWorkaround, disableMultiDel, config)
|
||||||
|
|
||||||
|
if err == nil && forceSigV2 {
|
||||||
|
result.s3.Handlers.Sign.Clear()
|
||||||
|
result.s3.Handlers.Sign.PushBackNamed(corehandlers.BuildContentLengthHandler)
|
||||||
|
result.s3.Handlers.Sign.PushBack(signV2)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// String
|
// String
|
||||||
|
|||||||
+2
-2
@@ -27,9 +27,9 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
|||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
c.Assert(s.srv, NotNil)
|
c.Assert(s.srv, NotNil)
|
||||||
|
|
||||||
s.storage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "", "", "", false, true)
|
s.storage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "", "", "", false, true, false, false)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
s.prefixedStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "lala", "", "", false, true)
|
s.prefixedStorage, err = NewPublishedStorage("aa", "bb", "", "test-1", s.srv.URL(), "test", "", "lala", "", "", false, true, false, false)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
_, err = s.storage.s3.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String("test")})
|
_, err = s.storage.s3.CreateBucket(&s3.CreateBucketInput{Bucket: aws.String("test")})
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ type S3PublishRoot struct {
|
|||||||
EncryptionMethod string `json:"encryptionMethod"`
|
EncryptionMethod string `json:"encryptionMethod"`
|
||||||
PlusWorkaround bool `json:"plusWorkaround"`
|
PlusWorkaround bool `json:"plusWorkaround"`
|
||||||
DisableMultiDel bool `json:"disableMultiDel"`
|
DisableMultiDel bool `json:"disableMultiDel"`
|
||||||
|
ForceSigV2 bool `json:"forceSigV2"`
|
||||||
|
Debug bool `json:"debug"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SwiftPublishRoot describes single OpenStack Swift publishing entry point
|
// SwiftPublishRoot describes single OpenStack Swift publishing entry point
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
|||||||
" \"storageClass\": \"\",\n"+
|
" \"storageClass\": \"\",\n"+
|
||||||
" \"encryptionMethod\": \"\",\n"+
|
" \"encryptionMethod\": \"\",\n"+
|
||||||
" \"plusWorkaround\": false,\n"+
|
" \"plusWorkaround\": false,\n"+
|
||||||
" \"disableMultiDel\": false\n"+
|
" \"disableMultiDel\": false,\n"+
|
||||||
|
" \"forceSigV2\": false,\n"+
|
||||||
|
" \"debug\": false\n"+
|
||||||
" }\n"+
|
" }\n"+
|
||||||
" },\n"+
|
" },\n"+
|
||||||
" \"SwiftPublishEndpoints\": {\n"+
|
" \"SwiftPublishEndpoints\": {\n"+
|
||||||
|
|||||||
Reference in New Issue
Block a user