Check component names (that they do exist) before publish switching. #192

This commit is contained in:
Andrey Smirnov
2015-02-06 20:16:00 +03:00
parent 5d16cf06cf
commit 06502584cf
3 changed files with 18 additions and 0 deletions
+5
View File
@@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"github.com/smira/aptly/deb"
"github.com/smira/aptly/utils"
"github.com/smira/commander"
"github.com/smira/flag"
"strings"
@@ -61,6 +62,10 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
}
for i, component := range components {
if !utils.StrSliceHasItem(publishedComponents, component) {
return fmt.Errorf("unable to switch: component %s is not in published repository", component)
}
snapshot, err = context.CollectionFactory().SnapshotCollection().ByName(names[i])
if err != nil {
return fmt.Errorf("unable to switch: %s", err)