mirror of https://github.com/kubernetes/kops.git
fixing remapping, as it was not returning the remapped data. Code and logging cleanup
This commit is contained in:
parent
ec93c35df3
commit
bfc78e18b7
|
@ -44,6 +44,8 @@ func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var yamlSep = []byte("\n\n---\n\n")
|
||||||
|
var remappedManifest []byte
|
||||||
for _, manifest := range manifests {
|
for _, manifest := range manifests {
|
||||||
err := manifest.RemapImages(a.remapImage)
|
err := manifest.RemapImages(a.remapImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -54,10 +56,12 @@ func (a *AssetBuilder) RemapManifest(data []byte) ([]byte, error) {
|
||||||
return nil, fmt.Errorf("error re-marshalling manifest: %v", err)
|
return nil, fmt.Errorf("error re-marshalling manifest: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
glog.Infof("manifest: %v", string(y))
|
glog.V(10).Infof("manifest: %v", string(y))
|
||||||
|
remappedManifest = append(remappedManifest, y...)
|
||||||
|
remappedManifest = append(remappedManifest, yamlSep...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return data, nil
|
return remappedManifest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AssetBuilder) remapImage(image string) (string, error) {
|
func (a *AssetBuilder) remapImage(image string) (string, error) {
|
||||||
|
|
|
@ -32,10 +32,6 @@ func (m *Manifest) RemapImages(mapper ImageRemapFunction) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//if changed {
|
|
||||||
// // invalidate cached rendering
|
|
||||||
// m.bytes = nil
|
|
||||||
//}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Manifest struct {
|
type Manifest struct {
|
||||||
//bytes []byte
|
|
||||||
data map[string]interface{}
|
data map[string]interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,14 +51,10 @@ func LoadManifestsFrom(contents []byte) ([]*Manifest, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manifest) ToYAML() ([]byte, error) {
|
func (m *Manifest) ToYAML() ([]byte, error) {
|
||||||
//if m.bytes == nil {
|
|
||||||
b, err := yaml.Marshal(m.data)
|
b, err := yaml.Marshal(m.data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error marshalling manifest to yaml: %v", err)
|
return nil, fmt.Errorf("error marshalling manifest to yaml: %v", err)
|
||||||
}
|
}
|
||||||
// m.bytes = b
|
|
||||||
//}
|
|
||||||
//return m.bytes, nil
|
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,17 +26,17 @@ type visitorBase struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *visitorBase) VisitString(path []string, v string, mutator func(string)) error {
|
func (m *visitorBase) VisitString(path []string, v string, mutator func(string)) error {
|
||||||
glog.Infof("string value at %s: %s", strings.Join(path, "."), v)
|
glog.V(10).Infof("string value at %s: %s", strings.Join(path, "."), v)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *visitorBase) VisitBool(path []string, v bool, mutator func(bool)) error {
|
func (m *visitorBase) VisitBool(path []string, v bool, mutator func(bool)) error {
|
||||||
glog.Infof("string value at %s: %s", strings.Join(path, "."), v)
|
glog.V(10).Infof("string value at %s: %s", strings.Join(path, "."), v)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *visitorBase) VisitFloat64(path []string, v float64, mutator func(float64)) error {
|
func (m *visitorBase) VisitFloat64(path []string, v float64, mutator func(float64)) error {
|
||||||
glog.Infof("float64 value at %s: %s", strings.Join(path, "."), v)
|
glog.V(10).Infof("float64 value at %s: %s", strings.Join(path, "."), v)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue