|
@@ -4,6 +4,7 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"os"
|
|
"os"
|
|
|
|
+ "sort"
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/cobra"
|
|
@@ -62,9 +63,26 @@ func runDeploy(dockerCli *command.DockerCli, opts deployOptions) error {
|
|
|
|
|
|
config, err := loader.Load(configDetails)
|
|
config, err := loader.Load(configDetails)
|
|
if err != nil {
|
|
if err != nil {
|
|
|
|
+ if fpe, ok := err.(*loader.ForbiddenPropertiesError); ok {
|
|
|
|
+ return fmt.Errorf("Compose file contains unsupported options:\n\n%s\n",
|
|
|
|
+ propertyWarnings(fpe.Properties))
|
|
|
|
+ }
|
|
|
|
+
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ unsupportedProperties := loader.GetUnsupportedProperties(configDetails)
|
|
|
|
+ if len(unsupportedProperties) > 0 {
|
|
|
|
+ fmt.Printf("Ignoring unsupported options: %s\n\n",
|
|
|
|
+ strings.Join(unsupportedProperties, ", "))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ deprecatedProperties := loader.GetDeprecatedProperties(configDetails)
|
|
|
|
+ if len(deprecatedProperties) > 0 {
|
|
|
|
+ fmt.Printf("Ignoring deprecated options:\n\n%s\n\n",
|
|
|
|
+ propertyWarnings(deprecatedProperties))
|
|
|
|
+ }
|
|
|
|
+
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
if err := createNetworks(ctx, dockerCli, config.Networks, opts.namespace); err != nil {
|
|
if err := createNetworks(ctx, dockerCli, config.Networks, opts.namespace); err != nil {
|
|
return err
|
|
return err
|
|
@@ -72,6 +90,15 @@ func runDeploy(dockerCli *command.DockerCli, opts deployOptions) error {
|
|
return deployServices(ctx, dockerCli, config, opts.namespace, opts.sendRegistryAuth)
|
|
return deployServices(ctx, dockerCli, config, opts.namespace, opts.sendRegistryAuth)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func propertyWarnings(properties map[string]string) string {
|
|
|
|
+ var msgs []string
|
|
|
|
+ for name, description := range properties {
|
|
|
|
+ msgs = append(msgs, fmt.Sprintf("%s: %s", name, description))
|
|
|
|
+ }
|
|
|
|
+ sort.Strings(msgs)
|
|
|
|
+ return strings.Join(msgs, "\n\n")
|
|
|
|
+}
|
|
|
|
+
|
|
func getConfigDetails(opts deployOptions) (composetypes.ConfigDetails, error) {
|
|
func getConfigDetails(opts deployOptions) (composetypes.ConfigDetails, error) {
|
|
var details composetypes.ConfigDetails
|
|
var details composetypes.ConfigDetails
|
|
var err error
|
|
var err error
|
|
@@ -407,10 +434,11 @@ func convertRestartPolicy(restart string, source *composetypes.RestartPolicy) (*
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ attempts := uint64(*source.MaxAttempts)
|
|
return &swarm.RestartPolicy{
|
|
return &swarm.RestartPolicy{
|
|
Condition: swarm.RestartPolicyCondition(source.Condition),
|
|
Condition: swarm.RestartPolicyCondition(source.Condition),
|
|
Delay: source.Delay,
|
|
Delay: source.Delay,
|
|
- MaxAttempts: source.MaxAttempts,
|
|
|
|
|
|
+ MaxAttempts: &attempts,
|
|
Window: source.Window,
|
|
Window: source.Window,
|
|
}, nil
|
|
}, nil
|
|
}
|
|
}
|