Merge pull request #347 from smira/skip-contents

Make 'skipContents' configurable in API. #345
This commit is contained in:
Andrey Smirnov
2016-02-14 15:06:49 +03:00
10 changed files with 31 additions and 2 deletions
+11
View File
@@ -97,6 +97,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
Label string
Origin string
ForceOverwrite bool
SkipContents *bool
Architectures []string
Signing SigningOptions
}
@@ -183,6 +184,11 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
published.Origin = b.Origin
published.Label = b.Label
published.SkipContents = context.Config().SkipContentsPublishing
if b.SkipContents != nil {
published.SkipContents = *b.SkipContents
}
duplicate := collection.CheckDuplicate(published)
if duplicate != nil {
context.CollectionFactory().PublishedRepoCollection().LoadComplete(duplicate, context.CollectionFactory())
@@ -213,6 +219,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
var b struct {
ForceOverwrite bool
Signing SigningOptions
SkipContents *bool
Snapshots []struct {
Component string `binding:"required"`
Name string `binding:"required"`
@@ -291,6 +298,10 @@ func apiPublishUpdateSwitch(c *gin.Context) {
c.Fail(500, fmt.Errorf("unknown published repository type"))
}
if b.SkipContents != nil {
published.SkipContents = *b.SkipContents
}
err = published.Publish(context.PackagePool(), context, context.CollectionFactory(), signer, nil, b.ForceOverwrite)
if err != nil {
c.Fail(500, fmt.Errorf("unable to update: %s", err))
+2
View File
@@ -119,6 +119,8 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
published.Origin = context.Flags().Lookup("origin").Value.String()
published.Label = context.Flags().Lookup("label").Value.String()
published.SkipContents = context.Config().SkipContentsPublishing
if context.Flags().IsSet("skip-contents") {
published.SkipContents = context.Flags().Lookup("skip-contents").Value.Get().(bool)
}
+1
View File
@@ -290,6 +290,7 @@ func (p *PublishedRepo) MarshalJSON() ([]byte, error) {
"SourceKind": p.SourceKind,
"Sources": sources,
"Storage": p.Storage,
"SkipContents": p.SkipContents,
})
}
+5 -2
View File
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "APTLY" "1" "January 2016" "" ""
.TH "APTLY" "1" "February 2016" "" ""
.
.SH "NAME"
\fBaptly\fR \- Debian repository management tool
@@ -48,6 +48,7 @@ Configuration file is stored in JSON format (default values shown below):
"downloadSourcePackages": false,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
"skipContentsPublishing": false,
"S3PublishEndpoints": {
"test": {
"region": "us\-east\-1",
@@ -55,7 +56,6 @@ Configuration file is stored in JSON format (default values shown below):
"endpoint": "",
"awsAccessKeyID": "",
"awsSecretAccessKey": "",
"awsSessionToken": "",
"prefix": "",
"acl": "public\-read",
"storageClass": "",
@@ -1819,5 +1819,8 @@ Vincent Bernat (https://github\.com/vincentbernat)
.IP "\[ci]" 4
x539 (https://github\.com/x539)
.
.IP "\[ci]" 4
Phil Frost (https://github\.com/bitglue)
.
.IP "" 0
+1
View File
@@ -40,6 +40,7 @@ Configuration file is stored in JSON format (default values shown below):
"downloadSourcePackages": false,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
"skipContentsPublishing": false,
"S3PublishEndpoints": {
"test": {
"region": "us-east-1",
+1
View File
@@ -12,6 +12,7 @@
"downloadSourcePackages": false,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
"skipContentsPublishing": false,
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {}
}
+1
View File
@@ -12,6 +12,7 @@
"downloadSourcePackages": false,
"ppaDistributorID": "ubuntu",
"ppaCodename": "",
"skipContentsPublishing": false,
"S3PublishEndpoints": {},
"SwiftPublishEndpoints": {}
}
+7
View File
@@ -41,6 +41,7 @@ class PublishAPITestRepo(APITest):
'Label': '',
'Origin': '',
'Prefix': prefix,
'SkipContents': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': ''}
@@ -74,6 +75,7 @@ class PublishAPITestRepo(APITest):
'Label': '',
'Origin': '',
'Prefix': ".",
'SkipContents': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': ''}
@@ -129,6 +131,7 @@ class PublishSnapshotAPITest(APITest):
'Label': '',
'Origin': '',
'Prefix': prefix,
'SkipContents': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot_name}],
'Storage': ''})
@@ -188,6 +191,7 @@ class PublishUpdateAPITestRepo(APITest):
'Label': '',
'Origin': '',
'Prefix': prefix,
'SkipContents': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': ''}
@@ -238,6 +242,7 @@ class PublishSwitchAPITestRepo(APITest):
'Label': '',
'Origin': '',
'Prefix': prefix,
'SkipContents': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
'Storage': ''}
@@ -261,6 +266,7 @@ class PublishSwitchAPITestRepo(APITest):
json={
"Snapshots": [{"Component": "main", "Name": snapshot2_name}],
"Signing": DefaultSigningOptions,
"SkipContents": True,
})
repo_expected = {
'Architectures': ['i386', 'source'],
@@ -268,6 +274,7 @@ class PublishSwitchAPITestRepo(APITest):
'Label': '',
'Origin': '',
'Prefix': prefix,
'SkipContents': True,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot2_name}],
'Storage': ''}
+1
View File
@@ -21,6 +21,7 @@ type ConfigStructure struct {
DownloadSourcePackages bool `json:"downloadSourcePackages"`
PpaDistributorID string `json:"ppaDistributorID"`
PpaCodename string `json:"ppaCodename"`
SkipContentsPublishing bool `json:"skipContentsPublishing"`
S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints"`
SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints"`
}
+1
View File
@@ -62,6 +62,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
" \"downloadSourcePackages\": false,\n"+
" \"ppaDistributorID\": \"\",\n"+
" \"ppaCodename\": \"\",\n"+
" \"skipContentsPublishing\": false,\n"+
" \"S3PublishEndpoints\": {\n"+
" \"test\": {\n"+
" \"region\": \"us-east-1\",\n"+