Updated Vendoring

This commit is contained in:
Suraj Narwade
2017-11-27 12:29:12 +05:30
parent 5de4aa85f8
commit b3f2134cec
298 changed files with 27729 additions and 66945 deletions
+31
View File
@@ -3,6 +3,8 @@ package yaml
import (
"errors"
"fmt"
"sort"
"strings"
)
// Networks represents a list of service networks in compose file.
@@ -20,6 +22,35 @@ type Network struct {
IPv6Address string `yaml:"ipv6_address,omitempty"`
}
// Generate a hash string to detect service network config changes
func (n *Networks) HashString() string {
if n == nil {
return ""
}
result := []string{}
for _, net := range n.Networks {
result = append(result, net.HashString())
}
sort.Strings(result)
return strings.Join(result, ",")
}
// Generate a hash string to detect service network config changes
func (n *Network) HashString() string {
if n == nil {
return ""
}
result := []string{}
result = append(result, n.Name)
result = append(result, n.RealName)
sort.Strings(n.Aliases)
result = append(result, strings.Join(n.Aliases, ","))
result = append(result, n.IPv4Address)
result = append(result, n.IPv6Address)
sort.Strings(result)
return strings.Join(result, ",")
}
// MarshalYAML implements the Marshaller interface.
func (n Networks) MarshalYAML() (interface{}, error) {
m := map[string]*Network{}
+14
View File
@@ -3,6 +3,7 @@ package yaml
import (
"errors"
"fmt"
"sort"
"strings"
)
@@ -19,6 +20,19 @@ type Volume struct {
AccessMode string `yaml:"-"`
}
// Generate a hash string to detect service volume config changes
func (v *Volumes) HashString() string {
if v == nil {
return ""
}
result := []string{}
for _, vol := range v.Volumes {
result = append(result, vol.String())
}
sort.Strings(result)
return strings.Join(result, ",")
}
// String implements the Stringer interface.
func (v *Volume) String() string {
var paths []string