forked from osbuild/osbuild-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload/azure: use the new azure/azblob API on Fedora 33+ & RHEL
Fedora 33 and rawhide got an updated version of the azblob library. Sadly, it introduced a non-compatible API change. This commit does the same thing as a67baf5 did for kolo/xmlrpc: We now have two wrappers around the affected part of the API. Fedora 32 uses the wrapper around the old API, whereas Fedora 33 and 34 (and RHEL with its vendored deps) use the wrapper around the new API. The switch is implemented using go build flags and spec file magic. See a67baf5 for more thoughts. Also, there's v0.11.1-0.20201209121048-6df5d9af221d in go.mod, why? The maintainers of azblob probably tagged a wrong commit with v0.12.0 which breaks go. The long v0.11.1-.* version is basically the proper v0.12.0 commit. See Azure/azure-storage-blob-go#236 for more information. Signed-off-by: Ondřej Budai <[email protected]>
- Loading branch information
1 parent
946a0b4
commit 760704b
Showing
214 changed files
with
24,648 additions
and
98,145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// +build !azblob_oldapi | ||
// | ||
// This file provides a wrapper around azure/azblob PageBlobURL. | ||
// | ||
// Version 0.12 of the azblob library changed the API of PageBlobURL. | ||
// (see https://github.com/Azure/azure-storage-blob-go/blob/master/BreakingChanges.md) | ||
// This means that different APIs are available in Fedora 32 and 33 (it does | ||
// not matter for RHEL as it uses vendored libraries). | ||
// This wrapper allows us to use both azblob's APIs using buildflags. | ||
// | ||
// This file is a wrapper for azblob equal or newer than 0.12. | ||
|
||
package azure | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"github.com/Azure/azure-storage-blob-go/azblob" | ||
) | ||
|
||
type PageBlobURL struct { | ||
impl azblob.PageBlobURL | ||
} | ||
|
||
func newPageBlobURL(containerURL azblob.ContainerURL, blobName string) PageBlobURL { | ||
pageblobURL := containerURL.NewPageBlobURL(blobName) | ||
|
||
return PageBlobURL{pageblobURL} | ||
} | ||
|
||
func (pb PageBlobURL) Create(ctx context.Context, size int64, sequenceNumber int64, h azblob.BlobHTTPHeaders, metadata azblob.Metadata, ac azblob.BlobAccessConditions) (*azblob.PageBlobCreateResponse, error) { | ||
return pb.impl.Create(ctx, size, sequenceNumber, h, metadata, ac, azblob.PremiumPageBlobAccessTierNone, azblob.BlobTagsMap{}, azblob.ClientProvidedKeyOptions{}) | ||
} | ||
|
||
func (pb PageBlobURL) SetHTTPHeaders(ctx context.Context, h azblob.BlobHTTPHeaders, ac azblob.BlobAccessConditions) (*azblob.BlobSetHTTPHeadersResponse, error) { | ||
return pb.impl.SetHTTPHeaders(ctx, h, ac) | ||
} | ||
|
||
func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.ReadSeeker, ac azblob.PageBlobAccessConditions, transactionalMD5 []byte) (*azblob.PageBlobUploadPagesResponse, error) { | ||
return pb.impl.UploadPages(ctx, offset, body, ac, transactionalMD5, azblob.ClientProvidedKeyOptions{}) | ||
} | ||
|
||
func (pb PageBlobURL) GetProperties(ctx context.Context, ac azblob.BlobAccessConditions) (*azblob.BlobGetPropertiesResponse, error) { | ||
return pb.impl.GetProperties(ctx, ac, azblob.ClientProvidedKeyOptions{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// +build azblob_oldapi | ||
// | ||
// This file provides a wrapper around azure/azblob PageBlobURL. | ||
// | ||
// Version 0.12 of the azblob library changed the API of PageBlobURL. | ||
// (see https://github.com/Azure/azure-storage-blob-go/blob/master/BreakingChanges.md) | ||
// This means that different APIs are available in Fedora 32 and 33 (it does | ||
// not matter for RHEL as it uses vendored libraries). | ||
// This wrapper allows us to use both azblob's APIs using buildflags. | ||
// | ||
// This file is a wrapper for azblob older than 0.12. | ||
|
||
package azure | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"github.com/Azure/azure-storage-blob-go/azblob" | ||
) | ||
|
||
type PageBlobURL struct { | ||
impl azblob.PageBlobURL | ||
} | ||
|
||
func newPageBlobURL(containerURL azblob.ContainerURL, blobName string) PageBlobURL { | ||
pageblobURL := containerURL.NewPageBlobURL(blobName) | ||
|
||
return PageBlobURL{pageblobURL} | ||
} | ||
|
||
func (pb PageBlobURL) Create(ctx context.Context, size int64, sequenceNumber int64, h azblob.BlobHTTPHeaders, metadata azblob.Metadata, ac azblob.BlobAccessConditions) (*azblob.PageBlobCreateResponse, error) { | ||
return pb.impl.Create(ctx, size, sequenceNumber, h, metadata, ac) | ||
} | ||
|
||
func (pb PageBlobURL) SetHTTPHeaders(ctx context.Context, h azblob.BlobHTTPHeaders, ac azblob.BlobAccessConditions) (*azblob.BlobSetHTTPHeadersResponse, error) { | ||
return pb.impl.SetHTTPHeaders(ctx, h, ac) | ||
} | ||
|
||
func (pb PageBlobURL) UploadPages(ctx context.Context, offset int64, body io.ReadSeeker, ac azblob.PageBlobAccessConditions, transactionalMD5 []byte) (*azblob.PageBlobUploadPagesResponse, error) { | ||
return pb.impl.UploadPages(ctx, offset, body, ac, transactionalMD5) | ||
} | ||
|
||
func (pb PageBlobURL) GetProperties(ctx context.Context, ac azblob.BlobAccessConditions) (*azblob.BlobGetPropertiesResponse, error) { | ||
return pb.impl.GetProperties(ctx, ac) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
69 changes: 0 additions & 69 deletions
69
vendor/github.com/Azure/azure-storage-blob-go/azblob/atomicmorph.go
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.