mirror of https://github.com/kubernetes/kops.git
Don't require nodeup tasks to have SetName()
This commit is contained in:
parent
cd8681ccd0
commit
852e70f54d
|
@ -466,7 +466,7 @@ func (l *Loader) loadObjectMap(key string, data map[string]interface{}) (map[str
|
||||||
klog.V(4).Infof("Built %s:%s => %v", key, k, o.Interface())
|
klog.V(4).Infof("Built %s:%s => %v", key, k, o.Interface())
|
||||||
|
|
||||||
if inferredName {
|
if inferredName {
|
||||||
hn, ok := o.Interface().(fi.HasName)
|
hn, ok := o.Interface().(fi.HasSetName)
|
||||||
if ok {
|
if ok {
|
||||||
hn.SetName(name)
|
hn.SetName(name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,12 @@ limitations under the License.
|
||||||
|
|
||||||
package fi
|
package fi
|
||||||
|
|
||||||
// HasName indicates that the task has a Name
|
// HasName indicates that the task has a Name.
|
||||||
type HasName interface {
|
type HasName interface {
|
||||||
GetName() *string
|
GetName() *string
|
||||||
|
}
|
||||||
|
|
||||||
|
// HasSetName indicates that the task can set its Name.
|
||||||
|
type HasSetName interface {
|
||||||
SetName(name string)
|
SetName(name string)
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,10 +77,6 @@ func (e *Archive) GetName() *string {
|
||||||
return &e.Name
|
return &e.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Archive) SetName(name string) {
|
|
||||||
e.Name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns a string representation, implementing the Stringer interface
|
// String returns a string representation, implementing the Stringer interface
|
||||||
func (e *Archive) String() string {
|
func (e *Archive) String() string {
|
||||||
return fmt.Sprintf("Archive: %s %s->%s", e.Name, e.Source, e.TargetDir)
|
return fmt.Sprintf("Archive: %s %s->%s", e.Name, e.Source, e.TargetDir)
|
||||||
|
|
|
@ -55,10 +55,6 @@ func (e *BindMount) GetName() *string {
|
||||||
return fi.String("BindMount-" + e.Mountpoint)
|
return fi.String("BindMount-" + e.Mountpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *BindMount) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for BindMount task")
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ fi.HasDependencies = &BindMount{}
|
var _ fi.HasDependencies = &BindMount{}
|
||||||
|
|
||||||
// GetDependencies implements HasDependencies::GetDependencies
|
// GetDependencies implements HasDependencies::GetDependencies
|
||||||
|
|
|
@ -46,10 +46,6 @@ func (e *Chattr) GetName() *string {
|
||||||
return fi.String("Chattr-" + e.File)
|
return fi.String("Chattr-" + e.File)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *Chattr) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for Chattr task")
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ fi.HasDependencies = &Chattr{}
|
var _ fi.HasDependencies = &Chattr{}
|
||||||
|
|
||||||
// GetDependencies implements HasDependencies::GetDependencies
|
// GetDependencies implements HasDependencies::GetDependencies
|
||||||
|
|
|
@ -122,10 +122,6 @@ func (f *File) GetName() *string {
|
||||||
return &f.Path
|
return &f.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *File) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for File task")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *File) String() string {
|
func (f *File) String() string {
|
||||||
return fmt.Sprintf("File: %q", f.Path)
|
return fmt.Sprintf("File: %q", f.Path)
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,10 +47,6 @@ func (f *GroupTask) GetName() *string {
|
||||||
return &f.Name
|
return &f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *GroupTask) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for Group task")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *GroupTask) Find(c *fi.Context) (*GroupTask, error) {
|
func (e *GroupTask) Find(c *fi.Context) (*GroupTask, error) {
|
||||||
info, err := fi.LookupGroup(e.Name)
|
info, err := fi.LookupGroup(e.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -48,10 +48,6 @@ func (i *IssueCert) GetName() *string {
|
||||||
return &i.Name
|
return &i.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *IssueCert) SetName(name string) {
|
|
||||||
i.Name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
// String returns a string representation, implementing the Stringer interface
|
// String returns a string representation, implementing the Stringer interface
|
||||||
func (i *IssueCert) String() string {
|
func (i *IssueCert) String() string {
|
||||||
return fmt.Sprintf("IssueCert: %s", i.Name)
|
return fmt.Sprintf("IssueCert: %s", i.Name)
|
||||||
|
|
|
@ -74,10 +74,6 @@ func (t *LoadImageTask) GetName() *string {
|
||||||
return &t.Name
|
return &t.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *LoadImageTask) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for LoadImageTask")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *LoadImageTask) String() string {
|
func (t *LoadImageTask) String() string {
|
||||||
return fmt.Sprintf("LoadImageTask: %v", t.Sources)
|
return fmt.Sprintf("LoadImageTask: %v", t.Sources)
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,6 @@ func (f *Package) GetName() *string {
|
||||||
return &f.Name
|
return &f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Package) SetName(name string) {
|
|
||||||
f.Name = name
|
|
||||||
}
|
|
||||||
|
|
||||||
// isOSPackage returns true if this is an OS provided package (as opposed to a bare .deb, for example)
|
// isOSPackage returns true if this is an OS provided package (as opposed to a bare .deb, for example)
|
||||||
func (p *Package) isOSPackage() bool {
|
func (p *Package) isOSPackage() bool {
|
||||||
return fi.StringValue(p.Source) == ""
|
return fi.StringValue(p.Source) == ""
|
||||||
|
|
|
@ -381,7 +381,3 @@ var _ fi.HasName = &Service{}
|
||||||
func (f *Service) GetName() *string {
|
func (f *Service) GetName() *string {
|
||||||
return &f.Name
|
return &f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Service) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for Service task")
|
|
||||||
}
|
|
||||||
|
|
|
@ -49,10 +49,6 @@ func (f *UserTask) GetName() *string {
|
||||||
return &f.Name
|
return &f.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *UserTask) SetName(name string) {
|
|
||||||
klog.Fatalf("SetName not supported for User task")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e *UserTask) Find(c *fi.Context) (*UserTask, error) {
|
func (e *UserTask) Find(c *fi.Context) (*UserTask, error) {
|
||||||
info, err := fi.LookupUser(e.Name)
|
info, err := fi.LookupUser(e.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue