forked from LaconicNetwork/kompose
Updated Vendoring
This commit is contained in:
+31
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user