Identity v3 support for Swift

ncw/swift was bumped to latest version
This commit is contained in:
Einar Forselv
2016-09-14 15:29:11 +02:00
parent 34ea7e8d61
commit 511fb439ac
4 changed files with 30 additions and 10 deletions

View File

@@ -11,7 +11,7 @@ gom 'github.com/julienschmidt/httprouter', :commit => '46807412fe50aaceb73bb5706
gom 'github.com/mattn/go-shellwords', :commit => 'c7ca6f94add751566a61cf2199e1de78d4c3eee4'
gom 'github.com/mkrautz/goar', :commit => '282caa8bd9daba480b51f1d5a988714913b97aad'
gom 'github.com/mxk/go-flowrate/flowrate', :commit => 'cca7078d478f8520f85629ad7c68962d31ed7682'
gom 'github.com/ncw/swift', :commit => '384ef27c70645e285f8bb9d02276bf654d06027e'
gom 'github.com/ncw/swift', :commit => 'b964f2ca856aac39885e258ad25aec08d5f64ee6'
gom 'github.com/smira/go-aws-auth', :commit => '0070896e9d7f4f9f2d558532b2d896ce2239992a'
gom 'github.com/smira/go-xz', :commit => '0c531f070014e218b21f3cfca801cc992d52726d'
gom 'github.com/smira/commander', :commit => 'f408b00e68d5d6e21b9f18bd310978dafc604e47'

View File

@@ -337,7 +337,7 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
var err error
publishedStorage, err = swift.NewPublishedStorage(params.UserName, params.Password,
params.AuthURL, params.Tenant, params.TenantID, params.Container, params.Prefix)
params.AuthURL, params.Tenant, params.TenantID, params.Domain, params.DomainID, params.TenantDomain, params.TenantDomainID, params.Container, params.Prefix)
if err != nil {
Fatal(err)
}

View File

@@ -29,7 +29,7 @@ var (
// NewPublishedStorage creates new instance of PublishedStorage with specified Swift access
// keys, tenant and tenantId
func NewPublishedStorage(username string, password string, authURL string, tenant string, tenantID string, container string, prefix string) (*PublishedStorage, error) {
func NewPublishedStorage(username string, password string, authURL string, tenant string, tenantID string, domain string, domainID string, tenantDomain string, tenantDomainID string, container string, prefix string) (*PublishedStorage, error) {
if username == "" {
if username = os.Getenv("OS_USERNAME"); username == "" {
username = os.Getenv("ST_USER")
@@ -51,6 +51,18 @@ func NewPublishedStorage(username string, password string, authURL string, tenan
if tenantID == "" {
tenantID = os.Getenv("OS_TENANT_ID")
}
if domain == "" {
domain = os.Getenv("OS_USER_DOMAIN_NAME")
}
if domainID == "" {
domainID = os.Getenv("OS_USER_DOMAIN_ID")
}
if tenantDomain == "" {
tenantDomain = os.Getenv("OS_PROJECT_DOMAIN")
}
if tenantDomainID == "" {
tenantDomainID = os.Getenv("OS_PROJECT_DOMAIN_ID")
}
ct := swift.Connection{
UserName: username,
@@ -59,6 +71,10 @@ func NewPublishedStorage(username string, password string, authURL string, tenan
UserAgent: "aptly/" + aptly.Version,
Tenant: tenant,
TenantId: tenantID,
Domain: domain,
DomainId: domainID,
TenantDomain: tenantDomain,
TenantDomainId: tenantDomainID,
ConnectTimeout: 60 * time.Second,
Timeout: 60 * time.Second,
}

View File

@@ -46,13 +46,17 @@ type S3PublishRoot struct {
// SwiftPublishRoot describes single OpenStack Swift publishing entry point
type SwiftPublishRoot struct {
UserName string `json:"osname"`
Password string `json:"password"`
AuthURL string `json:"authurl"`
Tenant string `json:"tenant"`
TenantID string `json:"tenantid"`
Prefix string `json:"prefix"`
Container string `json:"container"`
UserName string `json:"osname"`
Password string `json:"password"`
AuthURL string `json:"authurl"`
Tenant string `json:"tenant"`
TenantID string `json:"tenantid"`
Domain string `json:"domain"`
DomainID string `json:"domainid"`
TenantDomain string `json:"tenantdomain"`
TenantDomainID string `json:"tenantdomainid"`
Prefix string `json:"prefix"`
Container string `json:"container"`
}
// Config is configuration for aptly, shared by all modules